Send a customer statement (template with PDF)
Send a WhatsApp template that has a DOCUMENT header, attaching a per-recipient PDF by URL.
| channel | string |
| to | object |
| template_id | string |
| template_variables | object |
| document | object |
- The template must be approved with a DOCUMENT header; templates without one reject the
documentparameter withdocument_not_applicable. document.urlmust be an https:// URL that WhatsApp can fetch without credentials at send time. It is fetched once, when the message is sent, and never afterwards. A short-lived pre-signed URL (S3, GCS, Supabase storage; a few minutes of TTL is ample) satisfies this and is the recommended pattern for anything confidential: payslips, statements, invoices. The file never has to be durably public.filenameis what the recipient sees (max 240 characters).- Or send a PDF uploaded with POST /api/v1/documents by its id:
document: { id }, with an optionalfilenameto show instead of the uploaded one. It is sent only to the contact it was uploaded for: another contact's document, or one sent to a contactto.createwould create, is refused with 400 validation_failed,details.reason: "document_not_for_contact", and an id this workspace does not hold answers 404 not_found,document_not_found. Passidorurl, never both. - Omitting
documenton a DOCUMENT-header template returnsdocument_required. - Authorize WhatsApp sends with either
messages:sendor the least-privilegewhatsapp:sendscope.
curl -X POST "https://app.blueticked.com/api/v1/messages" \
-H "Authorization: Bearer $BLUETICKED_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: change-me-per-request-0001" \
-d '{
"channel": "whatsapp",
"to": {
"phone": "+27800000001"
},
"template_id": "1f2f3f4f-0000-4000-9000-abcdef123456",
"template_variables": {
"1": "Sam",
"2": "May 2026"
},
"document": {
"url": "https://files.example.com/statements/acct-1001.pdf",
"filename": "Statement May 2026.pdf"
}
}'{
"message_id": "763c4dc3-d46b-4c10-8bd4-3f233a933ea0",
"conversation_message_id": "5592edf6-d7ae-4198-962e-3e8ebe83bb49",
"conversation_id": "fa3efd47-67b2-428c-b75f-17d1dd2e9790",
"status": "queued",
"contact_id": "ff506e53-e2f0-4d92-884a-dab77d628bad",
"contact_created": false,
"request_id": "req_b2e3d610e10f1b07468721ee98f0e1d2"
}