WhatsApp Template
WhatsApp templates are required when sending to a user more than 24 hours after their last message. Use action create_template first (phone_number, message); if it returns template_id, then use action send_template (template_id, phone_number, original_message) to deliver the message. If create_template returns template_required: false, the conversation is within the 24h window - use sendWhatsApp instead.
Input Schema
| Parameter | Type | Description |
|---|---|---|
| action | string | create_template: check 24h window and create or find template, returns template_id when needed. send_template: send a message using an existing template_id. Enum: create_template, send_template |
| phone_number | string | Recipient phone in international format (required for both actions) |
| message | string | Message content (required for create_template; used as template body) |
| template_id | string | Template SID from create_template result (required for send_template) |
| conversation_id | string | Conversation UUID for 24h window check (optional for create_template) |
| from | string | Sender name (optional) |
| original_message | string | Original message text for logging (optional for send_template) |
REST Endpoint
POST /api/agents/tools/whatsapp-templatesSend a JSON body with the same parameters as the MCP input schema. The site_id field is required when calling via REST.
Step 1 — Create template:
POST /api/agents/tools/whatsapp-templates
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
{
"action": "create_template",
"phone_number": "+1234567890",
"message": "Hi! Following up on your inquiry.",
"conversation_id": "CONVERSATION_UUID",
"site_id": "YOUR_SITE_ID"
}Response when outside the 24h window:
{
"success": true,
"template_id": "HXabc123...",
"template_required": true
}Response when inside the 24h window:
{
"success": true,
"template_required": false
}Step 2 — Send template (only when template_required: true):
POST /api/agents/tools/whatsapp-templates
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
{
"action": "send_template",
"phone_number": "+1234567890",
"template_id": "HXabc123...",
"site_id": "YOUR_SITE_ID"
}Last updated on