Mentioning all participants in a WhatsApp group

How to Mention all numbers in a Group when sending a message

Mentioning in messaging apps allows you to specifically notify one or more participants in a group chat by using the "@" symbol followed by their username or phone number. This feature ensures that the mentioned individuals receive a notification, drawing their attention to the message. This is particularly useful in group settings where messages can be numerous, and important updates need to be highlighted for specific members.

The endpoint for sending messages allows you to compose and send messages to individuals or groups. One of the parameters in this endpoint, mentions, is particularly important when you want to notify specific users within a group.

Send text message

For a detailed explanation of the message sending process, please refer to our article on sending messages. Here, we will focus on the mentions parameter.

Mentioning All Participants in a WhatsApp Group

Unlike some messaging platforms, WhatsApp does not support a single command like @all to mention all participants in a group. Instead, each participant must be mentioned individually.

Steps to Mention All Participants:

  1. Compose Your Message: In the message body, include your text and use the @{phone number} format to mention participants. You can even mention your own number.

  2. Use the Mentions Parameter: In the API request, use the mentions parameter to list all phone numbers of the group members. These numbers can be retrieved using a separate endpoint that provides the group participant details.

Example:

To create a message that appears to mention everyone, you can use a visual trick by starting with @all and then listing the actual mentions. Here’s how you can format your request:

curl --request POST \
     --url https://gate.whapi.cloud/messages/text \
     --header 'accept: application/json' \
     --header 'authorization: Bearer iXPwcBczhV4w1SDBsbdvVmpo2bNBBCcs' \
     --header 'content-type: application/json' \
     --data '
{
  "to": "120363282930441732@g.us",
  "body": "@all Here is an important update for everyone in the group. @919984351847",
  "mentions": [
    "12345678901",
    "12345678902",
    "12345678903",
    "12345678904"
  ]
}
'

In this example:

  • @all is used at the beginning of the message for visual effect.

  • The actual phone numbers of all group members are listed in the mentions parameter.

  • The message body includes @919984351847 (replace with your own number or a participant's number) at the end to make it appear as if you have mentioned yourself, maintaining the visual trick.

Without an actual mention of at least one member of the group - it won't work!

It is necessary to mention at least one member of the group (you can even mention yourself)

Fetching Group Members: Use the endpoint to retrieve the group members' phone numbers and then include these numbers in the mentions parameter of your message sending request.

Get list of group members


Need Assistance?

Last updated