(templates)
preview- Preview changes to a template⚠️ Deprecated
Returns a preview of a template for a given template_type, slug and body
⚠️ DEPRECATED: This will be removed in a future release, please migrate away from it as soon as possible.
from clerk_backend_api import Clerk
with Clerk(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as clerk:
res = clerk.templates.preview(template_type="email", slug="welcome-email", subject="Welcome to our service!", body="Hi, thank you for joining our service.", from_email_name="hello", reply_to_email_name="support")
assert res is not None
# Handle response
print(res)
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
template_type |
str | ✔️ | The type of template to preview | |
slug |
str | ✔️ | The slug of the template to preview | welcome-email |
subject |
OptionalNullable[str] | ➖ | The email subject. Applicable only to email templates. |
Welcome to our service! |
body |
Optional[str] | ➖ | The template body before variable interpolation | Hi, thank you for joining our service. |
from_email_name |
Optional[str] | ➖ | The local part of the From email address that will be used for emails. For example, in the address '[email protected]', the local part is 'hello'. Applicable only to email templates. |
hello |
reply_to_email_name |
Optional[str] | ➖ | The local part of the Reply To email address that will be used for emails. For example, in the address '[email protected]', the local part is 'hello'. Applicable only to email templates. |
support |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.PreviewTemplateResponseBody
Error Type | Status Code | Content Type |
---|---|---|
models.ClerkErrors | 400, 401, 404, 422 | application/json |
models.SDKError | 4XX, 5XX | */* |