Skip to content

Send WhatsApp

This endpoint is used to send (outbound) WhatsApp messages using a predefined message template leveraging the Infobip services implemented for AfriForum.

Reference - Infobip WhatsApp outbound messages

Method and endpoint

POST /v1/send-whatsapp-template

Headers

Header name Header value
Authorization Basic base64(username:password)
Content-type application-json

WhatsApp Numbers

To send a WhatsApp message, you need a valid WhatsApp number (used in the "from" field indicated above). Currently, AfriForum has 4 registered WhatsApp Numbesr, see below:

Organisation Number
AfriForum 27872406903
AfriForum Teater 27872406481

Templates

Each outbound WhatsApp message needs a pre-defined (and approved) WhatsApp message template (see here). Some sample templates on InfoBip are defined below. Please engage with AfriForum Ledesake if you require new templates to be created.

  1. teater_bestelling_test

  2. teater_kaartjies_test

Delivery reports

In order to receive real-time delivery reports for every WhatsApp Template message sent, a consumer may include a callback endpoint/URL within the "callbackData" field. See the "Sample request message" below for an example of this.

Delivery status reports will be proxied to this defined endpoint for the client to leverage as required.

Body

Request schema

{
  "messages": [
    {
      "from": "string",
      "to": "string",
      "messageId": "string",
      "content": {
        "templateName": "string",
        "templateData": {
          "body": {
            "placeholders": [
              "string"
            ]
          },
          "header": {
            "type": "TEXT",
            "mediaUrl": "string",
            "filename": "string"
          }
        },
        "language": "string"
      },
      "callbackData": "string",
      "notifyUrl": "string",
      "urlOptions": {
        "shortenUrl": true,
        "trackClicks": true,
        "trackingUrl": "string",
        "removeProtocol": true,
        "customDomain": "string"
      }
    }
  ]
}

Sample request

{
  "messages": [
    {
      "from": "27872406903",
      "to": "27836608539",
      "messageId": "eab70cf2-0fca-43dd-baa7-0a621f0ec095",
      "content": {
        "templateName": "teater_bestelling_test",
        "templateData": {
          "body": {
            "placeholders": ["1", "2", "3"]
          }
        },
        "language": "af"
      },
      "callbackData": "https://replyto.url.co.za/delivery-status",
    }
  ]
}

Sample response

{
  "messages": [
    {
      "to": "27836608539",
      "messageCount": 1,
      "messageId": "eab70cf2-0fca-43dd-baa7-0a621f0ec095",
      "status": {
        "groupId": 1,
        "groupName": "PENDING",
        "id": 7,
        "name": "PENDING_ENROUTE",
        "description": "Message sent to next instance",
        "action": null
      }
    }
  ],
  "bulkId": null
}