WhatsApp

Send WhatsApp Template Message

Sends an approved WhatsApp template message, which can start a conversation.

Unverified

What the model is told

Send an approved WhatsApp template message to a customer, for example an order update. Use this when the customer has not messaged in the last 24 hours. Only use template names that exist and are approved. Returns a message id, which means accepted, not delivered. Only send to the number or address the customer gave you in this conversation, and read it back to confirm it, together with the message wording, before calling this tool.

Request

POSThttps://graph.facebook.com/v27.0/YOUR_WHATSAPP_PHONE_NUMBER_ID/messages

Headers

  • Content-Typeapplication/json
  • AuthorizationBearer YOUR_WHATSAPP_ACCESS_TOKEN

Body

{
  "messaging_product": "whatsapp",
  "recipient_type": "individual",
  "to": "{{toNumber}}",
  "type": "template",
  "template": {
    "name": "{{templateName}}",
    "language": {
      "code": "{{languageCode}}"
    },
    "components": [
      {
        "type": "body",
        "parameters": [
          {
            "type": "text",
            "text": "{{bodyValue}}"
          }
        ]
      }
    ]
  }
}

Parameters

  • toNumber stringThe customer's WhatsApp number in E.164 format, including the leading plus.
  • templateName stringThe name of an approved template.
  • languageCode stringThe language code the template was approved in.
  • bodyValue stringThe value for the first variable in the template body.

Engage payload

{
  "source": "VOICE_AI",
  "tool": {
    "id": "1130e811-2b16-4a4a-9cb3-112788359dcf",
    "type": "HTTP_REQUEST",
    "label": "Send WhatsApp Template Message",
    "name": "send_whatsapp_template_message",
    "customName": false,
    "description": "Send an approved WhatsApp template message to a customer, for example an order update. Use this when the customer has not messaged in the last 24 hours. Only use template names that exist and are approved. Returns a message id, which means accepted, not delivered. Only send to the number or address the customer gave you in this conversation, and read it back to confirm it, together with the message wording, before calling this tool.",
    "parameters": [
      {
        "name": "toNumber",
        "type": "string",
        "description": "The customer's WhatsApp number in E.164 format, including the leading plus."
      },
      {
        "name": "templateName",
        "type": "string",
        "description": "The name of an approved template."
      },
      {
        "name": "languageCode",
        "type": "string",
        "description": "The language code the template was approved in."
      },
      {
        "name": "bodyValue",
        "type": "string",
        "description": "The value for the first variable in the template body."
      }
    ],
    "config": {
      "endpoint": {
        "method": "POST",
        "url": "https://graph.facebook.com/v27.0/YOUR_WHATSAPP_PHONE_NUMBER_ID/messages"
      },
      "headers": [
        {
          "name": "Content-Type",
          "value": "application/json"
        },
        {
          "name": "Authorization",
          "value": "Bearer YOUR_WHATSAPP_ACCESS_TOKEN"
        }
      ],
      "body": "{\n  \"messaging_product\": \"whatsapp\",\n  \"recipient_type\": \"individual\",\n  \"to\": \"{{toNumber}}\",\n  \"type\": \"template\",\n  \"template\": {\n    \"name\": \"{{templateName}}\",\n    \"language\": {\n      \"code\": \"{{languageCode}}\"\n    },\n    \"components\": [\n      {\n        \"type\": \"body\",\n        \"parameters\": [\n          {\n            \"type\": \"text\",\n            \"text\": \"{{bodyValue}}\"\n          }\n        ]\n      }\n    ]\n  }\n}",
      "timeout": null
    }
  }
}

IDs are regenerated on every copy.