Creating your first Whatsapp Message Template

Step-by-step process of creating a Whatsapp Message Template using the Touchpoints API.

WhatsApp approved

Before starting this guide make sure you have API Access and you are using the necessary Access Policies and Roles on your Access Key.

Step 1: Create a project

To create a project, follow these steps:

  1. Make a POST request to the /workspaces/{workspaceId}/projects endpoint.

  2. Provide the necessary request body parameters, such as the project name, description, and type.

Message Templates are referred to as channel templates through the API. In this case, we need to set the project type to"channelTemplate"

{
  "type": "channelTemplate",
  "name": "Test channelTemplate",
  "description": "My first project"
}

Upon successful creation, you will receive a response with the details of the newly created project, including the project ID.

Step 2: Add a Channel Template

Once you have created a project, you can add a channel template to it. Follow these steps:

  1. Make a POST request to the /workspaces/{workspaceId}/projects/{projectId}/channel-templates endpoint.

  2. Pass the project ID and other required parameters in the request.

Request Payload

{
	"defaultLocale": "en",
	"genericContent": [],
	"platformContent": [
		{
			"platform": "whatsapp",
			"locale": "en",
			"blocks": [
				{
					"type": "text",
					"role": "body",
					"text": {
						"text": "Hey there!"
					},
					"id": "cbA0XdmkFDAbJiGfS41kK9"
				},
				{
					"type": "text",
					"role": "footer",
					"text": {
						"text": "Reply STOP to unsubscribe."
					},
					"id": "lA0CtTqaNO2zFz9p_Uoxo7"
				}
			],
			"type": "text",
			"channelGroupIds": [
				"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
			]
		}
	],
	"supportedPlatforms": [
		"whatsapp"
	],
	"deployments": [
		{
			"key": "whatsappTemplateName",
			"platform": "whatsapp",
			"value": "test"
		},
		{
			"key": "whatsappCategory",
			"platform": "whatsapp",
			"value": "MARKETING"
		},
		{
			"key": "whatsappAllowCategoryChange",
			"platform": "whatsapp",
			"value": "false"
		}
	]
}

Default Locale

This locale will be used as a fallback if the locale specified for content is not supported.

Generic Content

This content only applies to omnichannel templates, so no need to set it in this case.

Platform Content

This is the content that is specific to a platform, in this case, we are adding content for Whatsapp. In the Blocks Documentation section, there is more info on the type of blocks you can add as content. Here is important to specify your channelGroupIds array with the corresponding ID. For more information about channel groups visit the Channels API reference.

SupportedPlatforms

Platforms where this template can be used. Since this message is just meant to be used in Whatsapp, we will just include this platform.

Deployments

Information about the template used by Whatsapp on deployment. You can read more about Whatsapp templates here.

If successful, you will receive a response containing the details of the newly created channel template, including its ID. The template will have a status of Draft.


{
    "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "projectId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "defaultLocale": "en",
    "status": "draft"
    ...

Step 3: Activate the template

After creating the WhatsApp Message Template, you need to activate it to make it available for use. Follow these steps:

  1. Make a PUT request to the /workspaces/{workspaceId}/projects/{projectId}/channel-templates/{channelTemplateId}/activate endpoint.

  2. Pass the workspace ID, project ID, and channel template ID in the request URL.

  3. Send the request.

"status": "pending"

Please note that the exact details and procedures of the WhatsApp approval process may vary, and it's recommended to refer to WhatsApp's official documentation. If the approval is successful the message template will be marked as active and will be ready to use.

Step 4: Checking the status

If for any reason the previous message template is rejected by Whatsapp you will see its status as inactive. In the body of the response you can find the reason for rejection:

"approvals": [
                {
                    "approvalReference": "42xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx285",
                    "channelId": null,
                    "status": "rejected",
                    "platformStatus": "whatsapp_rejected",
                    "reason": "SCAM",
                    "reasonCode": "whatsapp_scam",
                    "platformReference": "710xxxxxxxxxx30",
                    "channelGroupId": "f9xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxfa9",
                    "platformAccountIdentifier": "10xxxxxxxxxxxxx"
                }
            ]

Last updated