WhatsApp API

Send WhatsApp messages to users via API

createWhatsAppMessage

Used to send WhatsApp messages to users

POST https://api.pushwoosh.com/json/1.3/createWhatsAppMessage

Request Body

ParameterRequiredTypeDescription

auth*

Yes

string

API access token from Pushwoosh Control Panel.

application*

Yes

string

Pushwoosh application code.

notifications*

Yes

array

Content settings. JSON array of message parameters. See details below.

Notification parameters

ParameterRequiredTypeDescription

send_date*

Yes

string

Date and time to send the notification. Use format YYYY-MM-DD HH:mm or 'now' to send immediately.

content

Required if content_id is not provided

string

Text content of the WhatsApp message.

content_id

Required if content is not provided.

string

Identifier of a pre-approved WhatsApp template from your Meta account.

devices*

Yes

array

Customer phone number (must be associated with a UserId using /registerDevice and specified in the hwid parameter, or use use_auto_registration). Only one number can be specified here.

use_auto_registration

No

boolean

If set to true, the phone number specified in the devices parameter will be automatically registered.

content_variables

No

object

Content variables to customize the message content. Each placeholder will be replaced with corresponding dynamic values.

Request example

{

 "request": {
   "application": "12345-67891", // required. Pushwoosh application code
   "auth": "yxoPUlwqm…………pIyEX4H", // required. API access token from Pushwoosh Control Panel
   "notifications": [{
     // Content settings
     "send_date": "now", // required. YYYY-MM-DD HH:mm OR 'now'.
     "content": "Hello! {{1}}", // Required if content_id is not provided. Message text.
     "content_id": "hello_world", // Required if content is not provided. WhatsApp template identifier.
     "content_variables": {"1": "John"}, // Content variables to customize the message content.
     "devices":["whatsapp:+1234567890"], // required. Customer WhatsApp phone number (must be associated with a UserId using /registerDevice and specified in the "hwid" parameter or use use_auto_registration). Only one WhatsApp number can be specified here
     "use_auto_registration": true, // optional. Automatically register WhatsApp number specified in ‘devices’ parameter
   }]
 }
}

Response example

{
   "status_code": 200,
   "status_message": "OK",
   "response": {
       "Messages": [
           "9648-0B10ECB6-0D9F214D"
       ]
   }
}

Error response

{
   "status_code": 210,
   "status_message": "Invalid devices list. \"devices\" must be an array.",
   "response": {
       "Messages": []
   }
}

Currently, each WhatsApp message must be sent in a separate request for each customer.

2. To get WhatsApp statistics, use the totalsByIntervals method.

Last updated