Templates

Outbound messages can be personalized by inserting content into a template, such as the recipient's name or specific details. These placeholders are replaced with actual data when the message is sent.

Once you understand how the structure works and before creating a new template you have to be sure about which templates are already set in your bot. You can check it first by choosing Get Templates. Subsequently, you can create a new one by using the Create Template subsection.

Remember "Templates" are the skeleton of your message and they are approved or rejected by the WhatsApp crew, so it is essential to follow the guidelines to create a proper layout.

Get Templates

GET https://api.jelou.ai/v1/bots/:botId/templates

Returns all templates for your bot.

Path Parameters

Query Parameters

{
  "pagination": {
    "limit": 50,
    "total": 1,
    "offset": 0,
    "totalPages": 1
  },
  "results": [
    {
      "id": 39,
      "template": "¡Hola! Somos *Jelou*. Te damos la bienvenida.",
      "displayName": "Bienvenida Jelou",
      "elementName": "bienvenida_jelou",
      "companyId": 5,
      "botId": "<botId>",
      "paramsNumber": 0,
      "params": [],
      "createdAt": "2020-03-12T22:35:05.000Z",
      "updatedAt": "2020-03-12T22:35:05.000Z",
      "isVisible": true,
      "type": "HSM",
      "language": "ES",
      "shouldAssign": true,
      "teamId": null
    }
  ],
  "links": [
    {
      "number": 1,
      "url": "/v1/bots/+593963219808001/templates?page=1&limit=50"
    }
  ]
}

Create Template

POST https://api.jelou.ai/v1/bots/:botId/templates

Create an Outbound Template.

Here are the visual instructions:

  • Here, you will see all the templates available for your bot. You can switch between bots to view their respective templates and statuses.

Create a New Template

  • Enter a name for your template, e.g., "Test Template."

  • Choose the language for the template (Spanish, English, or Portuguese).

  • Select the bot to which the template will be assigned.

Configure the Message Content

  • Choose the type of content: document, image, text, or video. Here, we'll create a text template.

  • Configure the header, main content (mandatory field), number of parameters, and footer. For example, add a sample text for the footer.

  • Decide if the template will have buttons. You can choose between flow buttons (kept within WhatsApp) or external buttons (leading to external actions).

Path Parameters to create content for the outbound message

Query Parameters

Request Body

{
  "message": [
    "Template has been created."
  ],
  "status": "success",
  "data": {
    "template": "¡Hola! Somos *Jelou*. \nTe damos la bienvenida _{{1}}_. Pronto {{2}} del equipo de desarrollo se comunicará contigo.",
    "displayName": "Bienvenida Desarrollo",
    "elementName": "test_hsm_api",
    "params": [
      {
        "label": "Nombre del cliente",
        "param": "1"
      },
      {
        "label": "Nombre del desarrollador",
        "param": "2"
      }
    ],
    "paramsNumber": 2,
    "isVisible": false,
    "language": "ES",
    "createdAt": "2021-01-28T15:08:38.492Z",
    "updatedAt": "2021-01-28T15:08:38.492Z",
    "botId": "<botId>",
    "companyId": 5,
    "status": "APPROVED"
  }
}

The status field defines whether or not your template was approved by Whatsapp.

Language

The supported language by WhatsApp is detailed on the official page, please check it carefully on the following link.

Content Restrictions (Authentication category)

Meta has restricted the content for the authentication category, the content will be according to the language of the template. Meta is restricted to one parameter.

Params Structure

Use the following structure in the params field when creating a template:

[
    {
        "label": "Nombre del cliente",
        "param": "1"
    },
    {
        "label": "Nombre del desarrollador",
        "param": "2"
    }
]

Button Structure

Define Button Types (if applicable)

  • Flow buttons trigger specific WhatsApp flows. You can configure up to three buttons.

  • External buttons can either link to a specific URL or redirect to a contact. These buttons lead to actions outside WhatsApp.

Use the following structure in the buttonsfield when the interactive actions are CALL_TO_ACTION ,QUICK_REPLY or OTP

1. QUICK_REPLY

It is used to get quick replies so a user can give a reply when a message shows up by pushing a button easily. It is an array of objects and it can have a maximum of 3 buttons. Each object has two fields.

[
  {
    "text": "Más información",
    "type": "QUICK_REPLY"
  },
  {
    "text": "Hablar con operador",
    "type": "QUICK_REPLY"
  },
  {
    "text": "Ventas",
    "type": "QUICK_REPLY"
  }
]

2. CALL_TO_ACTION

It is used to offer a call-to-action so a user can take an action based on their shown options. It is an array of objects. It can have a maximum of 2 buttons and a maximum of 1 button of each type.

[
  {
    "text": "Ventas",
    "phone_number": "+5939123456789",
    "type": "PHONE_NUMBER"
  },
  {
    "type": "URL",
    "text": "Jelou Apps",
    "url": "https://apps.jelou.ai/{{1}}",
    "example": "https://apps.jelou.ai/bots"
  }
]

3. OTP

It is used to get a "One Time Password". It is an array of objects. It can have a maximum of 1 button.

[
  {
    "text": "COPY CODE",
    "type": "OTP"
  }
]

Assign Additional Settings

  • Optionally, assign a team and specify if the template will be available for use from the multi-agent panel.

  • Select the message category (Utility, Marketing, or Authentication). This helps WhatsApp understand the type of session the message will generate.

  • Enable the checkbox to allow WhatsApp to automatically update the category if it's detected to be incorrect, thus preventing rejection.

extraSettings Structure

Sample API request

1. Text

curl --request POST \
  --url 'https://api.jelou.ai/v1/bots/BOT_ID/templates?sendToAprove=true' \
  --header 'Authorization: Basic dXNlcjpwYXNzd29yZA==' \
  --header 'content-type: application/json' \
  --data '{
	"displayName": "template text utility",
	"template": "Thank you for your order, {{1}}! Your confirmation number is {{2}}. If you have any questions, please contact support. Thank you for being a customer!",
	"example": "Thank you for your order, Omar! Your confirmation number is 71936. If you have any questions, please contact support. Thank you for being a customer!",
	"elementName": "template_text_utility",
	"params": [
		{
			"param": "1",
			"label": "client",
			"example": "Omar"
		},
		{
			"param": "2",
			"label": "order",
			"example": "71936"
		}
	],
	"paramsNumber": "2",
	"type": "HSM",
	"language": "es",
	"category": "UTILITY",
	"interactiveAction": "NONE"
}'

2. Text with quick reply buttons

curl --request POST \
  --url 'https://api.jelou.ai/v1/bots/BOT_ID/templates?sendToAprove=true' \
  --header 'Authorization: Basic dXNlcjpwYXNzd29yZA==' \
  --header 'content-type: application/json' \
  --data '{
	"displayName": "template quick reply",
	"template": "Thank you for your order, {{1}}! Your confirmation number is {{2}}. If you have any questions, please use the buttons below to contact support. Thank you for being a customer!",
	"example": "Thank you for your order, Omar! Your confirmation number is 57893. If you have any questions, please use the buttons below to contact support. Thank you for being a customer!",
	"elementName": "template_quick_reply",
	"params": [
		{
			"param": "1",
			"label": "client",
			"example": "Omar"
		},
		{
			"param": "2",
			"label": "order",
			"example": "57893"
		}
	],
	"paramsNumber": "2",
	"type": "HSM",
	"language": "en",
	"category": "UTILITY",
	"interactiveAction": "QUICK_REPLY",
	"buttons": [
		{
			"text": "Contact Support",
			"type": "QUICK_REPLY"
		},
		{
			"text": "Contact Sales",
			"type": "QUICK_REPLY"
		}
	]
}'

3. Text with call-to-action buttons

curl --request POST \
  --url 'https://api.jelou.ai/v1/bots/BOT_ID/templates?sendToAprove=true' \
  --header 'Authorization: Basic dXNlcjpwYXNzd29yZA==' \
  --header 'content-type: application/json' \
  --data '{
	"displayName": "template_call_action",
	"template": "Thank you for your order, {{1}}! Your confirmation number is {{2}}. If you have any questions, please use the buttons below to contact support. Thank you for being a customer!",
	"example": "Thank you for your order, Omar! Your confirmation number is 67996. If you have any questions, please use the buttons below to contact support. Thank you for being a customer!",
	"elementName": "template_call_action",
	"params": [
		{
			"param": "1",
			"label": "client",
			"example": "Omar"
		},
		{
			"param": "2",
			"label": "order",
			"example": "67996"
		}
	],
	"paramsNumber": "2",
	"type": "HSM",
	"language": "en",
	"category": "UTILITY",
	"interactiveAction": "CALL_TO_ACTION",
	"buttons": [
		{
			"text": "Contact Support",
			"type": "URL",
			"url": "https://apps.jelou.ai",
			"example": "https://apps.jelou.ai"
		},
		{
			"text": "Call",
			"type": "PHONE_NUMBER",
			"phone_number": "+15552051314"
		}
	]
}'

4. Image

curl --request POST \
  --url 'https://api.jelou.ai/v1/bots/BOT_ID/templates?sendToAprove=true' \
  --header 'Authorization: Basic dXNlcjpwYXNzd29yZA==' \
  --header 'content-type: application/json' \
  --data '{
	"displayName": "template_sample_image",
	"template": "Hi {{1}}. We invite you to be part of Jelou Pocket. Visit us https://apps.jelou.ai",
	"example": "Hi Omar. We invite you to be part of Jelou Pocket. Visit us https://apps.jelou.ai",
	"elementName": "template_sample_image",
	"params": [
		{
			"param": "1",
			"label": "client",
			"example": "Omar"
		}
	],
	"paramsNumber": "1",
	"type": "IMAGE",
	"language": "en",
	"category": "MARKETING",
	"mediaUrl": "https://s3.us-west-2.amazonaws.com/cdn.devlabs.tech/images%2Fjeloupocket.jpeg",
	"interactiveAction": "NONE"
}'

5. Document

curl --request POST \
  --url 'https://api.jelou.ai/v1/bots/BOT_ID/templates?sendToAprove=true' \
  --header 'Authorization: Basic dXNlcjpwYXNzd29yZA==' \
  --header 'content-type: application/json' \
  --data '{
	"displayName": "test_document_",
	"template": "Hi {{1}}. We invite you to be part of Jelou Pocket. Visit us https://apps.jelou.ai",
	"example": "Hi Omar. We invite you to be part of Jelou Pocket. Visit us https://apps.jelou.ai",
	"elementName": "test_document_",
	"params": [
		{
			"param": "1",
			"label": "client",
			"example": "Omar"
		}
	],
	"paramsNumber": "1",
	"type": "DOCUMENT",
	"language": "en",
	"category": "MARKETING",
	"mediaUrl": "https://s3.us-west-2.amazonaws.com/cdn.devlabs.tech/images%2FdocuementTest.pdf",
	"interactiveAction": "NONE"
}'

6. Video

curl --request POST \
  --url 'https://api.jelou.ai/v1/bots/BOT_ID/templates?sendToAprove=true' \
  --header 'Authorization: Basic dXNlcjpwYXNzd29yZA==' \
  --header 'content-type: application/json' \
  --data '{
	"displayName": "test_video_1",
	"template": "Hi {{1}}. We invite you to be part of Jelou Pocket. Visit us https://apps.jelou.ai",
	"example": "Hi Omar. We invite you to be part of Jelou Pocket. Visit us https://apps.jelou.ai",
	"elementName": "test_video_1",
	"params": [
		{
			"param": "1",
			"label": "client",
			"example": "Omar"
		}
	],
	"paramsNumber": "1",
	"type": "VIDEO",
	"language": "en",
	"category": "MARKETING",
	"mediaUrl": "https://s3.us-west-2.amazonaws.com/cdn.devlabs.tech/images%2FvideoTest.mp4",
	"interactiveAction": "NONE"
}'

Finalize and Submit the Template

  • Review your template. Note that WhatsApp may take up to 48 hours to approve a template.

  • If everything is correct, click "Confirm and Create." Otherwise, go back to edit any section.

  • On the right side of the interface, you will see a preview of how the template will appear to end users.

Confirmation Message

  • Once confirmed, a message will indicate that the template has been successfully created.

  • The approval process by WhatsApp can take up to 48 hours.

Insert Image: Confirmation message showing that the template has been created and is pending WhatsApp approval.

Last updated