Skip to main content

Proactive Messaging API

What is proactive messaging?​

Proactive messaging allows enterprises to reach out preemptively to customers, ensuring higher satisfaction and loyalty. Typical use cases include appointment reminders, delivery confirmations, shipping updates, order tracking, etc. With our convenient and secure RESTful API, enterprises can send proactive messages to their customers.

Hootsdesk's Proactive Messaging API allows you to:

  • Send messages in real-time to your customers for supported media, including message templates on WhatsApp.
  • Follow up on the status of sent messages.
  • Retrieve detailed information about reasons for failures.

Supported media​

You can use Inbox 2.0 to send proactive messages on:

  • WhatsApp

Rate limit​

The Proactive Messaging API is rate-limited to 60 messages per minute per organization. Enterprises exceeding these limits receive an error and must re-send any failed messages.

Metadata​

When sending a proactive message, you can pass along custom information that is stored in Inbox 2.0. This data can then be exported. Please contact dev.support@hootsuite.com to add metadata to the Messages export. For example, when you send an appointment confirmation to your customer, you can pass along a unique identifier. You can then download the Messages export from Inbox 2.0, and determine how many unique customers are responding to your outbound notification.

Example code:

{
"contact": "+32123456789",
"text": "This is a message with metadata",
"medium": "WHATSAPP",
"channel": "Inbox 2.0 WA Channel",
"metadata": {
"customerID": "ABC123",
"Source": "IVR"
}
}

REST API​

When calling the Proactive Messaging API, the client needs to be authenticated.

The Set up an Org App guide contains more details on how to authenticate your client.

Examples​

  1. Send a proactive text message

The following example shows a proactive outbound message that can be sent as a text message. Inbox 2.0 supports text messaging on WhatsApp Enterprises are responsible for ensuring that the customers have opted-in for proactive communications.

Request

curl -X POST https://platform.hootsuite.com/inbox/v1/proactive-messaging/ \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-d '{ "medium": "WHATSAPP", "channel": "myChannel", "contact": "+32495123456", "text": "Hello world!" }'

Response 200

{
"correlationId": "3a7c6c1d-9f9b-11e8-b23b-6f13d5844b66"
}
  1. Send a proactive message template (WhatsApp)

WhatsApp allows for proactive outbound communication when these are sent as message templates that have been authorized by WhatsApp. These templates have a name, corresponding text, and substitution parameters within the text to make them personalized. Inbox 2.0 has simplified how enterprises can send out these message templates through the use of shorthand codes for inline syntax:

&((namespace=[[NAMESPACE]] template=[[TEMPLATE NAME]] fallback=[[FALLBACK TEXT]] language=[[LANGUAGE]] body_text=[[VARIABLE1]] body_text=[[VARIABLE2]]))&
Parameter nameParameter descriptionRequired
namespaceUnique code provided by WhatsApp while defining message templates.true
templateName of the template provided on WhatsApp Manager.true
fallbackWe recommend setting the same value as the Template name here.true
languageThe language in which the messages should be sent. The language needs to be defined in the WhatsApp Manager.true
body_textThe variable text. 0, 1, or multiple variables in a message. Per variable, there needs to be a body_text parameter.true

The language codes can be found on: <https://developers.facebook.com/docs/whatsapp/message-templates/creation>

Enterprises construct the messages in shorthand and send it in the text field as shown in the following code.

Request

curl -X POST https://platform.hootsuite.com/inbox/v1/proactive-messaging/ \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-d '{ "medium": "WHATSAPP", "channel": "myChannel", "contact": "+32495123456", "text": "&((namespace=[[3c860f8b_1ae3_1105_b9ea_647e69aa2d49]] template=[[welcome_customer]] fallback=[[welcome_customer]] language=[[en]] body_text=[[Gregory]] body_text=[[How can I help you?]]))&" }'

Response 200

{
"correlationId": "3a7c6c1d-9f9b-11e8-b23b-6f13d5844b66"
}
  1. Get status overview

Request

curl -X GET https://platform.hootsuite.com/inbox/v1/proactive-messaging/3a7c6c1d-9f9b-11e8-b23b-6f13d5844b66 \
-H 'Authorization: Bearer '

Response 200

{
"correlationId": "3a7c6c1d-9f9b-11e8-b23b-6f13d5844b66",
"total": 1,
"statuses": {
"SENT": 1
}
}
  1. Get status details

Request

curl -X GET https://platform.hootsuite.com/inbox/v1/proactive-messaging/f988bd0f-9f9d-11e8-b23b-7d351b0c7ce9/FAILED \
-H 'Authorization: Bearer '

Response 200

[
{
"status": "FAILED",
"contact": "+32495123456",
"reason": "No channel found for medium TWIT"
}
]