POST
/api/send-messageSends a message to a specific WhatsApp channel using its Channel ID.
Send Message to a WhatsApp Channel
To send a message to a WhatsApp Channel, follow these steps:
-
First, listen for the
message.upsertevent. This event will include the channel's unique ID (e.g.,123456789@newsletter) in thejidfield. -
Once you have the channel ID, use it in the
tofield when sending a message through your usual send endpoint. -
The message parameters are the same as those for regular messages. Just ensure the
tofield is set to the channel's ID.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| to | string | Yes | Channel ID (e.g., '123456789@newsletter') . |
| text | string | Yes | The text content of the message. Required if no media/contact/location is sent. |
| imageUrl | string | No | URL of the image to send. |
| videoUrl | string | No | URL of the video to send. |
| documentUrl | string | No | URL of the document to send. |
| audioUrl | string | No | URL of the audio file to send (sent as voice note). |
| stickerUrl | string | No | URL of the sticker (.webp) to send. |
| contact | object | No | Contact card object. |
| location | object | No | Location object. |
Code Examples
curl -X POST "https://www.wasenderapi.com/api/send-message"
-H "Authorization: Bearer YOUR_API_KEY"
-H "Content-Type: application/json"
-d '{
"to": "123456789@newsletter",
"text": "Hello everyone in the channel!"
}'Response Examples
{
"success": true,
"data": {
"msgId": 100000,
"jid": "+123456789",
"status": "in_progress"
}
}