(email_sms_templates)
list- List all templates⚠️ Deprecatedrevert- Revert a template⚠️ Deprecatedget- Retrieve a template⚠️ Deprecatedtoggle_template_delivery- Toggle the delivery by Clerk for a template of a given type and slug⚠️ Deprecated
Returns a list of all templates. The templates are returned sorted by position.
⚠️ DEPRECATED: This will be removed in a future release, please migrate away from it as soon as possible.
import clerk_backend_api
from clerk_backend_api import Clerk
with Clerk(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as s:
res = s.email_sms_templates.list(template_type=clerk_backend_api.TemplateType.EMAIL)
if res is not None:
# handle response
pass
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
template_type |
models.TemplateType | ✔️ | The type of templates to list (email or SMS) | |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Error Type | Status Code | Content Type |
---|---|---|
models.ClerkErrors | 400, 401, 422 | application/json |
models.SDKError | 4XX, 5XX | */* |
Reverts an updated template to its default state
⚠️ DEPRECATED: This will be removed in a future release, please migrate away from it as soon as possible.
import clerk_backend_api
from clerk_backend_api import Clerk
with Clerk(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as s:
res = s.email_sms_templates.revert(template_type=clerk_backend_api.RevertTemplatePathParamTemplateType.EMAIL, slug="welcome-email")
if res is not None:
# handle response
pass
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
template_type |
models.RevertTemplatePathParamTemplateType | ✔️ | The type of template to revert | |
slug |
str | ✔️ | The slug of the template to revert | welcome-email |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Error Type | Status Code | Content Type |
---|---|---|
models.ClerkErrors | 400, 401, 402, 404 | application/json |
models.SDKError | 4XX, 5XX | */* |
Returns the details of a template
⚠️ DEPRECATED: This will be removed in a future release, please migrate away from it as soon as possible.
import clerk_backend_api
from clerk_backend_api import Clerk
with Clerk(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as s:
res = s.email_sms_templates.get(template_type=clerk_backend_api.PathParamTemplateType.EMAIL, slug="welcome-email")
if res is not None:
# handle response
pass
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
template_type |
models.PathParamTemplateType | ✔️ | The type of templates to retrieve (email or SMS) | |
slug |
str | ✔️ | The slug (i.e. machine-friendly name) of the template to retrieve | welcome-email |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Error Type | Status Code | Content Type |
---|---|---|
models.ClerkErrors | 400, 401, 404 | application/json |
models.SDKError | 4XX, 5XX | */* |
Toggles the delivery by Clerk for a template of a given type and slug.
If disabled, Clerk will not deliver the resulting email or SMS.
The app developer will need to listen to the email.created
or sms.created
webhooks in order to handle delivery themselves.
⚠️ DEPRECATED: This will be removed in a future release, please migrate away from it as soon as possible.
import clerk_backend_api
from clerk_backend_api import Clerk
with Clerk(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as s:
res = s.email_sms_templates.toggle_template_delivery(template_type=clerk_backend_api.ToggleTemplateDeliveryPathParamTemplateType.EMAIL, slug="welcome-email", delivered_by_clerk=True)
if res is not None:
# handle response
pass
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
template_type |
models.ToggleTemplateDeliveryPathParamTemplateType | ✔️ | The type of template to toggle delivery for | |
slug |
str | ✔️ | The slug of the template for which to toggle delivery | welcome-email |
delivered_by_clerk |
OptionalNullable[bool] | ➖ | Whether Clerk should deliver emails or SMS messages based on the current template | true |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
Error Type | Status Code | Content Type |
---|---|---|
models.ClerkErrors | 400, 401, 404 | application/json |
models.SDKError | 4XX, 5XX | */* |