How an AI agent sends a customer a template, photo, or video
To have your AI agent send a customer a photo, video, or file, include the template_ids field with AnyLinga template IDs in the response to callback_url. You can specify up to 5 IDs; the reply_text field is optional.
How attachments are sent
A template contains text and attachments you saved in AnyLinga in advance. Your agent selects the templates, and AnyLinga sends them to the customer.
Get a list of templates
1. Request available templates
- Send
GET /api/connect/templateswith the sameAuthorization: Bearer <Callback token>header. - The response includes the fields
id,name,category,provider,body, andattachmentsfor each template. WhatsApp Business API templates also include ametaobject. - Select the templates you need and use their
idvalues to send them.
Include templates in the agent's response
2. Add template_ids to the response
- Include the
template_idsarray in the response tocallback_url, with up to 5 template IDs. - Add
reply_textif you need to send separate text before the templates. If not, you can omit this field.
{
"correlation_id": "b1e7d0c4-2f3a-4e8b-9c6d-7a5f1e2d3c4b",
"reply_text": "Here is our catalog and a video about delivery.",
"template_ids": ["7d1f0c2a-4b3e-4a9d-8c61-2e5f9b0a7d34"]
}
AnyLinga returns a templates list with the result for each template: ok, parts_sent, or an error code. If there was no text and no templates were sent, the response is 502.
You can also pass templates to /api/connect/send when the agent messages the customer first.
Sending order and restrictions
The translated reply_text is sent first, followed by the templates in order. Template text and attachments are sent as separate messages. Videos are sent as videos.
Template text is not translated: the customer receives it exactly as written in the template.
Only published templates can be used. WhatsApp Business API templates must be approved by Meta. Otherwise, AnyLinga returns 404 with that template's template_id.
Templates are validated before the response is counted as accepted. If an ID is incorrect, fix it and submit the response again with the same correlation_id.
Related questions
Quick reply templates · WhatsApp templates · How an agent can message a customer first
Get in touch
We reply during business hours.
New to AnyLinga?
Try it yourself, or we'll set it up for you when you pay for the first month.