Hootsuite Proactive Messaging Rest API
When calling the Proactive Messaging API, the client needs to be authenticated. The [REST API authentication](#tag/rest-api-authentication) section 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 ```shell curl -X POST https://platform.hootsuite.com/inbox/v1/proactive-messaging/ \ -H 'Authorization: Bearer ' \ -H 'Content-Type: application/json' \ -d '{ "medium": "WHATSAPP", "channel": "myChannel", "contact": "+32495123456", "text": "Hello world!" }' ``` Response `200` ```json { "correlationId": "3a7c6c1d-9f9b-11e8-b23b-6f13d5844b66" } ``` 2. 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: ```text &((namespace=[[NAMESPACE]] template=[[TEMPLATE NAME]] fallback=[[FALLBACK TEXT]] language=[[LANGUAGE]] body_text=[[VARIABLE1]] body_text=[[VARIABLE2]]))& ``` | Parameter name | Parameter description | Required | |----------------|----------------------------------------------------------------------------------------------------------------------------|-----------| | namespace | Unique code provided by WhatsApp while defining message templates. | true | | template | Name of the template provided on WhatsApp Manager. | true | | fallback | We recommend setting the same value as the Template name here. | true | | language | The language in which the messages should be sent. The language needs to be defined in the WhatsApp Manager. | true | | body_text | The 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: Enterprises construct the messages in shorthand and send it in the text field as shown in the following code. Request ```shell curl -X POST https://platform.hootsuite.com/inbox/v1/proactive-messaging/ \ -H 'Authorization: Bearer ' \ -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` ```json { "correlationId": "3a7c6c1d-9f9b-11e8-b23b-6f13d5844b66" } ``` 3. Get status overview Request ```shell curl -X GET https://platform.hootsuite.com/inbox/v1/proactive-messaging/3a7c6c1d-9f9b-11e8-b23b-6f13d5844b66 \ -H 'Authorization: Bearer ' ``` Response `200` ```json { "correlationId": "3a7c6c1d-9f9b-11e8-b23b-6f13d5844b66", "total": 1, "statuses": { "SENT": 1 } } ``` 4. Get status details Request ```shell curl -X GET https://platform.hootsuite.com/inbox/v1/proactive-messaging/f988bd0f-9f9d-11e8-b23b-7d351b0c7ce9/FAILED \ -H 'Authorization: Bearer ' ``` Response 200 ```json [ { "status": "FAILED", "contact": "+32495123456", "reason": "No channel found for medium TWIT" } ] ```