Templates V2

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).

List all templates belonging to a project ID.

SecurityBasic or oAuth2
Request
path Parameters
project_id
required
string

Required. The project ID.

Responses
200

A successful response.

Response Schema: application/json
Array of objects (v2TemplateResponse)
Array
id
string

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.

description
string

The description of the template.

version
integer

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.

default_translation
string

The default translation to use if translation not specified. Specified as a BCP-47 language_code and the language_code must exist in the translations list.

Array of Text (object) or Card (object) or Carousel (object) or Choice (object) or Location (object) or Media (object) or Template Message (object) or List (object) (v2TemplateTranslationResponse)
create_time
string <date-time>

Timestamp when the template was created.

update_time
string <date-time>

Timestamp when the template was updated.

default

An unexpected error response.

get/v2/projects/{project_id}/templates
Request samples
Response samples
application/json
{
  • "templates": [
    • {
      }
    ]
}

Creates a template

SecurityBasic or oAuth2
Request
path Parameters
project_id
required
string

Required. The project ID.

Request Body schema: application/json
required

Required. The template to create.

default_translation
required
string

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.

required
Array of Text (object) or Card (object) or Carousel (object) or Choice (object) or Location (object) or Media (object) or Template Message (object) or List (object) (v2TemplateTranslation)
description
string

The description of the template.

version
integer

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.

create_time
string <date-time>

Timestamp when the template was created.

update_time
string <date-time>

Timestamp when the template was updated.

Responses
200

A successful response.

Response Schema: application/json
id
string

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.

description
string

The description of the template.

version
integer

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.

default_translation
string

The default translation to use if translation not specified. Specified as a BCP-47 language_code and the language_code must exist in the translations list.

Array of Text (object) or Card (object) or Carousel (object) or Choice (object) or Location (object) or Media (object) or Template Message (object) or List (object) (v2TemplateTranslationResponse)
create_time
string <date-time>

Timestamp when the template was created.

update_time
string <date-time>

Timestamp when the template was updated.

default

An unexpected error response.

post/v2/projects/{project_id}/templates
Request samples
application/json
{
  • "description": "English text template with one parameter using Conversation API generic format.",
  • "default_translation": "en-US",
  • "translations": [
    • {
      }
    ]
}
Response samples
application/json
{
  • "id": "id_string",
  • "description": "Template description",
  • "version": 1,
  • "default_translation": "en-US",
  • "translations": [
    • {
      }
    ],
  • "create_time": "2019-08-24T14:15:22Z",
  • "update_time": "2019-08-24T14:15:22Z"
}

List translations for a template

SecurityBasic or oAuth2
Request
path Parameters
project_id
required
string

Required. The project ID.

template_id
required
string

Required. The ID of the template to fetch.

query Parameters
language_code
string

Optional. The translation's language code.

translation_version
string

Optional. The translation's version.

Responses
200

A successful response.

Response Schema: application/json
Array of Text (object) or Card (object) or Carousel (object) or Choice (object) or Location (object) or Media (object) or Template Message (object) or List (object) (v2TemplateTranslationResponse)
Array
One of:

A message containing only text.

object (Text Message)
language_code
string

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.

version
string

The version of the translation.

object (channelTemplateOverride)

Optional field to override the omnichannel template by referring to a channel-specific template.

Array of objects (typeTemplateVariable)

List of expected variables. Can be used for request validation.

create_time
string <date-time>

Timestamp when the translation was created.

update_time
string <date-time>

Timestamp of when the translation was updated.

default

An unexpected error response.

get/v2/projects/{project_id}/templates/{template_id}/translations
Request samples
Response samples
application/json
{
  • "translations": [
    • {
      }
    ]
}

Updates a template.

SecurityBasic or oAuth2
Request
path Parameters
project_id
required
string

Required. The project ID.

template.id
required
string

The id of the template to be updated. Specified or automatically generated during template creation. Unique per project.

Request Body schema: application/json
required

Required. The updated template.

version
required
integer

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.

description
string

The description of the template.

default_translation
string

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.

Array of Text (object) or Card (object) or Carousel (object) or Choice (object) or Location (object) or Media (object) or Template Message (object) or List (object) (v2TemplateTranslation)
create_time
string <date-time>

Timestamp when the template was created.

update_time
string <date-time>

Timestamp when the template was updated.

Responses
200

A successful response.

Response Schema: application/json
id
string

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.

description
string

The description of the template.

version
integer

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.

default_translation
string

The default translation to use if translation not specified. Specified as a BCP-47 language_code and the language_code must exist in the translations list.

Array of Text (object) or Card (object) or Carousel (object) or Choice (object) or Location (object) or Media (object) or Template Message (object) or List (object) (v2TemplateTranslationResponse)
create_time
string <date-time>

Timestamp when the template was created.

update_time
string <date-time>

Timestamp when the template was updated.

default

An unexpected error response.

put/v2/projects/{project_id}/templates/{template.id}
Request samples
application/json
{
  • "id": "<template id>",
  • "description": "English text template with one parameter using Conversation API generic format.",
  • "version": 1,
  • "default_translation": "en-US",
  • "translations": [
    • {
      }
    ]
}
Response samples
application/json
{
  • "id": "id_string",
  • "description": "Template description",
  • "version": 1,
  • "default_translation": "en-US",
  • "translations": [
    • {
      }
    ],
  • "create_time": "2019-08-24T14:15:22Z",
  • "update_time": "2019-08-24T14:15:22Z"
}

Get a template

SecurityBasic or oAuth2
Request
path Parameters
project_id
required
string

Required. The project ID.

template_id
required
string

Required. The ID of the template to fetch.

Responses
200

A successful response.

Response Schema: application/json
id
string

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.

description
string

The description of the template.

version
integer

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.

default_translation
string

The default translation to use if translation not specified. Specified as a BCP-47 language_code and the language_code must exist in the translations list.

Array of Text (object) or Card (object) or Carousel (object) or Choice (object) or Location (object) or Media (object) or Template Message (object) or List (object) (v2TemplateTranslationResponse)
create_time
string <date-time>

Timestamp when the template was created.

update_time
string <date-time>

Timestamp when the template was updated.

default

An unexpected error response.

get/v2/projects/{project_id}/templates/{template_id}
Request samples
Response samples
application/json
{
  • "id": "id_string",
  • "description": "Template description",
  • "version": 1,
  • "default_translation": "en-US",
  • "translations": [
    • {
      }
    ],
  • "create_time": "2019-08-24T14:15:22Z",
  • "update_time": "2019-08-24T14:15:22Z"
}

Delete a template.

SecurityBasic or oAuth2
Request
path Parameters
project_id
required
string

Required. The project ID.

template_id
required
string

Required. The ID of the template to delete.

Responses
200

A successful response.

Response Schema: application/json
any
default

An unexpected error response.

delete/v2/projects/{project_id}/templates/{template_id}
Request samples
Response samples
application/json
null