> For the complete documentation index, see [llms.txt](https://heyguest-ai.gitbook.io/heyguest/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://heyguest-ai.gitbook.io/heyguest/reference/messages.md).

# Messages

Send WhatsApp template messages.

## POST /messages/send-template

> Send a WhatsApp template to a contact

```json
{"openapi":"3.0.3","info":{"title":"HeyGuest External API","version":"1.1.0"},"tags":[{"name":"Messages","description":"Send WhatsApp template messages."}],"servers":[{"url":"https://app.heyguest.ai/api/v1","description":"Production"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"Sanctum personal access token (team-scoped)"}},"schemas":{"ResourceError":{"type":"object","properties":{"error":{"type":"string"},"details":{"type":"string"}}},"ValidationError":{"type":"object","properties":{"errors":{"type":"object","description":"Map of field name → array of error messages.","additionalProperties":{"type":"array","items":{"type":"string"}}}}}}},"paths":{"/messages/send-template":{"post":{"tags":["Messages"],"summary":"Send a WhatsApp template to a contact","operationId":"sendTemplate","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["contact_id","channel_id","template_id"],"properties":{"contact_id":{"type":"string","description":"UUID of the contact to send to (must exist in your team)."},"channel_id":{"type":"string","description":"UUID of a WhatsApp channel in your team."},"template_id":{"type":"string","description":"UUID of an approved WhatsApp template under this channel's WABA."},"variables":{"type":"object","description":"Map of template body variables (`{{1}}`, `{{2}}`, …).","additionalProperties":{"type":"string"}},"hidden_variables":{"type":"object","description":"Variables stored against the outbound message but not sent to WhatsApp.","additionalProperties":{"type":"string"}}}}}}},"responses":{"200":{"description":"Template sent.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"message_id":{"type":"integer"},"provider_message_id":{"type":"string"}}}}}},"404":{"description":"Contact, channel, or template not found in your team.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceError"}}}},"422":{"description":"Validation error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationError"}}}},"500":{"description":"Upstream WhatsApp send failed.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}}}}}}}}}}
```
