WhatsApp#

WhatsApp Message Sending#

The following WhatsApp messages are supported:

  • text only;

  • image only.

Note

It is not allowed to send two types of content at the same time (for example, a text and an image).

Request Examples#

To generate a test request with your parameters, please Внешняя ссылка open the request generator.

 1{
 2   "login":"YOUR_LOGIN",
 3   "password":"YOUR_PASSWORD",
 4   "useTimeDiff":false,
 5   "id":"8770100",
 6   "scheduleInfo":
 7   {
 8       "timeBegin":"10:00",
 9       "timeEnd":"20:00",
10       "weekdaysSchedule":"12345"
11   },
12   "destAddr":"Subscriber's_Number",
13   "message":
14   {
15       "type":"WHATSAPP",
16       "data":
17       {
18           "instantContent":
19           {
20               "type":"TEXT",
21               "data":
22               {
23               "text":"hatsApp message text"
24               }
25           },
26           "serviceNumber":"SENDER'S_NAME",
27           "ttl":1440
28       }
29   }
30}

Request Parameters#

Parameter

Required

Data type

Description

login

yes

string

Partner’s name.

password

yes

string

Partner’s password for sending messages.

useTimeDiff

no

boolean

Taking into account the time zone when starting messaging.

More details

If true, the message is sent to the subscriber according to the messaging schedule and his time zone.

If false, the message is sent according to the messaging initiator schedule UTC+3 regardless of the message recipient time zone.

Default value: false.

shortenLinks

no

boolean

Parameter controls the automatic shortening of long links in a message.

More details

Possible values are:

  • true — to shorten links (by default);
  • false — shortening link is not required.

If the service is available to the Partner, the URL strings will be shorted by default if the parameter is not received in the request.

The ability to use this service is pre-negotiated and configured by the Service Provider.

For more details: Link Shortening Service.

id

no

string

Partner-side unique ID.

More details

This parameter is required to control re-sending and duplication (the control service is enabled separately). The Partner may recall the Service Provider (the request to send a message) with the same ID several times.

In this case the message will be sent to the subscriber only once (upon the first request). In response to requests, the Service Provider will return the same message ID in the Service Provider's system to the Partner (the same as for the first request). The Service Provider optionally returns this ID to the Partner, if available in the message delivery report.

scheduleInfo

no

object

Messaging schedule.

More details

If not specified, it is sent immediately upon receipt of the request.

scheduleInfo/
timeBegin

no

string

Start time.

More details

Example: 10:00.

scheduleInfo/
timeEnd

no

string

End time.

More details

Example: 21:00.

scheduleInfo/
weekdaysSchedule

no

string

Messaging days.

More details

Specified by numbers from 1 (Monday) to 7 (Sunday), for example, 12345.

If there are no restrictions on days of the week, this parameter can be empty or not delivered in the request.

scheduleInfo/
deadline

no

string

End date of the messaging.

More details

Example: 2024-05-10T16:29:30+0300.

destAddr

yes

string

Subscriber’s phone number.

More details

It contains the country code, operator code and phone number.

For the Russian Federation, the code can be 8, 7 or +7.

Examples: 72101234567, +72101234567, 8-210-123-45-67, 82101234567.

message

yes

object

Parameters of a message being sent.

message/type

yes

enum

Message type.

More details

The value of WHATSAPP is transmitted.

message/data/
instantContent

yes

object

Parameters of the WhatsApp message being sent (images, buttons).

instantContent/
type

yes

enum

Type of a message parameter.

More details

Possible values are:

  • TEXT (to transmit text only);
  • IMAGE_URL (image only).
instantContent/
data

yes

object

Parameters of the data being sent.

More details

Possible values are:

  • text (message text);
  • imageURL (URL of the image).
instantContent/
data/text

yes

string

Message text.

More details

Maximum length: 1000 characters.

instantContent/
data/imageURL

yes

string

URL of an image to be transmitted.

More details

400x400px image with JPG or PNG extension is recommended to be used.

message/data/
serviceNumber

no

string

Sender’s name from which the message is being sent.

message/data/ttl

no

integer

WhatsApp message lifetime.

More details

Possible values in minutes are: 1440, 2880, 4320, 5760, 7200, 8640, 10080.

Note

When ttl = 0 or the parameter is absent in the request, the value from the default settings is used, which is set during the integration setup separately for each client.

message/data/
ttlUnit

no

enum

Unit of measurement of the message delivery period.

More details

It is transmitted only with ttl.

Possible values are: SECONDS; MINUTES (by default); HOURS.

extraParam

no

string

Additional parameters passed as param1=value1,param2=value2, where param1 and param2 – parameter names, value1 and value2 – values.

More details

The comma character cannot be included in the parameter name, but it can be included in its value — in this case it must be doubled. Example: the string place=abzakovo,name=guest house-2,coordinates=53.8085896,, 58.6362112,from=23.02.09,to=05.03.09.

registeredDelivery

no

integer

Requirement of delivery reports.

More details

Possible values are:

  • 0 — statuses are not required;
  • 1 — statuses are required (by default);
  • 2 — only "Undelivered" status is required.

notifyUrl

no

string

Hostname of the incoming API to receive the delivery report.

More details

This parameter is optional in the request, but if sent, you should consider the following: if the parameter is specified, it cannot be empty.

The notifyUrl string must be no more than 2048 characters long.

If any of the specified conditions are not met, an error will be generated and the request will not be executed.

cascadeChainLink

no

object

Cascading message parameters.

More details

See Cascading Message Sending.

Response to the Request#

After sending a message the Service Provider returns a response synchronously. In case of successful sending Service Provider returns HTTP-code 200 OK.

Successful Sending#

1 {
2   "mtNum": "107930572",
3   "id": "8770599"
4 }

Sending Errors#

For results with errors, a response HTTP code will differ from 200 (see Error Codes).

1 {
2     "error": {
3         "code": 4,
4         "description": "Invalid request"
5     },
6     "extendedDescription": "Message is too long (2024 symbols). WHATSAPP message max length is 1000 symbols."
7 }

Error Codes#

Code

Description

HTTP-code

1

Service is unavailable

503

2

Invalid IP-address

403

3

Too many connections

429

4

Invalid request

400

5

Invalid login

401

6

Invalid password

401

7

serviceNumber is not defined

400

8

destAddr is not correct

406

9

Message type is not correct

406

10

Prohibited sending duplicates

409

11

Invalid TTL

406

100

100

500

WhatsApp Messages Delivery Statuses#

To receive WhatsApp message statuses, you need to set up the Delivery Status Service.

Delivery Error Codes#

Delivery error codes for each message type are provided in the corresponding tab of the Description of Error Codes (parameter status=5) section.