Add or Remove WhatsApp Group Participants via API
Hey everyone! Managing WhatsApp groups can feel like trying to keep frogs in a wheelbarrow. But what if you could streamline the process using a simple tool? Enter Wassenger, your new go-to for taming the chaos of WhatsApp group management through its powerful API.
In this post, we’re diving deep into how Wassenger makes it super easy to add or remove participants, update group info, and even shuffle roles within the group — yes, promoting and demoting participants is just a click away! Whether you’re looking to maintain order in large community groups or streamline communication in project teams, we’ve got the insights you need. So, let’s get started and show you how to master the art of group management on WhatsApp like a pro.
This tutorial teaches you how to manage WhatsApp group participants using the Wassenger API.
🤩 🤖 Wassenger is a complete API solution for WhatsApp. Sign up for a 7-day free trial and get started in minutes!
Requirements
- Have a WhatsApp number already linked to the platform and online.
- Get your number unique ID given in Wassenger from here.
- Group WhatsApp ID (WID) that you can find in two ways:
How to obtain the Group WhatsApp ID
You can obtain the Group WhatsApp ID by using one of these methods:
- Web: go to number’s settings > Groups > Copy the Group WID.
- API: query the available groups in your number using this endpoint.
API endpoint
We will use the following API endpoint to manage the group participants:
Add participants
Prepare the request
Target API URL using the POST method to add participants
https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants
Required HTTPS headers > Obtain your API key here
Content-Type: application/json
Token: $API_TOKEN
Use body in JSON format
{
"participants": [
{
"phone": "+12345678900",
"admin": true
},
{
"phone": "+12345678901",
"admin": false
}
]
}
Congrats! You can now add participants to groups on WhatsApp using the API.
Promote or demote participants
Prepare the request
Target API URL using the PATCH method to manage participants
https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants
Required HTTPS headers > Obtain your API key here
Content-Type: application/json
Token: $API_TOKEN
Use body in JSON format
{
"participants": [
{
"phone": "+1234567890",
"admin": true
},
{
"phone": "+1234567890",
"admin": true
}
]
}
Remove participants
Prepare the request
Target API URL using the DELETE method to remove participants
https://api.wassenger.com/v1/devices/{deviceId}/groups/{groupId}/participants
Required HTTPS headers > Obtain your API key here
Content-Type: application/json
Token: $API_TOKEN
Use body in JSON format
[
"+12345678900",
"+12345678901"
]
🖥️ Looking for a code example? Go to the API live tester and get ready-to-use code examples in 15+ programming languages, including Python, JavaScript, PHP, C#, Java, Ruby, Go, Powershell, cURL and more.
Live API testing
You can live-test and play with the API directly from your browser.
Once you are done testing, get the auto-generated code example in your preferred programming language and you will be ready to go.
🤩 🤖 Wassenger is a complete communication platform and API solution for WhatsApp. Explore more than 100+ API use cases and automate anything on WhatsApp by signing up for a free trial and getting started in minutes!
FAQ
How can I manage contacts in a group?
You just have to send multiple API requests, one per target group.
For instance, if you want to update 10 groups, you should send 10 independent HTTPS requests to the API and one per method (POST, PATCH or DELETE).
There is no option to manage different groups in a single API request.
How many contacts I can manage at once?
To prevent processing issues or errors, it is not recommended to manage more than 10 participants at a time per API request (add, delete, promote or demote).
Further useful resources
For more details about the endpoint API, please check our documentation. You will find all the details about the accepted request params, possible success or error responses and ready-to-use code examples in multiple programming languages.