WhatsApp

Send WhatsApp Text Message

Sends a free-form WhatsApp text message to a customer with the Cloud API.

Unverified

What the model is told

Send a WhatsApp text message to a customer. This only works within 24 hours of the customer's last message to your business. Outside that window the send fails and you must use the template message tool instead. Returns a message id, which means the message was 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": "text",
  "text": {
    "preview_url": false,
    "body": "{{message}}"
  }
}

Parameters

  • toNumber stringThe customer's WhatsApp number in E.164 format, including the leading plus.
  • message stringThe text of the message.

Engage payload

{
  "source": "VOICE_AI",
  "tool": {
    "id": "24f41385-3cc5-486c-b573-b84bc61ffaea",
    "type": "HTTP_REQUEST",
    "label": "Send WhatsApp Text Message",
    "name": "send_whatsapp_text_message",
    "customName": false,
    "description": "Send a WhatsApp text message to a customer. This only works within 24 hours of the customer's last message to your business. Outside that window the send fails and you must use the template message tool instead. Returns a message id, which means the message was 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": "message",
        "type": "string",
        "description": "The text of the message."
      }
    ],
    "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\": \"text\",\n  \"text\": {\n    \"preview_url\": false,\n    \"body\": \"{{message}}\"\n  }\n}",
      "timeout": null
    }
  }
}

IDs are regenerated on every copy.