List WhatsApp Groups
Using a 2Chat-connected number as the source, this endpoint will get you a list of all groups such number is a participant of.
Invocation
- cURL
- Python
- NodeJS
curl -L -G 'https://api.p.2chat.io/open/whatsapp/groups/+595981048477' \
--header 'X-User-API-Key: your_api_key_here'
import requests
url = "https://api.p.2chat.io/open/whatsapp/groups/+595981048477"
payload = ""
headers = {
'X-User-API-Key': 'your_api_key_here'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
var axios = require('axios');
var data = '';
var config = {
method: 'get',
url: 'https://api.p.2chat.io/open/whatsapp/groups/+595981048477',
headers: {
'X-User-API-Key': 'your_api_key_here'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Response
The API will return an array of WhatsApp groups that the source number is a participant of.
info
If you joined a group very recently, like in minutes ago, it can take a few more minutes for 2Chat to be able to list it.
info
If you connected your number to 2Chat for the first time, it can take between 5 to 30 minutes for your WhatsApp groups to be listed. If more than 30 minutes have passed and you still can't see your group, please get it touch with us using our Customer Support channels.
{
{
"success": true,
"data": [
{
"uuid": "WAG768beeef-2b96-4bc7-9b7f-045078568723",
"channel_uuid": "WPN95841312-b54d-46e3-b0bc-6414f4a5296b",
"wa_group_id": "....@g.us",
"profile_pic_url": "...",
"wa_owner_id": "17137157533@c.us",
"wa_group_name": "2chat test group 👌",
"wa_created_at": "2022-10-23T17:11:41Z",
"wa_subject": "daily motivational quotes 💪",
"size": 4,
"is_muted": false,
"is_read_only": false,
"channel_is_owner": false,
"created_at": "2023-06-22T20:02:56Z",
"updated_at": "2023-07-12T19:18:41Z",
"owner_contact": {
"uuid": "CON1653490d-194b-4992-8353-e4b46a64e321",
"first_name": "Mikey",
"last_name": "Mike",
"channel_uuid": "WPNc568c832-606c-4d50-8092-fc51b5149d16",
"profile_pic_url": "..."
}
}
]
}
}
tip
You will need the UUID
of the group to send a message to it using the API
Field | Description | Example value |
---|---|---|
uuid | The unique identifier of the group | WAG768beeef-2b96-4bc7-9b7f-045078568723 |
channel_uuid | The unique identifier of the channel | WPN95841312-b54d-46e3-b0bc-6414f4a5296b |
wa_group_id | WhatsApp's internal identifier for the group | ...@g.us |
profile_pic_url | URL to the profile picture of the group | https://... |
wa_owner_id | WhatsApp's internal identifier for the owner of the group | 17137157533@c.us |
wa_group_name | Name of the group | 2chat test group 👌 |
wa_created_at | The date the group was created at | 2022-10-23T17:11:41Z |
wa_subject | Subject of the group | daily motivational quotes 💪 |
size | The number of participants in this group | 4 |
is_muted | Whether the group is muted on your phone | false |
is_read_only | Whether the group is read-only or not | false |
channel_is_owner | Whether you own the group or not | false |
created_at | Timestamp of when the group was registered on 2Chat | 2023-06-22T20:02:56Z |
updated_at | The last time 2Chat pulled information about the group | 2023-07-12T19:18:41Z |
owner_contact | The contact information of the owner of the group, if present | true |