Send Transactional WhatsApp Template Message
  • 07 Aug 2023
  • 1 Minute to read

    Send Transactional WhatsApp Template Message


      Article Summary

      Overview

      Transactional WhatsApp API enables you to send targeted transactional WhatsApp messages to your users. You can trigger these WhatsApp messages once a user takes a specific action on your platform.

      Endpoint and Headers

      POST https://whatsapp.useinsider.com/v1/send

      Headers

      HeaderSample ValueDescription
      X-INS-AUTH-KEY1a2b3c4d5e6fThis key is required to authorize your request. Refer to API Authentication Tokens to generate your token.
      Content-Typeapplication/jsonThis header specifies the media type of the resource.

      Body Parameters

      ColumnDescriptionData TypeRequired
      messagesAll messages are contained in the messages key. You can send multiple messages with a single request.ArrayYes
      phoneNumberPhone number for the person you want to send a message to.StringYes
      messageMessage objectObjectYes
      typeMust be a “template” for this message type.StringYes
      nameTemplate name to be sentStringYes
      language
      ObjectYes
      code
      Template languageStringYes
      message variable components
      ArrayYes
          typebodyStringYes
          parameters
      ArrayYes
              typetextStringYes
              textParameter valueStringYes
      button components
      ArrayYes
          typebuttonStringYes
          sub_typeQuick_reply, URL, PHONE_NUMBER
      String Yes
          index    
      StringYes
          parameters
      ArrayYes
              typepayloadStringYes
              payloadPayload valueStringYes

      Sample Example

      Sample Request

      curl --location 'https://whatsapp.useinsider.com/v1/send' \
      --header 'Content-Type: application/json' \
      --header 'x-ins-auth-key: INS.1a2b3c4d5e6f' \
      --data '{
          "messages": [
              {
                  "phoneNumber": "+1**********",
                  "message": {
                      "type": "template",
                      "template": {
                          "name": "{{TEMPLATE_NAME}}",
                          "language": {
                              "code": "{{TEMPLATE_LANGUAGE_CODE}}"
                          },
                          "components": [
                              {
                                  "type": "body",
                                  "parameters": [
                                      {
                                          "type": "text",
                                          "text": "{{PARAMETER_VALUE}}"
                                      }
                                  ]
                              },
                              {
                                  "type": "button",
                                  "sub_type": "quick_reply",
                                  "index": "0",
                                  "parameters": [
                                      {
                                          "type": "payload",
                                          "payload": "1"
                                      }
                                  ]
                              },
                              {
                                  "type": "button",
                                  "sub_type": "quick_reply",
                                  "index": "1",
                                  "parameters": [
                                      {
                                          "type": "payload",
                                          "payload": "2"
                                      }
                                  ]
                              }
                          ]
                      }
                  }
              }
          ]
      }'

      Sample Responses

      One key information will be returned for each message to be sent. This key will be added to all events related to the message.

      {
          "keys": [
              "whatsapp-*************************"
          ]
      }

      401 Unauthorized

      If you use the wrong key, you will see the following error.

      {
          "message": "unauthorized"
      }

      Limitations

      • All functions must be executed with a simple HTTPS POST request.
      • Only new WhatsApp messages can be sent via this API. No data can be retrieved.
      • The API Key should be provided as the authorization key on the request header. If the key is incorrect, the operation will not be executed and an authorization error will return in the response.
      • Transactional API cannot be used for sending bulk/promotional WhatsApp messages. It is designed only to set transactional WhatsApp messages.
      • The rate limit is 10 requests per second.

      Was this article helpful?

      ESC

      Eddy, a super-smart generative AI, opening up ways to have tailored queries and responses