openapi: 3.2.0 info: contact: email: support@sinch.com name: support at sinch description: '# Overview The Template Management API offers a way to manage templates that can be used together with the Conversation API.' title: Template Management Templates V2 API version: '2.0' license: name: MIT url: https://www.sinch.com/toc servers: - url: https://{region}.template.api.sinch.com variables: region: default: us enum: - us - eu - br description: The {region} variable must be set to us, eu, or br, and it must match the region in which you created your Conversation API app. security: - Basic: [] - oAuth2: [] tags: - description: Version 2 endpoints for managing message templates. Recommended version for all users. Includes strongly typed `translations` field (allowing for message definition using JSON structures also used in the send message request of the Conversation API), improved validation, and the ability to override omni-channel templates in favor of channel-specific templates (where available). name: Templates V2 paths: /v2/projects/{project_id}/templates: get: tags: - Templates V2 summary: List all templates belonging to a project ID operationId: Templates_v2_ListTemplates parameters: - description: Required. The project ID. name: project_id in: path required: true schema: type: string responses: '200': description: A successful response. content: application/json: schema: $ref: '#/components/schemas/v2ListTemplatesResponse' default: description: An unexpected error response. content: application/json: schema: $ref: '#/components/schemas/runtimeError' x-codeSamples: - lang: Java source: "/**\n * Sinch Java Snippet\n *\n *

This snippet is available at https://github.com/sinch/sinch-sdk-java\n *\n *

See https://github.com/sinch/sinch-sdk-java/blob/main/examples/snippets/README.md for details\n */\npackage conversation.templates.v2;\n\nimport com.sinch.sdk.SinchClient;\nimport com.sinch.sdk.domains.conversation.templates.api.v2.TemplatesV2Service;\nimport com.sinch.sdk.domains.conversation.templates.models.v2.response.TemplatesV2ListResponse;\nimport com.sinch.sdk.models.Configuration;\nimport com.sinch.sdk.models.ConversationRegion;\nimport java.util.logging.Logger;\nimport utils.Settings;\n\npublic class List {\n\n private static final Logger LOGGER = Logger.getLogger(List.class.getName());\n\n public static void main(String[] args) {\n\n String projectId = Settings.getProjectId().orElse(\"MY_PROJECT_ID\");\n String keyId = Settings.getKeyId().orElse(\"MY_KEY_ID\");\n String keySecret = Settings.getKeySecret().orElse(\"MY_KEY_SECRET\");\n String conversationRegion = Settings.getConversationRegion().orElse(\"MY_CONVERSATION_REGION\");\n\n Configuration configuration =\n Configuration.builder()\n .setProjectId(projectId)\n .setKeyId(keyId)\n .setKeySecret(keySecret)\n .setConversationRegion(ConversationRegion.from(conversationRegion))\n .build();\n\n SinchClient client = new SinchClient(configuration);\n\n TemplatesV2Service templatesServiceV2 = client.conversation().templates().v2();\n\n LOGGER.info(\"List templates V2\");\n\n TemplatesV2ListResponse result = templatesServiceV2.list();\n\n LOGGER.info(\"Response: \");\n result.iterator().forEachRemaining(f -> LOGGER.info(String.format(\"- %s: %s\", f.getId(), f)));\n }\n}\n" - lang: Node.js source: "/**\n * Sinch Node.js Snippet\n * See: https://github.com/sinch/sinch-sdk-node/examples/snippets\n */\nimport { SinchClient } from '@sinch/sdk-core';\nimport * as dotenv from 'dotenv';\ndotenv.config();\n\nasync function main() {\n const projectId = process.env.SINCH_PROJECT_ID ?? 'MY_PROJECT_ID';\n const keyId = process.env.SINCH_KEY_ID ?? 'MY_KEY_ID';\n const keySecret = process.env.SINCH_KEY_SECRET ?? 'MY_KEY_SECRET';\n const conversationRegion = process.env.SINCH_CONVERSATION_REGION ?? 'MY_CONVERSATION_REGION';\n\n const sinch = new SinchClient({ projectId, keyId, keySecret, conversationRegion });\n\n try {\n const response = await sinch.conversation.templatesV2.list({});\n if (!response.templates?.length) {\n console.log('No Templates found.');\n return;\n }\n console.log(`✅ Found ${response.templates.length} Templates.`);\n response.templates.forEach((template) => {\n console.log(template);\n });\n } catch (err) {\n console.error('❌ Failed to list the Templates:');\n console.error(err);\n }\n}\n\nmain();\n" post: tags: - Templates V2 summary: Creates a template operationId: Templates_v2_CreateTemplate parameters: - description: Required. The project ID. name: project_id in: path required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/v2Template' required: - default_translation - translations examples: createTemplate: $ref: '#/components/examples/createTemplateV2' description: Required. The template to create. required: true responses: '200': description: A successful response. content: application/json: schema: $ref: '#/components/schemas/v2Template' default: description: An unexpected error response. content: application/json: schema: $ref: '#/components/schemas/runtimeError' x-codeSamples: - lang: Java source: "/**\n * Sinch Java Snippet\n *\n *

This snippet is available at https://github.com/sinch/sinch-sdk-java\n *\n *

See https://github.com/sinch/sinch-sdk-java/blob/main/examples/snippets/README.md for details\n */\npackage conversation.templates.v2;\n\nimport com.sinch.sdk.SinchClient;\nimport com.sinch.sdk.domains.conversation.models.v1.messages.types.text.TextMessage;\nimport com.sinch.sdk.domains.conversation.templates.api.v2.TemplatesV2Service;\nimport com.sinch.sdk.domains.conversation.templates.models.v2.TemplateTranslation;\nimport com.sinch.sdk.domains.conversation.templates.models.v2.TemplateV2;\nimport com.sinch.sdk.models.Configuration;\nimport com.sinch.sdk.models.ConversationRegion;\nimport java.util.Collections;\nimport java.util.logging.Logger;\nimport utils.Settings;\n\npublic class Create {\n\n private static final Logger LOGGER = Logger.getLogger(Create.class.getName());\n\n public static void main(String[] args) {\n\n String projectId = Settings.getProjectId().orElse(\"MY_PROJECT_ID\");\n String keyId = Settings.getKeyId().orElse(\"MY_KEY_ID\");\n String keySecret = Settings.getKeySecret().orElse(\"MY_KEY_SECRET\");\n String conversationRegion = Settings.getConversationRegion().orElse(\"MY_CONVERSATION_REGION\");\n\n Configuration configuration =\n Configuration.builder()\n .setProjectId(projectId)\n .setKeyId(keyId)\n .setKeySecret(keySecret)\n .setConversationRegion(ConversationRegion.from(conversationRegion))\n .build();\n\n SinchClient client = new SinchClient(configuration);\n\n TemplatesV2Service templatesServiceV2 = client.conversation().templates().v2();\n TemplateV2 request =\n TemplateV2.builder()\n .setDefaultTranslation(\"en-US\")\n .setTranslations(\n Collections.singletonList(\n TemplateTranslation.builder()\n .setLanguageCode(\"en-US\")\n .setMessage(\n TextMessage.builder().setText(\"my text from V2 template\").build())\n .build()))\n .build();\n\n LOGGER.info(\"Create template\");\n\n TemplateV2 response = templatesServiceV2.create(request);\n\n LOGGER.info(\"Response: \" + response);\n }\n}\n" - lang: Node.js source: "/**\n * Sinch Node.js Snippet\n * See: https://github.com/sinch/sinch-sdk-node/examples/snippets\n */\nimport { SinchClient } from '@sinch/sdk-core';\nimport * as dotenv from 'dotenv';\ndotenv.config();\n\nasync function main() {\n const projectId = process.env.SINCH_PROJECT_ID ?? 'MY_PROJECT_ID';\n const keyId = process.env.SINCH_KEY_ID ?? 'MY_KEY_ID';\n const keySecret = process.env.SINCH_KEY_SECRET ?? 'MY_KEY_SECRET';\n const conversationRegion = process.env.SINCH_CONVERSATION_REGION ?? 'MY_CONVERSATION_REGION';\n\n const sinch = new SinchClient({ projectId, keyId, keySecret, conversationRegion });\n\n try {\n const response = await sinch.conversation.templatesV2.create({\n createTemplateRequestBody: {\n default_translation: 'en-US',\n translations: [\n {\n language_code: 'en-US',\n version: '1',\n location_message: {\n title: 'Title',\n coordinates: { latitude: 59.3360453, longitude: 18.0117363 },\n },\n },\n ],\n },\n });\n console.log('✅ Successfully created the Template.');\n console.log(JSON.stringify(response, null, 2));\n } catch (err) {\n console.error('❌ Failed to create the Template:');\n console.error(err);\n }\n}\n\nmain();\n" /v2/projects/{project_id}/templates/{template_id}/translations: get: tags: - Templates V2 summary: List translations for a template operationId: Templates_v2_ListTranslations parameters: - description: Required. The project ID. name: project_id in: path required: true schema: type: string - description: Required. The ID of the template to fetch. name: template_id in: path required: true schema: type: string - description: Optional. The translation's language code. name: language_code in: query required: false schema: type: string - description: Optional. The translation's version. name: translation_version in: query required: false schema: type: string responses: '200': description: A successful response. content: application/json: schema: $ref: '#/components/schemas/v2ListTranslationsResponse' default: description: An unexpected error response. content: application/json: schema: $ref: '#/components/schemas/runtimeError' x-codeSamples: - lang: Java source: "/**\n * Sinch Java Snippet\n *\n *

This snippet is available at https://github.com/sinch/sinch-sdk-java\n *\n *

See https://github.com/sinch/sinch-sdk-java/blob/main/examples/snippets/README.md for details\n */\npackage conversation.templates.v2;\n\nimport com.sinch.sdk.SinchClient;\nimport com.sinch.sdk.domains.conversation.templates.api.v2.TemplatesV2Service;\nimport com.sinch.sdk.domains.conversation.templates.models.v2.response.TranslationsV2ListResponse;\nimport com.sinch.sdk.models.Configuration;\nimport com.sinch.sdk.models.ConversationRegion;\nimport java.util.logging.Logger;\nimport utils.Settings;\n\npublic class ListTranslations {\n\n private static final Logger LOGGER = Logger.getLogger(ListTranslations.class.getName());\n\n public static void main(String[] args) {\n\n String projectId = Settings.getProjectId().orElse(\"MY_PROJECT_ID\");\n String keyId = Settings.getKeyId().orElse(\"MY_KEY_ID\");\n String keySecret = Settings.getKeySecret().orElse(\"MY_KEY_SECRET\");\n String conversationRegion = Settings.getConversationRegion().orElse(\"MY_CONVERSATION_REGION\");\n\n // The ID of the template to retrieve translations for\n String conversationTemplateId = \"TEMPLATE_ID\";\n\n Configuration configuration =\n Configuration.builder()\n .setProjectId(projectId)\n .setKeyId(keyId)\n .setKeySecret(keySecret)\n .setConversationRegion(ConversationRegion.from(conversationRegion))\n .build();\n\n SinchClient client = new SinchClient(configuration);\n\n TemplatesV2Service templatesServiceV2 = client.conversation().templates().v2();\n\n LOGGER.info(\n String.format(\"List translations for template with ID '%s'\", conversationTemplateId));\n\n TranslationsV2ListResponse response =\n templatesServiceV2.listTranslations(conversationTemplateId, null);\n\n LOGGER.info(\"Response: \");\n\n response.iterator().forEachRemaining(f -> LOGGER.info(String.format(\"- %s\", f)));\n }\n}\n" - lang: Node.js source: "/**\n * Sinch Node.js Snippet\n * See: https://github.com/sinch/sinch-sdk-node/examples/snippets\n */\nimport { SinchClient } from '@sinch/sdk-core';\nimport * as dotenv from 'dotenv';\ndotenv.config();\n\nasync function main() {\n const projectId = process.env.SINCH_PROJECT_ID ?? 'MY_PROJECT_ID';\n const keyId = process.env.SINCH_KEY_ID ?? 'MY_KEY_ID';\n const keySecret = process.env.SINCH_KEY_SECRET ?? 'MY_KEY_SECRET';\n const conversationRegion = process.env.SINCH_CONVERSATION_REGION ?? 'MY_CONVERSATION_REGION';\n\n // The ID of the Template to list Translations for\n const templateId = 'TEMPLATE_ID';\n\n const sinch = new SinchClient({ projectId, keyId, keySecret, conversationRegion });\n\n try {\n const response = await sinch.conversation.templatesV2.listTranslations({\n template_id: templateId,\n });\n if (!response.translations?.length) {\n console.log(`No Translations found for Template with ID ${templateId}.`);\n return;\n }\n console.log(`✅ Found ${response.translations.length} Translations.`);\n response.translations.forEach((translation) => {\n console.log(translation);\n });\n } catch (err) {\n console.error('❌ Failed to list the Translations:');\n console.error(err);\n }\n}\n\nmain();\n" /v2/projects/{project_id}/templates/{template_id}: put: tags: - Templates V2 summary: Updates a template operationId: Templates_v2_UpdateTemplate parameters: - description: Required. The project ID. name: project_id in: path required: true schema: type: string - description: The id of the template to be updated. Specified or automatically generated during template creation. Unique per project. name: template_id in: path required: true schema: type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/v2Template' required: - id - version examples: updateTemplate: $ref: '#/components/examples/updateTemplateV2' description: Required. The updated template. required: true responses: '200': description: A successful response. content: application/json: schema: $ref: '#/components/schemas/v2Template' default: description: An unexpected error response. content: application/json: schema: $ref: '#/components/schemas/runtimeError' x-codeSamples: - lang: Java source: "/**\n * Sinch Java Snippet\n *\n *

This snippet is available at https://github.com/sinch/sinch-sdk-java\n *\n *

See https://github.com/sinch/sinch-sdk-java/blob/main/examples/snippets/README.md for details\n */\npackage conversation.templates.v2;\n\nimport com.sinch.sdk.SinchClient;\nimport com.sinch.sdk.domains.conversation.models.v1.messages.types.text.TextMessage;\nimport com.sinch.sdk.domains.conversation.templates.api.v2.TemplatesV2Service;\nimport com.sinch.sdk.domains.conversation.templates.models.v2.TemplateTranslation;\nimport com.sinch.sdk.domains.conversation.templates.models.v2.TemplateV2;\nimport com.sinch.sdk.models.Configuration;\nimport com.sinch.sdk.models.ConversationRegion;\nimport java.util.Collections;\nimport java.util.logging.Logger;\nimport utils.Settings;\n\npublic class Update {\n\n private static final Logger LOGGER = Logger.getLogger(Update.class.getName());\n\n public static void main(String[] args) {\n\n String projectId = Settings.getProjectId().orElse(\"MY_PROJECT_ID\");\n String keyId = Settings.getKeyId().orElse(\"MY_KEY_ID\");\n String keySecret = Settings.getKeySecret().orElse(\"MY_KEY_SECRET\");\n String conversationRegion = Settings.getConversationRegion().orElse(\"MY_CONVERSATION_REGION\");\n\n // The ID of the template to update\n String conversationTemplateId = \"TEMPLATE_ID\";\n\n Configuration configuration =\n Configuration.builder()\n .setProjectId(projectId)\n .setKeyId(keyId)\n .setKeySecret(keySecret)\n .setConversationRegion(ConversationRegion.from(conversationRegion))\n .build();\n\n SinchClient client = new SinchClient(configuration);\n\n TemplatesV2Service templatesServiceV2 = client.conversation().templates().v2();\n\n TemplateV2 request =\n TemplateV2.builder()\n .setDescription(\"Updated description from V2 API\")\n .setVersion(2)\n .setDefaultTranslation(\"en-US\")\n .setTranslations(\n Collections.singletonList(\n TemplateTranslation.builder()\n .setVersion(\"1\")\n .setLanguageCode(\"en-US\")\n .setMessage(\n TextMessage.builder()\n .setText(\"my updated text from V2 template\")\n .build())\n .build()))\n .build();\n\n LOGGER.info(String.format(\"Update template with ID '%s'\", conversationTemplateId));\n\n TemplateV2 response = templatesServiceV2.update(conversationTemplateId, request);\n\n LOGGER.info(\"Response: \" + response);\n }\n}\n" - lang: Node.js source: "/**\n * Sinch Node.js Snippet\n * See: https://github.com/sinch/sinch-sdk-node/examples/snippets\n */\nimport { SinchClient } from '@sinch/sdk-core';\nimport * as dotenv from 'dotenv';\ndotenv.config();\n\nasync function main() {\n const projectId = process.env.SINCH_PROJECT_ID ?? 'MY_PROJECT_ID';\n const keyId = process.env.SINCH_KEY_ID ?? 'MY_KEY_ID';\n const keySecret = process.env.SINCH_KEY_SECRET ?? 'MY_KEY_SECRET';\n const conversationRegion = process.env.SINCH_CONVERSATION_REGION ?? 'MY_CONVERSATION_REGION';\n\n // The ID of the Template to update\n const templateId = 'TEMPLATE_ID';\n\n const sinch = new SinchClient({ projectId, keyId, keySecret, conversationRegion });\n\n try {\n const response = await sinch.conversation.templatesV2.update({\n template_id: templateId,\n updateTemplateRequestBody: {\n description: 'Updated description from Templates V1 API',\n default_translation: 'en-US',\n translations: [\n {\n language_code: 'en-US',\n version: '2',\n variables: [\n {\n key: 'name',\n preview_value: 'Professor Jones',\n },\n ],\n text_message: {\n text: 'Hello ${name}. Text message template created with V2 API',\n },\n },\n ],\n },\n });\n console.log('✅ Successfully updated the Template.');\n console.log(JSON.stringify(response, null, 2));\n } catch (err) {\n console.error(`❌ Failed to update the Template with ID ${templateId}:`);\n console.error(err);\n }\n}\n\nmain();\n" get: tags: - Templates V2 summary: Get a template operationId: Templates_v2_GetTemplate parameters: - description: Required. The project ID. name: project_id in: path required: true schema: type: string - description: Required. The ID of the template to fetch. name: template_id in: path required: true schema: type: string responses: '200': description: A successful response. content: application/json: schema: $ref: '#/components/schemas/v2Template' default: description: An unexpected error response. content: application/json: schema: $ref: '#/components/schemas/runtimeError' x-codeSamples: - lang: Java source: "/**\n * Sinch Java Snippet\n *\n *

This snippet is available at https://github.com/sinch/sinch-sdk-java\n *\n *

See https://github.com/sinch/sinch-sdk-java/blob/main/examples/snippets/README.md for details\n */\npackage conversation.templates.v2;\n\nimport com.sinch.sdk.SinchClient;\nimport com.sinch.sdk.domains.conversation.templates.api.v2.TemplatesV2Service;\nimport com.sinch.sdk.domains.conversation.templates.models.v2.TemplateV2;\nimport com.sinch.sdk.models.Configuration;\nimport com.sinch.sdk.models.ConversationRegion;\nimport java.util.logging.Logger;\nimport utils.Settings;\n\npublic class Get {\n\n private static final Logger LOGGER = Logger.getLogger(Get.class.getName());\n\n public static void main(String[] args) {\n\n String projectId = Settings.getProjectId().orElse(\"MY_PROJECT_ID\");\n String keyId = Settings.getKeyId().orElse(\"MY_KEY_ID\");\n String keySecret = Settings.getKeySecret().orElse(\"MY_KEY_SECRET\");\n String conversationRegion = Settings.getConversationRegion().orElse(\"MY_CONVERSATION_REGION\");\n\n // The ID of the template to retrieve\n String conversationTemplateId = \"TEMPLATE_ID\";\n\n Configuration configuration =\n Configuration.builder()\n .setProjectId(projectId)\n .setKeyId(keyId)\n .setKeySecret(keySecret)\n .setConversationRegion(ConversationRegion.from(conversationRegion))\n .build();\n\n SinchClient client = new SinchClient(configuration);\n\n TemplatesV2Service templatesServiceV2 = client.conversation().templates().v2();\n\n LOGGER.info(\n String.format(\"Get information about template with ID '%s'\", conversationTemplateId));\n\n TemplateV2 response = templatesServiceV2.get(conversationTemplateId);\n\n LOGGER.info(\"Response: \" + response);\n }\n}\n" - lang: Node.js source: "/**\n * Sinch Node.js Snippet\n * See: https://github.com/sinch/sinch-sdk-node/examples/snippets\n */\nimport { SinchClient } from '@sinch/sdk-core';\nimport * as dotenv from 'dotenv';\ndotenv.config();\n\nasync function main() {\n const projectId = process.env.SINCH_PROJECT_ID ?? 'MY_PROJECT_ID';\n const keyId = process.env.SINCH_KEY_ID ?? 'MY_KEY_ID';\n const keySecret = process.env.SINCH_KEY_SECRET ?? 'MY_KEY_SECRET';\n const conversationRegion = process.env.SINCH_CONVERSATION_REGION ?? 'MY_CONVERSATION_REGION';\n\n // The ID of the Template to retrieve\n const templateId = 'TEMPLATE_ID';\n\n const sinch = new SinchClient({ projectId, keyId, keySecret, conversationRegion });\n\n try {\n const response = await sinch.conversation.templatesV2.get({\n template_id: templateId,\n });\n console.log('✅ Successfully retrieved the Template.');\n console.log(JSON.stringify(response, null, 2));\n } catch (err) {\n console.error(`❌ Failed to retrieve the Template with ID ${templateId}:`);\n console.error(err);\n }\n}\n\nmain();\n" delete: tags: - Templates V2 summary: Delete a template operationId: Templates_v2_DeleteTemplate parameters: - description: Required. The project ID. name: project_id in: path required: true schema: type: string - description: Required. The ID of the template to delete. name: template_id in: path required: true schema: type: string responses: '200': description: A successful response. content: application/json: schema: {} default: description: An unexpected error response. content: application/json: schema: $ref: '#/components/schemas/runtimeError' x-codeSamples: - lang: Java source: "/**\n * Sinch Java Snippet\n *\n *

This snippet is available at https://github.com/sinch/sinch-sdk-java\n *\n *

See https://github.com/sinch/sinch-sdk-java/blob/main/examples/snippets/README.md for details\n */\npackage conversation.templates.v2;\n\nimport com.sinch.sdk.SinchClient;\nimport com.sinch.sdk.domains.conversation.templates.api.v2.TemplatesV2Service;\nimport com.sinch.sdk.models.Configuration;\nimport com.sinch.sdk.models.ConversationRegion;\nimport java.util.logging.Logger;\nimport utils.Settings;\n\npublic class Delete {\n\n private static final Logger LOGGER = Logger.getLogger(Delete.class.getName());\n\n public static void main(String[] args) {\n\n String projectId = Settings.getProjectId().orElse(\"MY_PROJECT_ID\");\n String keyId = Settings.getKeyId().orElse(\"MY_KEY_ID\");\n String keySecret = Settings.getKeySecret().orElse(\"MY_KEY_SECRET\");\n String conversationRegion = Settings.getConversationRegion().orElse(\"MY_CONVERSATION_REGION\");\n\n // The ID of the template to delete\n String conversationTemplateId = \"TEMPLATE_ID\";\n\n Configuration configuration =\n Configuration.builder()\n .setProjectId(projectId)\n .setKeyId(keyId)\n .setKeySecret(keySecret)\n .setConversationRegion(ConversationRegion.from(conversationRegion))\n .build();\n\n SinchClient client = new SinchClient(configuration);\n\n TemplatesV2Service templatesServiceV2 = client.conversation().templates().v2();\n\n LOGGER.info(String.format(\"Deleting template with ID '%s'\", conversationTemplateId));\n\n templatesServiceV2.delete(conversationTemplateId);\n\n LOGGER.info(\"Done\");\n }\n}\n" - lang: Node.js source: "/**\n * Sinch Node.js Snippet\n * See: https://github.com/sinch/sinch-sdk-node/examples/snippets\n */\nimport { SinchClient } from '@sinch/sdk-core';\nimport * as dotenv from 'dotenv';\ndotenv.config();\n\nasync function main() {\n const projectId = process.env.SINCH_PROJECT_ID ?? 'MY_PROJECT_ID';\n const keyId = process.env.SINCH_KEY_ID ?? 'MY_KEY_ID';\n const keySecret = process.env.SINCH_KEY_SECRET ?? 'MY_KEY_SECRET';\n const conversationRegion = process.env.SINCH_CONVERSATION_REGION ?? 'MY_CONVERSATION_REGION';\n\n // The ID of the Template to delete\n const templateId = 'TEMPLATE_ID';\n\n const sinch = new SinchClient({ projectId, keyId, keySecret, conversationRegion });\n\n try {\n await sinch.conversation.templatesV2.delete({\n template_id: templateId,\n });\n console.log(`✅ Successfully deleted the Template with ID ${templateId}.`);\n } catch (err) {\n console.error(`❌ Failed to delete the Template with ID ${templateId}:`);\n console.error(err);\n }\n}\n\nmain();\n" components: schemas: Choices: type: object properties: choices: type: array description: The number of choices is limited to 10. items: $ref: '#/components/schemas/Choice' v2ListTemplatesResponse: type: - object properties: templates: type: - array items: $ref: '#/components/schemas/v2Template' UrlInfo: type: object title: URL Info description: A URL/website required: - url properties: url: description: The URL to be referenced type: string type: description: Optional. URL type, e.g. Org or Social type: string LocationMessageField: type: object description: Message containing geographic location. title: Location properties: location_message: title: Location Message type: object required: - coordinates - title properties: coordinates: $ref: '#/components/schemas/Coordinates' label: description: Label or name for the position. type: string title: description: The title is shown close to the button or link that leads to a map showing the location. The title can be clickable in some cases. type: string runtimeError: type: object properties: error: type: object properties: code: type: integer format: int32 details: type: array items: $ref: '#/components/schemas/protobufAny' message: type: string status: type: string ListMessageField: type: object title: List description: A message containing a list of options to choose from. All items must be of the same type. properties: list_message: title: List Message type: object required: - title - sections properties: title: description: A title for the message that is displayed near the products or choices. type: string description: description: This is an optional field, containing a description for the message. type: string media: $ref: '#/components/schemas/MediaProperties' sections: description: List of ListSection objects containing choices to be presented in the list message. type: array items: $ref: '#/components/schemas/ListSection' message_properties: description: Additional properties for the message. Required if sending a product list message. properties: catalog_id: description: Required if sending a product list message. The ID of the catalog to which the products belong. type: string menu: description: Optional. Sets the text for the menu of a choice list message. type: string whatsapp_header: description: Optional. Sets the text for the header of a WhatsApp choice list message. Ignored for other channels. type: string Choice: description: A choice is an action the user can take such as buttons for quick replies or other call to actions. type: object title: Choice message allOf: - $ref: '#/components/schemas/choiceTypes' - $ref: '#/components/schemas/choiceCommonProps' CarouselMessageField: description: Message containing a list of cards often rendered horizontally on supported channels. type: object title: Carousel properties: carousel_message: title: Carousel Message type: object required: - cards properties: cards: description: A list of up to 10 cards. type: array items: $ref: '#/components/schemas/CardMessage' choices: description: Optional. Outer choices on the carousel level. The number of outer choices is limited to 3. type: array items: $ref: '#/components/schemas/Choice' ShareLocationMessageField: description: Message requesting location from a user. type: object title: Request location properties: share_location_message: title: Share Location Message type: object required: - title - fallback_url properties: title: description: The title is shown close to the button that leads to open a map to share a location. type: string fallback_url: description: The URL that is opened when channel does not have support for this type. type: string ChannelTemplateOverridesMap: description: 'Field to override the omnichannel template by referring to a channel-specific template. The key in the map must point to a valid conversation channel. Currently only `WHATSAPP` and `KAKAOTALK` are supported' type: object additionalProperties: $ref: '#/components/schemas/ChannelTemplateOverride' CardHeight: description: You can set the desired size of the card in the message. type: string x-enumDescriptions: UNSPECIFIED_HEIGHT: The height of the card is unspecified. SHORT: The shortest card height. MEDIUM: Medium card height. TALL: The tallest card height. enum: - UNSPECIFIED_HEIGHT - SHORT - MEDIUM - TALL choiceCommonProps: type: object properties: postback_data: description: An optional field. This data will be returned in the ChoiceResponseMessage. The default is message_id_{text, title}. display_mode: $ref: '#/components/schemas/DisplayMode' NameInfo: type: object title: Name of the contact description: Name information of the contact. required: - full_name properties: full_name: description: Full name of the contact type: string first_name: description: First name. type: string last_name: description: Last name. type: string middle_name: description: Middle name. type: string prefix: description: Prefix before the name. e.g. Mr, Mrs, Dr etc. type: string suffix: description: Suffix after the name. type: string PhoneNumberInfo: type: object title: Phone number description: Phone numbers of the contact. required: - phone_number properties: phone_number: description: Phone number with country code included. type: string type: description: Phone number type, e.g. WORK or HOME. type: string v2Template: type: - object properties: id: description: 'The id of the template. Specify this yourself during creation. Otherwise, we will generate an ID for you. This must be unique for a given project.' type: - string example: id_string description: description: The description of the template. type: - string example: Template description version: description: 'The version of the template. While creating a template, this will be defaulted to 1. When updating a template, you must supply the latest version of the template in order for the update to be successful.' type: - integer example: 1 default_translation: type: - string description: 'The default translation to use if not specified. Specified as a BCP-47 `language_code` and the `language_code` must exist in the translations list.' example: en-US translations: type: array items: $ref: '#/components/schemas/v2TemplateTranslation' create_time: description: Timestamp of when the template was created. type: - string format: date-time readOnly: true update_time: description: Timestamp when the template was updated. type: - string format: date-time readOnly: true AddressInfo: type: object title: Address information description: Physical addresses of the contact. properties: city: description: City Name type: string country: description: Country Name type: string state: description: Name of a state or region of a country. type: string zip: description: Zip/postal code type: string type: description: Address type, e.g. WORK or HOME type: string country_code: description: Two letter country code. type: string ContactInfoMessageField: type: object description: Message containing contact information. title: Contact Info properties: contact_info_message: title: Contact Info Message type: object required: - name - phone_numbers properties: name: $ref: '#/components/schemas/NameInfo' phone_numbers: description: Phone numbers of the contact type: array items: $ref: '#/components/schemas/PhoneNumberInfo' addresses: description: Physical addresses of the contact type: array items: $ref: '#/components/schemas/AddressInfo' email_addresses: description: Email addresses of the contact type: array items: $ref: '#/components/schemas/EmailInfo' organization: $ref: '#/components/schemas/OrganizationInfo' urls: description: URLs/websites associated with the contact type: array items: $ref: '#/components/schemas/UrlInfo' birthday: description: Date of birth in YYYY-MM-DD format. type: string ListSection: type: object title: List Section description: Section for interactive WhatsApp messages containing ListItem required: - items properties: title: description: Optional parameter. Title for list section. type: string items: type: array items: $ref: '#/components/schemas/ListItem' TemplateReference: type: object title: Template reference with concrete parameter values description: The referenced template can be an omnichannel template stored in Conversation API Template Store as an AppMessage. You may also reference external channel-specific templates, such as a WhatsApp Business Template. Note that channel-specific template references are not supported when populating the `explicit_channel_omni_message` field. required: - template_id properties: version: type: string description: 'Used to specify what version of a template to use. Required when using `omni_channel_override` and `omni_template` fields. This will be used in conjunction with `language_code`. Note that, when referencing omni-channel templates using the [Sinch Customer Dashboard](https://dashboard.sinch.com/), the latest version of a given omni-template can be identified by populating this field with `latest`.' language_code: description: 'The BCP-47 language code, such as `en_US` or `sr_Latn`. For more information, see http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. English is the default `language_code`. Note that, while many API calls involving templates accept either the dashed format (`en-US`) or the underscored format (`en_US`), some channel specific templates (for example, WhatsApp channel-specific templates) only accept the underscored format. Note that this field is required for WhatsApp channel-specific templates.' type: string parameters: description: 'Required if the template has parameters. Concrete values must be present for all defined parameters in the template. Parameters can be different for different versions and/or languages of the template.' type: object additionalProperties: type: string template_id: description: The ID of the template. Note that, in the case of WhatsApp channel-specific templates, this field must be populated by the name of the template. type: string ChoiceItem: type: object title: Choice description: A message component for interactive messages, containing a choice. required: - title properties: title: type: string description: Required parameter. Title for the choice item. description: type: string description: Optional parameter. The description (or subtitle) of this choice item. media: description: Optional parameter. The media of this choice item. allOf: - $ref: '#/components/schemas/MediaProperties' postback_data: type: string description: Optional parameter. Postback data that will be returned in the MO if the user selects this option. UrlMessageField: description: A generic URL message. type: object title: URL properties: url_message: title: URL Message type: object required: - title - url properties: title: description: The title shown close to the URL. The title can be clickable in some cases. type: string url: description: The url to show. type: string TemplateMessageField: type: object description: Message referring to predefined template title: Template Message properties: template_message: type: object title: Template Message properties: channel_template: description: 'Optional. Channel specific template reference with parameters per channel. The channel template if exists overrides the omnichannel template. At least one of `channel_template` or `omni_template` needs to be present. The key in the map must point to a valid conversation channel as defined by the enum ConversationChannel.' type: object additionalProperties: $ref: '#/components/schemas/TemplateReference' omni_template: $ref: '#/components/schemas/TemplateReferenceWithVersion' typeTemplateVariable: type: object properties: key: type: string preview_value: type: string CalendarMessageField: description: Message containing details about a calendar event. type: object title: Calendar properties: calendar_message: title: Calendar message type: object required: - title - event_start - event_end - event_title - fallback_url properties: title: description: The title is shown close to the button that leads to open a user calendar. type: string event_start: description: The timestamp defines start of a calendar event. type: string format: date-time example: '2025-11-30T10:00:00Z' event_end: description: The timestamp defines end of a calendar event. type: string format: date-time example: '2025-11-30T11:00:00Z' event_title: description: Title of a calendar event. type: string event_description: description: Description of a calendar event. type: string fallback_url: description: The URL that is opened when the user cannot open a calendar event directly or channel does not have support for this type. type: string DisplayMode: description: Controls the display behavior of a choice. Only supported for Choice Message on the RCS channel. Has no effect on other channels or message types, except for a carousel's outer choices, where it is rejected outright. type: string x-enumDescriptions: DISPLAY_MODE_UNSPECIFIED: Default. Transient — choice disappears when new messages arrive. PERSISTENT: Persistent — choice remains visible in the message bubble. enum: - DISPLAY_MODE_UNSPECIFIED - PERSISTENT ChannelTemplateOverride: type: - object properties: template_reference: $ref: '#/components/schemas/TemplateReference' parameter_mappings: description: A mapping between omni-template variables and the channel specific parameters. type: - object additionalProperties: type: string ChoiceMessagePropertiesField: type: object title: Properties description: Additional properties for the message. properties: message_properties: type: object properties: whatsapp_footer: description: Optional. Sets the text for the footer of a WhatsApp reply button or URL button message. Ignored for other channels. type: string OrganizationInfo: type: object title: Organization information description: Organization information of the contact. properties: company: description: Company name type: string department: description: Department at the company type: string title: description: Corporate title, e.g. Software engineer type: string choiceTypes: type: object oneOf: - $ref: '#/components/schemas/CallMessageField' - $ref: '#/components/schemas/LocationMessageField' - $ref: '#/components/schemas/TextMessageField' - $ref: '#/components/schemas/UrlMessageField' - $ref: '#/components/schemas/CalendarMessageField' - $ref: '#/components/schemas/ShareLocationMessageField' ChoiceMessageField: description: Message containing choices/actions. type: object title: Choice properties: choice_message: title: Choice Message type: object required: - choices allOf: - description: A message containing choices. - $ref: '#/components/schemas/Choices' - $ref: '#/components/schemas/TextMessageField' - $ref: '#/components/schemas/ChoiceMessagePropertiesField' CallMessageField: description: Message for triggering a call. type: object title: Call properties: call_message: title: Call Message type: object required: - phone_number - title properties: phone_number: description: Phone number in E.164 with leading +. type: string example: '+15551231234' title: description: 'Title shown close to the phone number. The title is clickable in some cases.' type: string example: Message text MediaProperties: title: Media Properties type: object required: - url properties: thumbnail_url: type: string description: An optional parameter. Will be used where it is natively supported. url: description: Url to the media file. type: string filename_override: description: Overrides the media file name. type: string v2MessageTypes: type: object description: 'Must be one of the following: [text_message, card_message, carousel_message, choice_message, location_message, media_message, template_message, list_message]' oneOf: - $ref: '#/components/schemas/CardMessageField' - $ref: '#/components/schemas/CarouselMessageField' - $ref: '#/components/schemas/ChoiceMessageField' - $ref: '#/components/schemas/LocationMessageField' - $ref: '#/components/schemas/MediaMessageField' - $ref: '#/components/schemas/TemplateMessageField' - $ref: '#/components/schemas/TextMessageField' - $ref: '#/components/schemas/ListMessageField' - $ref: '#/components/schemas/ContactInfoMessageField' v2TemplateTranslation: type: object required: - language_code - message allOf: - $ref: '#/components/schemas/v2MessageCommonProps' - $ref: '#/components/schemas/v2MessageTypes' TemplateReferenceWithVersion: type: object allOf: - required: - version - $ref: '#/components/schemas/TemplateReference' ListItem: type: object title: List Item description: Item containing either choiceItem or ProductItem oneOf: - required: - choice type: object properties: choice: $ref: '#/components/schemas/ChoiceItem' title: Choice - required: - product type: object properties: product: $ref: '#/components/schemas/ProductItem' title: Product TextMessageField: type: object title: Text description: A message containing only text. properties: text_message: type: object title: Text Message required: - text properties: text: description: The text to be sent. type: string ProductItem: type: object title: Product description: A message component for interactive messages, containing a product. required: - id - marketplace properties: id: type: string description: Required parameter. The ID for the product. marketplace: type: string description: Required parameter. The marketplace to which the product belongs. example: FACEBOOK quantity: type: integer format: int32 description: Output only. The quantity of the chosen product. item_price: type: number format: float description: Output only. The price for one unit of the chosen product. currency: type: string description: Output only. The currency of the item_price. CardMessageField: description: Field containing a Card Message type: object title: Card properties: card_message: $ref: '#/components/schemas/CardMessage' Coordinates: type: object title: Geographic coordinates required: - latitude - longitude properties: latitude: description: The latitude. type: number format: float longitude: description: The longitude. type: number format: float CardMessage: description: Message containing text, media and choices. title: Card Message type: object properties: choices: description: You may include choices in your Card Message. The number of choices is limited to 10. type: array items: $ref: '#/components/schemas/Choice' description: description: This is an optional description field that is displayed below the title on the card. type: string height: $ref: '#/components/schemas/CardHeight' title: description: The title of the card message. type: string media_message: type: object description: A message containing a media component. allOf: - $ref: '#/components/schemas/MediaProperties' message_properties: type: object description: Optional additional properties. properties: whatsapp_header: description: Optional. Sets the header for the footer of a WhatsApp reply button message, if there is no media in the message. Ignored for other channels. Ignored if not transcoded to a native WhatsApp message with reply buttons. type: string EmailInfo: type: object title: Email information description: Email addresses of the contact. required: - email_address properties: email_address: description: Email address. type: string type: description: Email address type. e.g. WORK or HOME. type: string v2MessageCommonProps: type: object properties: language_code: description: 'The BCP-47 language code, such as `en-US` or `sr-Latn`. For more information, see https://www.unicode.org/reports/tr35/#Unicode_locale_identifier.' type: - string version: description: The version of the translation. type: - string example: '1' channel_template_overrides: $ref: '#/components/schemas/ChannelTemplateOverridesMap' variables: description: List of expected variables. Can be used for request validation. type: - array items: $ref: '#/components/schemas/typeTemplateVariable' create_time: description: Timestamp when the translation was created. type: - string format: date-time readOnly: true update_time: description: Timestamp of when the translation was updated. type: - string format: date-time readOnly: true MediaMessageField: type: object title: Media Message description: A message containing a media component, such as an image, document, or video. properties: media_message: $ref: '#/components/schemas/MediaProperties' v2ListTranslationsResponse: type: - object properties: translations: type: - array items: $ref: '#/components/schemas/v2TemplateTranslation' protobufAny: type: object properties: type_url: type: string value: type: string format: byte examples: createTemplateV2: summary: Create a Conversation API V2 template. value: description: English text template with one parameter using Conversation API generic format. default_translation: en-US translations: - language_code: en-US version: '1' variables: - key: name preview_value: Mr Jones text_message: text: Hi ${name} channel_template_overrides: WHATSAPP: template_reference: template_id: version: '1' language_code: en-US parameters: body[1]text: defaultValue parameter_mappings: body[1]text: name updateTemplateV2: summary: Updates a Conversation API V2 template. value: id: