📢 Channels

Here’s complete information about WhatsApp Channels (aka Newsletter) and how to use them.

Features

Here’s the list of features that are available by 🏭 Engines:

WEBJSNOWEB
Search public channels#440#440
Create Channel
POST /api/{session}/channels
#439✔️
Get channel - by id and invite code
GET /api/{session}/channels/{ChannelID}
✔️✔️
List channels
GET /api/{session}/channels
✔️✔️
Delete channel
DELETE /api/{session}/channels/{ChannelID}
✔️
Get messages
GET /api/{session}/chats/{ChannelID}/messages
✔️✔️
#433
Send messages - Text
POST /api/sendText
✔️✔️
Send messages - Image
POST /api/sendImage
✔️✔️
Send messages - Poll
POST /api/sendPoll
Receive messages - Text
message event
✔️✔️
Receive messages - Image
message event
✔️✔️
Receive messages - Polls✔️
Receive messages - Polls Votes (in my channel)
Receive messages - Reactions (in my channel)
Channels - follow, unfollow
Channels - mute, unmute
Admins - Send Invite
Admins - Revoke Invite
Admins - Accept Invite
Admins - Demote Admin

If you see the feature is not available in the above list, please create a feature request or leave “+1” comment on the existing one.


Endpoints

💡 Channels have a special @newsletter prefix, so you can distinguish them from regular chats and groups.

  • 123123123@newsletter - channel ID

Get all channels

You can get list of known channels

  • Get all (your and subscribed) channels GET /api/{session}/channels
  • Filter channels GET /api/{session}/channels?role=OWNER,
    • role can be OWNER, ADMIN, SUBSCRIBER
[
  {
    "id": "111111111111111111@newsletter",
    "name": "Channel - Owner - Picture",
    "description": "Hi there, I'm new here",
    "invite": "https://whatsapp.com/channel/111111111111111111GdZ60l",
    "preview": "https://mmg.whatsapp.net/m1/v/t24/123",
    "picture": "https://mmg.whatsapp.net/m1/v/t24/123",
    "verified": false,
    "role": "OWNER"
  },
  {
    "id": "111111111111111111@newsletter",
    "name": "Channel - Subscriber - No Picture",
    "description": "",
    "invite": "https://whatsapp.com/channel/111111111111111111111111",
    "preview": null,
    "picture": null,
    "verified": false,
    "role": "SUBSCRIBER"
  }
]

Create a new channel

You can create a new channel POST /api/{session}/channels with the payload:

{
  "name": "Channel Name",
  "description": "Channel Description",
  "picture": {
    "mimetype": "image/jpeg",
    "filename": "filename.jpg",
    "url": "https://github.com/devlikeapro/waha/raw/core/examples/dev.likeapro.jpg"
  }
}

Delete a channel

You can delete a channel DELETE /api/{session}/channels/123123%40newsletter (escape @ to %40). Make sure have OWNER role for the channel.

Get channel by ID

You can get a channel by ID GET /api/{session}/channels/123123%40newsletter (escape @ to %40).

{
  "id": "111111111111111111@newsletter",
  "name": "Channel - Owner - Picture",
  "description": "Hi there, I'm new here",
  "invite": "https://whatsapp.com/channel/111111111111111111GdZ60l",
  "preview": "https://mmg.whatsapp.net/m1/v/t24/123",
  "picture": "https://mmg.whatsapp.net/m1/v/t24/123",
  "verified": false,
  "role": "OWNER"
}

Get channel by Invite Code

You can get a channel by Invite Code GET /api/{session}/channels/{inviteCode}

  • inviteCode here is the last part in invite URL https://whatsapp.com/channel/111111111111111111GdZ60l - 111111111111111111GdZ60l

💡 To get full picture you need to get channel by ID after you get the invite code.

{
  "id": "111111111111111111@newsletter",
  "name": "Channel - Owner - Picture",
  "description": "Hi there, I'm new here",
  "invite": "https://whatsapp.com/channel/111111111111111111GdZ60l",
  "preview": "https://mmg.whatsapp.net/m1/v/t24/123",
  "picture": "https://mmg.whatsapp.net/m1/v/t24/123",
  "verified": false,
  "role": "OWNER"
}

How-to

Send Text to the channel

You can use regular POST /api/sendText endpoint to send a text message into the channel

👉 Make sure you’re OWNER or ADMIN for the channel

{
  "session": "default",
  "chatId": "12132132130@newsletter",
  "text": "Hi there!"
}

Send Image to the channel

You can use regular POST /api/sendImage endpoint to send an image into the channel

{
  "session": "default",
  "chatId": "11111111111@newsletter",
  "file": {
    "mimetype": "image/jpeg",
    "url": "https://github.com/devlikeapro/waha/raw/core/examples/dev.likeapro.jpg",
    "filename": "filename.jpeg"
  },
  "caption": "string"
}

Send Video to the channel

You can use regular POST /api/sendVideo endpoint to send a video message into the channel

{
  "chatId": "111111111111111111@newsletter",
  "file": {
    "mimetype": "video/mp4",
    "filename": "video.mp4",
    "url": "https://github.com/devlikeapro/waha/raw/core/examples/video.mp4"
  },
  "caption": "Just watch at this!",
  "session": "default"
}

Get messages from the channel

You can use regular GET /api/{session}/chats/{chatId}/messages to fetch messages from the channel

GET /api/default/chats/123%40newsletter/messages?downloadMedia=true&limit=100
[
  {
    "id": "true_111111111111111111@newsletter_1111111111111111111111",
    "timestamp": 1720775833,
    "from": "111111111111111111@newsletter",
    "fromMe": true,
    "body": "Caption",
    "hasMedia": true,
    "media": {
      "mimetype": "image/jpeg",
      "filename": null,
      "url": "http://localhost:3000/api/files/1111111111111111111111.jpeg",
      "error": null // if there was an error during file download
    },
    "mediaUrl": "http://localhost:3000/api/files/1111111111111111111111.jpeg",
    "ack": 0,
    "ackName": "PENDING",
    "_data": {
      ...
    }
  }
]

Receive messages from the channel

For all incoming messages in your own and subscribed channels you’ll receive

  • message event for a message from the channel (send by someone else)
  • message.any event for a message from the channel (including your messages)
{
    "event": "message",
    "session": "default",
    "me": {
        "id": "111111111111@c.us",
        "pushName": "Slovakia WAHA"
    },
    "payload": {
        "id": "false_123123@newsletter_11111111111111111111111111111111",
        "timestamp": 1720776511,
        "from": "111111111111111111@newsletter",
        "fromMe": false,
        "body": "How are you all?! ❤️",
        "hasMedia": false,
        "ack": null,
        "ackName": "UNKNOWN",
        "_data": {
          ...
        }
    },
    "engine": "NOWEB",
    "environment": {
        "version": "2024.7.4",
        "engine": "NOWEB",
        "tier": "PLUS",
        "browser": "/usr/bin/google-chrome-stable"
    }
}