Skip to content

WhatsApp Customize API

Send up to 100 messages in one request. from and campaignName are shared. Each object in custom is its own message and can use a different type and recipient.

Text, image, video, document, audio, and interactive messages are session messages. WhatsApp delivers them only inside an open 24-hour customer-care window. Template messages do not need that window.

Endpoint

https://api.azmarq.com/v1/whatsapp/customize

Headers

  • Name
    Content-Type
    Type
    string
    Description

    application/json

  • Name
    apikey
    Type
    string
    Description

    Dashboard API key. See Authentication.


Customize Send

One request reserves wallet balance for the whole batch, then queues each message. If any item is invalid, nothing is sent. The error includes the item index, for example custom[1]: Invalid Template Name.

Required attributes

  • Name
    from
    Type
    string
    Description

    The WhatsApp business number the message is sent from. Prefix the country code. Example: +91XXXXXXXXXX

  • Name
    custom
    Type
    array
    Description

    1 to 100 messages. Each item needs to and type.

  • Name
    to
    Type
    string
    Description

    Recipient MSISDN for that item. Separate multiple numbers for the same message with a comma.

  • Name
    type
    Type
    string
    Description

    One of template, text, image, video, document, audio, or interactive.

Optional attributes

  • Name
    campaignName
    Type
    string
    Description

    One campaign name for the whole request. It is not accepted inside custom. If omitted, the campaign name is whatsapp-api.

  • Name
    templateName
    Type
    string
    Description

    Required when type is template. Must match an approved template on the account.

  • Name
    language
    Type
    object
    Description

    Template language, for example { "code": "en" }. If omitted, the template’s stored language is used.

  • Name
    components
    Type
    object
    Description

    Template variables. body.params fills {{1}}, {{2}}, and so on, in order.

  • Name
    text
    Type
    object
    Description

    Required when type is text. text.body is the message, up to 4096 characters.

  • Name
    image
    Type
    object
    Description

    Required when type is image. Provide link or id. caption is optional.

  • Name
    video
    Type
    object
    Description

    Required when type is video. Provide link or id. caption is optional.

  • Name
    document
    Type
    object
    Description

    Required when type is document. Provide link or id. caption is optional.

  • Name
    audio
    Type
    object
    Description

    Required when type is audio. Provide link or id.

  • Name
    interactive
    Type
    object
    Description

    Required when type is interactive. Use the same interactive object as the Conversation API, including type, body, and action.

  • Name
    otp
    Type
    string
    Description

    Required for authentication templates. Maximum 15 characters.

  • Name
    country
    Type
    string
    Description

    Set to india to prefix a 10-digit to number with +91.

Request

curl --location --request POST 'https://api.azmarq.com/v1/whatsapp/customize' \
--header 'Content-Type: application/json' \
--header 'apikey: YOUR_API_KEY' \
--data-raw '{
  "from": "+91XXXXXXXXXX",
  "campaignName": "api-test",
  "custom": [
    {
      "to": "+91XXXXXXXXXX",
      "type": "text",
      "text": {
        "body": "Your order has been shipped."
      }
    },
    {
      "to": "+91XXXXXXXXXX",
      "type": "image",
      "image": {
        "link": "https://example.com/image.jpg",
        "caption": "Image message"
      }
    },
    {
      "to": "+91XXXXXXXXXX",
      "type": "video",
      "video": {
        "link": "https://example.com/video.mp4",
        "caption": "Video message"
      }
    },
    {
      "to": "+91XXXXXXXXXX",
      "type": "document",
      "document": {
        "link": "https://example.com/file.pdf",
        "caption": "Document message"
      }
    },
    {
      "to": "+91XXXXXXXXXX",
      "type": "audio",
      "audio": {
        "link": "https://example.com/audio.ogg"
      }
    },
    {
      "to": "+91XXXXXXXXXX",
      "type": "interactive",
      "interactive": {
        "type": "button",
        "body": {
          "text": "Pick one."
        },
        "action": {
          "buttons": [
            {
              "type": "reply",
              "reply": {
                "id": "yes",
                "title": "Yes"
              }
            },
            {
              "type": "reply",
              "reply": {
                "id": "no",
                "title": "No"
              }
            }
          ]
        }
      }
    },
    {
      "to": "+91XXXXXXXXXX",
      "type": "template",
      "templateName": "template_name",
      "language": {
        "code": "en"
      },
      "components": {
        "body": {
          "params": [
            "Rahul",
            "ORD-1042"
          ]
        }
      }
    }
  ]
}'

Response

{
  "id": "batch-uuid",
  "message": "Message Sent Successfully!",
  "error": null,
  "totalCount": 7,
  "data": [
    {
      "index": 0,
      "to": "+91XXXXXXXXXX",
      "type": "text",
      "templateName": "",
      "messageId": "uuid-1",
      "totalCount": 1,
      "data": [
        { "recipient": "91XXXXXXXXXX", "messageId": "uuid-1:1" }
      ]
    }
  ]
}

Was this page helpful?