(emailSMSTemplates())
list- List all templates⚠️ Deprecatedrevert- Revert a template⚠️ Deprecatedget- Retrieve a template⚠️ DeprecatedtoggleTemplateDelivery- 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.
package hello.world;
import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.GetTemplateListResponse;
import com.clerk.backend_api.models.operations.TemplateType;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws ClerkErrors, Exception {
Clerk sdk = Clerk.builder()
.bearerAuth("<YOUR_BEARER_TOKEN_HERE>")
.build();
GetTemplateListResponse res = sdk.emailSMSTemplates().list()
.templateType(TemplateType.SMS)
.call();
if (res.templateList().isPresent()) {
// handle response
}
}
}
Parameter | Type | Required | Description |
---|---|---|---|
templateType |
TemplateType | ✔️ | The type of templates to list (email or SMS) |
Error Type | Status Code | Content Type |
---|---|---|
models/errors/ClerkErrors | 400, 401, 422 | application/json |
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.
package hello.world;
import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.RevertTemplatePathParamTemplateType;
import com.clerk.backend_api.models.operations.RevertTemplateResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws ClerkErrors, Exception {
Clerk sdk = Clerk.builder()
.bearerAuth("<YOUR_BEARER_TOKEN_HERE>")
.build();
RevertTemplateResponse res = sdk.emailSMSTemplates().revert()
.templateType(RevertTemplatePathParamTemplateType.EMAIL)
.slug("<value>")
.call();
if (res.template().isPresent()) {
// handle response
}
}
}
Parameter | Type | Required | Description |
---|---|---|---|
templateType |
RevertTemplatePathParamTemplateType | ✔️ | The type of template to revert |
slug |
String | ✔️ | The slug of the template to revert |
Error Type | Status Code | Content Type |
---|---|---|
models/errors/ClerkErrors | 400, 401, 402, 404 | application/json |
models/errors/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.
package hello.world;
import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.GetTemplateResponse;
import com.clerk.backend_api.models.operations.PathParamTemplateType;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws ClerkErrors, Exception {
Clerk sdk = Clerk.builder()
.bearerAuth("<YOUR_BEARER_TOKEN_HERE>")
.build();
GetTemplateResponse res = sdk.emailSMSTemplates().get()
.templateType(PathParamTemplateType.SMS)
.slug("<value>")
.call();
if (res.template().isPresent()) {
// handle response
}
}
}
Parameter | Type | Required | Description |
---|---|---|---|
templateType |
PathParamTemplateType | ✔️ | The type of templates to retrieve (email or SMS) |
slug |
String | ✔️ | The slug (i.e. machine-friendly name) of the template to retrieve |
Error Type | Status Code | Content Type |
---|---|---|
models/errors/ClerkErrors | 400, 401, 404 | application/json |
models/errors/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.
package hello.world;
import com.clerk.backend_api.Clerk;
import com.clerk.backend_api.models.errors.ClerkErrors;
import com.clerk.backend_api.models.operations.ToggleTemplateDeliveryPathParamTemplateType;
import com.clerk.backend_api.models.operations.ToggleTemplateDeliveryRequestBody;
import com.clerk.backend_api.models.operations.ToggleTemplateDeliveryResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws ClerkErrors, Exception {
Clerk sdk = Clerk.builder()
.bearerAuth("<YOUR_BEARER_TOKEN_HERE>")
.build();
ToggleTemplateDeliveryResponse res = sdk.emailSMSTemplates().toggleTemplateDelivery()
.templateType(ToggleTemplateDeliveryPathParamTemplateType.SMS)
.slug("<value>")
.requestBody(ToggleTemplateDeliveryRequestBody.builder()
.build())
.call();
if (res.template().isPresent()) {
// handle response
}
}
}
Parameter | Type | Required | Description |
---|---|---|---|
templateType |
ToggleTemplateDeliveryPathParamTemplateType | ✔️ | The type of template to toggle delivery for |
slug |
String | ✔️ | The slug of the template for which to toggle delivery |
requestBody |
Optional<ToggleTemplateDeliveryRequestBody> | ➖ | N/A |
ToggleTemplateDeliveryResponse
Error Type | Status Code | Content Type |
---|---|---|
models/errors/ClerkErrors | 400, 401, 404 | application/json |
models/errors/SDKError | 4XX, 5XX | */* |