(EmailAndSmsTemplates)
Upsert- Update a template for a given type and slug⚠️ DeprecatedRevert- Revert a template⚠️ DeprecatedPreview- Preview changes to a template⚠️ Deprecated
Updates the existing template of the given type and slug
⚠️ DEPRECATED: This will be removed in a future release, please migrate away from it as soon as possible.
using Clerk.BackendAPI;
using Clerk.BackendAPI.Models.Operations;
using Clerk.BackendAPI.Models.Components;
var sdk = new ClerkBackendApi(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");
var res = await sdk.EmailAndSmsTemplates.UpsertAsync(
templateType: Clerk.BackendAPI.Models.Operations.UpsertTemplatePathParamTemplateType.Sms,
slug: "verification-code",
requestBody: new UpsertTemplateRequestBody() {
Name = "Verification Code",
Subject = "Your Verification Code",
Markup = "<p>Your code: {{code}}</p>",
Body = "Use this code to verify your email: {{code}}",
DeliveredByClerk = true,
FromEmailName = "hello",
ReplyToEmailName = "support",
}
);
// handle response
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
TemplateType |
UpsertTemplatePathParamTemplateType | ✔️ | The type of template to update | sms |
Slug |
string | ✔️ | The slug of the template to update | verification-code |
RequestBody |
UpsertTemplateRequestBody | ➖ | N/A |
Error Type | Status Code | Content Type |
---|---|---|
Clerk.BackendAPI.Models.Errors.ClerkErrors | 400, 401, 402, 403, 404, 422 | application/json |
Clerk.BackendAPI.Models.Errors.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.
using Clerk.BackendAPI;
using Clerk.BackendAPI.Models.Operations;
using Clerk.BackendAPI.Models.Components;
var sdk = new ClerkBackendApi(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");
var res = await sdk.EmailAndSmsTemplates.RevertAsync(
templateType: Clerk.BackendAPI.Models.Operations.RevertTemplatePathParamTemplateType.Email,
slug: "welcome-email"
);
// handle response
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
TemplateType |
RevertTemplatePathParamTemplateType | ✔️ | The type of template to revert | |
Slug |
string | ✔️ | The slug of the template to revert | welcome-email |
Error Type | Status Code | Content Type |
---|---|---|
Clerk.BackendAPI.Models.Errors.ClerkErrors | 400, 401, 402, 404 | application/json |
Clerk.BackendAPI.Models.Errors.SDKError | 4XX, 5XX | */* |
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.
using Clerk.BackendAPI;
using Clerk.BackendAPI.Models.Operations;
using Clerk.BackendAPI.Models.Components;
var sdk = new ClerkBackendApi(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");
var res = await sdk.EmailAndSmsTemplates.PreviewAsync(
templateType: "email",
slug: "welcome-email",
requestBody: new PreviewTemplateRequestBody() {
Subject = "Welcome to our service!",
Body = "Hi, thank you for joining our service.",
FromEmailName = "hello",
ReplyToEmailName = "support",
}
);
// handle response
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
TemplateType |
string | ✔️ | The type of template to preview | |
Slug |
string | ✔️ | The slug of the template to preview | welcome-email |
RequestBody |
PreviewTemplateRequestBody | ➖ | Required parameters |
Error Type | Status Code | Content Type |
---|---|---|
Clerk.BackendAPI.Models.Errors.ClerkErrors | 400, 401, 404, 422 | application/json |
Clerk.BackendAPI.Models.Errors.SDKError | 4XX, 5XX | */* |