Skip to content
QwryAI
Documentation
Pages

Endpoints

List WhatsApp templates

List the approved WhatsApp templates on one of your agent's connected numbers

The list_whatsapp_templates tool reads the message templates Meta has approved for a WhatsApp number connected to your agent, fresh from Meta on every call. It returns each template's name, language, body text and how many {{n}} values it takes, sorted by name. Use a template's name and language when you send it with send_campaign or a WhatsApp automation.

POSThttps://api.qwryai.com/public/v1/tools/list_whatsapp_templates

Authentication

Send your API key as Authorization: Bearer YOUR_API_KEY. The key needs Read agent settings. See Authentication.

Body parameters

NameTypeRequiredDescription
chatbotIdstringYesThe agent's id, from list_agents.
numberstringNoWhich connected number's account to read: the phone number as listed, such as +14155550123, or its id from list_whatsapp_automations or get_outbound. Left out, the agent's first connected number is used.

Request example

Bash
curl -X POST 'https://api.qwryai.com/public/v1/tools/list_whatsapp_templates' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"chatbotId": "YOUR_AGENT_ID"}'

Response

JSON
{
  "success": true,
  "data": {
    "templates": [
      {
        "name": "back_in_stock",
        "language": "en",
        "body": "Good news, {{1}}! {{2}} is back in stock.",
        "category": "MARKETING",
        "parameters": 2
      },
      {
        "name": "order_shipped",
        "language": "en",
        "body": "Hi {{1}}, good news: your order {{2}} is on its way.",
        "category": "UTILITY",
        "parameters": 2
      }
    ]
  }
}
FieldTypeDescription
templates[].namestringThe template's name in WhatsApp Manager.
templates[].languagestringIts language code. A name can exist in several languages; the pair names one template.
templates[].bodystringThe body text, with its {{n}} placeholders.
templates[].categorystringMeta's category, such as UTILITY or MARKETING.
templates[].parametersintegerHow many {{n}} values the body takes.

An empty templates list means the number's account has no approved template QwryAI can fill in. Create templates in WhatsApp Manager; see WhatsApp templates.

Errors

HTTP statuscodeWhen
400INVALID_ARGUMENTSnumber is empty or over 60 characters, or an unknown argument was sent.
400CHATBOT_ID_REQUIREDchatbotId is missing or isn't a valid agent id.
403INSUFFICIENT_PERMISSIONThe key doesn't hold Read agent settings.
404CHATBOT_NOT_FOUNDNo agent with that chatbotId in your workspace.
409VALIDATION_INVALID_BODYThe number isn't connected to this agent, the agent has no connected WhatsApp number, or the number's business account needs connecting again. message says which.
500TOOL_FAILEDMeta couldn't be reached. Try again.

See Error Handling for authentication and rate-limit errors.

Explore the documentation