Skip to content

Latest commit

 

History

History
186 lines (123 loc) · 13.1 KB

File metadata and controls

186 lines (123 loc) · 13.1 KB

EmailSMSTemplates

(email_sms_templates)

Overview

Available Operations

  • list - List all templates ⚠️ Deprecated
  • revert - Revert a template ⚠️ Deprecated
  • get - Retrieve a template ⚠️ Deprecated
  • toggle_template_delivery - Toggle the delivery by Clerk for a template of a given type and slug ⚠️ Deprecated

list

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.

Example Usage

import clerk_backend_api
from clerk_backend_api import Clerk

s = Clerk(
    bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
)

res = s.email_sms_templates.list(template_type=clerk_backend_api.TemplateType.EMAIL)

if res is not None:
    # handle response
    pass

Parameters

Parameter Type Required Description Example
template_type models.TemplateType ✔️ The type of templates to list (email or SMS) email
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

List[models.Template]

Errors

Error Type Status Code Content Type
models.ClerkErrors 400, 401, 422 application/json
models.SDKError 4XX, 5XX */*

revert

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.

Example Usage

import clerk_backend_api
from clerk_backend_api import Clerk

s = Clerk(
    bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
)

res = s.email_sms_templates.revert(template_type=clerk_backend_api.RevertTemplatePathParamTemplateType.EMAIL, slug="welcome-email")

if res is not None:
    # handle response
    pass

Parameters

Parameter Type Required Description Example
template_type models.RevertTemplatePathParamTemplateType ✔️ The type of template to revert email
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.

Response

models.Template

Errors

Error Type Status Code Content Type
models.ClerkErrors 400, 401, 402, 404 application/json
models.SDKError 4XX, 5XX */*

get

Returns the details of a template

⚠️ DEPRECATED: This will be removed in a future release, please migrate away from it as soon as possible.

Example Usage

import clerk_backend_api
from clerk_backend_api import Clerk

s = Clerk(
    bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
)

res = s.email_sms_templates.get(template_type=clerk_backend_api.PathParamTemplateType.EMAIL, slug="welcome-email")

if res is not None:
    # handle response
    pass

Parameters

Parameter Type Required Description Example
template_type models.PathParamTemplateType ✔️ The type of templates to retrieve (email or SMS) email
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.

Response

models.Template

Errors

Error Type Status Code Content Type
models.ClerkErrors 400, 401, 404 application/json
models.SDKError 4XX, 5XX */*

toggle_template_delivery

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.

Example Usage

import clerk_backend_api
from clerk_backend_api import Clerk

s = Clerk(
    bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
)

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

Parameters

Parameter Type Required Description Example
template_type models.ToggleTemplateDeliveryPathParamTemplateType ✔️ The type of template to toggle delivery for email
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.

Response

models.Template

Errors

Error Type Status Code Content Type
models.ClerkErrors 400, 401, 404 application/json
models.SDKError 4XX, 5XX */*