WhatsApp

Whatsapp template

Send an approved WhatsApp Business template message to one or more recipients. Identify the template with event, and supply its variables per recipient by section: HEADER, BODY and BUTTONS.

sender is the WhatsApp Business number the template is sent from; it defaults to the stream's sender. A variable the template declares but you leave out is sent as a blank space, so the message still goes out — check your variables.

Response. HTTP 200 with a task_id and one entry per message. status is false when any message failed: failed entries come first and carry error (hex code) and details; accepted entries carry message_uuid (and conversation_uuid on two-way channels). Match entries by internal_id. Final delivery status is sent asynchronously to your configured webhook.

Authentication: stream token in the Authorization header (see Authentication in the API Overview).

post/whatsapp/template

Request

  • Base URL
    https://api.commpeak.com/textpeak/streams
  • URL
    https://api.commpeak.com/textpeak/streams/whatsapp/template
  • Auth
    API key in header Authorization

Request body

senderstring nullable

WhatsApp Business sender phone number. Defaults to the stream's sender.

eventstring nullable

The approved WhatsApp template, by its eventKey on the stream. Required unless every recipient sets event.

Example request

{
  "event": "order_confirmation",
  "recipients": [
    {
      "internal_id": "1001",
      "recipient_phone": "12125551235",
      "template_variables": {
        "BODY": {
          "1": "John",
          "2": "4821"
        },
        "HEADER": {
          "1": "John"
        }
      }
    }
  ],
  "sender": "12125551234"
}

Response

Successful Response

statusboolean required

true when every message was accepted; false when at least one failed. The HTTP status is 200 either way.

task_idstring required

Identifier of this request.

Example response

{
  "messages": [
    {
      "conversation_uuid": "e2a489db-bb8a-4f51-9692-726153599c57",
      "internal_id": "1001",
      "message_uuid": "a61e5bfe-c82b-448a-815b-32de8bf22089"
    }
  ],
  "status": true,
  "task_id": "ca550f7e-9eb5-45b3-9830-e82b407ede02"
}

Changes

No recorded changes to this operation across all 1 revision of this API.