Messaging API

Send Template Messages

5 minutes integration Skill: intermediate

Send Template Messages

WhatsApp requires businesses to initiate customer communication (outside a rolling 24-hour service window) using pre-approved Meta Message Templates. Templates can include dynamic variables to merge personalized user parameters dynamically.

Endpoint

POST /v1/messages

Payload Parameters

ParameterTypeRequiredDescription
tostringYesDestination mobile number (country code prefix).
typestringYesMust be set to template.
templateobjectYesTemplate configuration block.
template.namestringYesThe exact name of your pre-approved template in Meta's Business Manager (e.g. order_confirmation).
template.languageobjectYesLanguage setting.
template.language.codestringYesThe language code (e.g. en, es, hi) corresponding to the pre-approved template.
template.componentsarrayNoList of dynamic template component parameters.
template.components[i].typestringYesMust match component section: header, body, or button.
template.components[i].parametersarrayYesThe dynamic merge variables matching the template placeholders (represented sequentially in template code as {{1}}, {{2}}).

Related Doc Resources

Integration Playground
# Send dynamic business template
curl -X POST "https://api.aisoule.com/v1/messages" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "918856879188",
    "type": "template",
    "template": {
      "name": "order_confirmation",
      "language": {
        "code": "en"
      },
      "components": [
        {
          "type": "body",
          "parameters": [
            { "type": "text", "text": "Priya Sharma" },
            { "type": "text", "text": "#2891" }
          ]
        }
      ]
    }
  }'
Replace `YOUR_API_KEY` in the headers with your real dashboard secrets token!