Sending messages

To send messages it is necessary to call:

 POST https://api.wazzup24.com/v3/message

In the message body you should pass the parameters of the message with the authorization data in the header.

Request Parameters

Parameter Type Description
channelId String Id of the channel (uuidv4) through which to send the message
chatType String Channel Type. Available values:

INSTAGRAM: ‘instagram’,

TELEGRAM: ‘telegram’,

Telegram group chat: ‘telegroup’,

WHATSAPP: ‘whatsapp’,

WhatsApp group chat: ‘whatsgroup’

chatId String Chat Id (contact’s account in messenger):

  1. for whatsapp — only numbers, without spaces and special characters in the format 79011112233
  2. for instagram — an account without “@” in the beginning
  3. for WhatsApp group chat (‘whatsgroup’) — comes in webhooks of incoming messages
text String Message text. Obligatory if contentUri is not specified. Both text and contentUri cannot be sent at the same time.Both text and contentUri cannot be sent at the same time. For WhatsApp up to 10 000 characters, For Instagram up to 1000 characters
contentUri String A link to the file to send. Required if text is not specified. The content must be downloaded via a link without redirects. An attempt to download content will be made as soon as the request is received, i.e. short-lived links can be made. There may be restrictions on the type and size of content, specific to each messenger. Both text and contentUri cannot be transmitted at the same time.
refMessageId String Id of the message to cite. Optional parameter
crmUserId String CRM user id specified with CRUD users. Not required. If specified, and if such a user already exists, we will save his id and name as when sending via iframe
crmMessageId String Message identifier on the CRM side. Needed to make the routing idempotent. Not required.
username String Optional. For Telegram only.
The username of the Telegram contact, with no “@” at the beginning. Can be used when sending messages via Telegram if chatId is not known
phone String Optional. For Telegram only.
Contact’s phone number in international format, without “+” and other symbols, only numbers, with the correct country code. Can be used when sending messages via Telegram if the chatId is not known

Root is not idempotent! Repeated requests with the same content will result in sending several identical messages. To protect against possible duplicate messages, you can add the crmMessageId property unique to the message. If it was sent, then if another request with the same crmMessageId is received, the message will not be sent, the error 400 Bad Request, { error: ‘repeatedCrmMessageId’, description: ‘You have already sent message with the same crmMessageId’ } will be returned.

Important: In order to send WABA templates in the “text” field you must pass the “template code”, which you can obtain from support. If there are variables in the template, you should replace them with the necessary values at the moment of sending. You can read more about how to add a template and examples of how to use it in the article.

Request example

 curl --location --request POST 'https://api.wazzup24.com/v3/message' \

--header 'Authorization: Bearer c8cf90444023482f909520d454368d27' \

--header 'Content-Type: application/json' \

--data-raw '{

"channelId": "3376e1c3-26a6-478b-b964-72bf01cc22cb",

"chatType": "whatsapp",

"chatId": "79998887766",

"contentUri": "https://example.com/images/img_01.png"

}

'

Response

Parameter Type Description
messageId String Message identifier

Specified only when code=OK

Response example

HTTP/1.1 201 OK

 HTTP/1.1 200 OK

{

"messageId": "e0629e11-0f67-4567-92a9-2237e91ec1b9"

}

Errors when sending messages

Error code Description
MESSAGE_WRONG_CONTENT_TYPE Invalid content type. Appears if the content type could not be detected or is not supported.
MESSAGE_ONLY_TEXT_OR_CONTENT The message can contain text or content. You can’t send text and content to WhatsApp and Instagram at the same time.
MESSAGE_NOTHING_TO_SEND No message text was found.
MESSAGE_TEXT_TOO_LONG The length of the text message exceeds 10,000 characters.
MESSAGE_CONTENT_CAN_NOT_BE_BLANK A file with content cannot be empty.

Occurs when sending a non-text message to which no content has been attached.

MESSAGE_CONTENT_SIZE_EXCEEDED Content exceeds the allowable size of 10 MB.
MESSAGE_TEXT_CAN_NOT_BE_BLANK The text message cannot be empty.
CHANNEL_NOT_FOUND The channel through which the message is sent is not found in the integration.
CHANNEL_BLOCKED The channel through which the message is sent is off.
MESSAGE_DOWNLOAD_CONTENT_ERROR Failed to download content from the specified link.
MESSAGES_NOT_TEXT_FIRST On the “Start” tariff, you cannot write first.
MESSAGES_IS_SPAM Wazzup rated this message as spam.
CHAT_WRONG_CHAT_TYPE Invalid chat type.

Occurs if you send an outgoing message to a messenger not included in the [INSTAGRAM, WHATSAPP, VK, TELEGRAM] list.

CHAT_MISSING_CHAT_TYPE chatType is not transmitted.

Select the chat type from the [INSTAGRAM, WHATSAPP, VK, TELEGRAM] list.

CHAT_INCORRECT_CHAT_ID_WHATSAPP Incorrect WhatsApp number.

Phone number must be in international format: contain from 9 to 16 digits, for Russian numbers start with 7.

CHAT_MISSING_CHAT_ID chatId is not transmitted.
VALIDATION_ERROR Validation error of the parameter passed to the query.
ACCOUNT_NOT_FOUND Account not found in integration.
CONTACT_NOT_FOUND The contact is not found among the account’s contacts — there is no chat with this phone number.
CHANNEL_NO_MONEY The channel is not paid and has the status of “Not Paid”.
MESSAGE_CHANNEL_UNAVAILABLE The channel from which the message is sent is not available.

The channel has the status “Phone Unavailable” or “Wait a Minute”.

CONTACT_DETAIL_NOT_FOUND No contact information.
MESSAGES_ABNORMAL_SEND The chat type does not match the source of the contact.

For example, this error can occur if you try to send a message from the WhatsApp channel to the Instagram channel.

MESSAGES_INVALID_CONTACT_TYPE The chat type does not match the Instagram contact source.

For example, this error can occur if you are trying to send a message from an Instagram channel to a WhatsApp channel.

MESSAGES_CAN_NOT_ADD The message has not been sent. An unexpected server error occurred.
REFERENCE_MESSAGE_NOT_FOUND An error occurs when quoting if the message to which the quote is attached cannot be found.

Check that the message identifier received from Wazzup is passed as the refId.

UNKNOWN_ERROR Unknown error.

Contact support.