WhatsApp v2 - Groups (Scan Device)
List joined groups and send into them with a connected Scan Device sender (QR session). Requires capabilities.group_messaging.
1
GET List Joined Groups
GET https://api.greenbubble.io/api/v2/whatsapp/groups?sender_id=wa_snd_YOUR_SCAN_DEVICE_SENDER_ID
cURL
curl -X GET 'https://api.greenbubble.io/api/v2/whatsapp/groups?sender_id=wa_snd_YOUR_SCAN_DEVICE_SENDER_ID' \
-H 'x-api-key: YOUR_API_KEY'
JavaScript
const res = await fetch('https://api.greenbubble.io/api/v2/whatsapp/groups?sender_id=wa_snd_YOUR_SCAN_DEVICE_SENDER_ID', {
method: 'GET',
headers: { 'x-api-key': 'YOUR_API_KEY' }
});
const data = await res.json();
console.log(data);
Python
import requests
url = "https://api.greenbubble.io/api/v2/whatsapp/groups?sender_id=wa_snd_YOUR_SCAN_DEVICE_SENDER_ID"
headers = { "x-api-key": "YOUR_API_KEY" }
response = requests.get(url, headers=headers)
print(response.status_code)
print(response.json())
PHP
$ch = curl_init('https://api.greenbubble.io/api/v2/whatsapp/groups?sender_id=wa_snd_YOUR_SCAN_DEVICE_SENDER_ID');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['x-api-key: YOUR_API_KEY']);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $httpCode . "\n" . $response;
2
GET List Group Members
GET https://api.greenbubble.io/api/v2/whatsapp/groups/120363042318711234%40g.us/members?sender_id=wa_snd_YOUR_SCAN_DEVICE_SENDER_ID
cURL
curl -X GET 'https://api.greenbubble.io/api/v2/whatsapp/groups/120363042318711234%40g.us/members?sender_id=wa_snd_YOUR_SCAN_DEVICE_SENDER_ID' \
-H 'x-api-key: YOUR_API_KEY'
JavaScript
const res = await fetch('https://api.greenbubble.io/api/v2/whatsapp/groups/120363042318711234%40g.us/members?sender_id=wa_snd_YOUR_SCAN_DEVICE_SENDER_ID', {
method: 'GET',
headers: { 'x-api-key': 'YOUR_API_KEY' }
});
const data = await res.json();
console.log(data);
Python
import requests
url = "https://api.greenbubble.io/api/v2/whatsapp/groups/120363042318711234%40g.us/members?sender_id=wa_snd_YOUR_SCAN_DEVICE_SENDER_ID"
headers = { "x-api-key": "YOUR_API_KEY" }
response = requests.get(url, headers=headers)
print(response.status_code)
print(response.json())
PHP
$ch = curl_init('https://api.greenbubble.io/api/v2/whatsapp/groups/120363042318711234%40g.us/members?sender_id=wa_snd_YOUR_SCAN_DEVICE_SENDER_ID');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['x-api-key: YOUR_API_KEY']);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $httpCode . "\n" . $response;
3
POST Send Text by Group Name
POST https://api.greenbubble.io/api/v2/whatsapp/groups/messages
cURL
curl -X POST 'https://api.greenbubble.io/api/v2/whatsapp/groups/messages' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"sender_id":"wa_snd_YOUR_SCAN_DEVICE_SENDER_ID","group_name":"Sales Team","message":{"type":"text","text":{"body":"Hello team"}},"mentions":["@everyone"]}'
JavaScript
const res = await fetch('https://api.greenbubble.io/api/v2/whatsapp/groups/messages', {
method: 'POST',
headers: {
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"sender_id": "wa_snd_YOUR_SCAN_DEVICE_SENDER_ID",
"group_name": "Sales Team",
"message": {
"type": "text",
"text": {
"body": "Hello team"
}
},
"mentions": [
"@everyone"
]
})
});
const data = await res.json();
console.log(data);
Python
import requests
url = "https://api.greenbubble.io/api/v2/whatsapp/groups/messages"
headers = {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
}
payload = {
"sender_id": "wa_snd_YOUR_SCAN_DEVICE_SENDER_ID",
"group_name": "Sales Team",
"message": {
"type": "text",
"text": {
"body": "Hello team"
}
},
"mentions": [
"@everyone"
]
}
response = requests.post(url, headers=headers, json=payload)
print(response.status_code)
print(response.json())
PHP
$ch = curl_init('https://api.greenbubble.io/api/v2/whatsapp/groups/messages');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'x-api-key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"sender_id":"wa_snd_YOUR_SCAN_DEVICE_SENDER_ID","group_name":"Sales Team","message":{"type":"text","text":{"body":"Hello team"}},"mentions":["@everyone"]}');
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $httpCode . "\n" . $response;
4
POST Send Text by Group ID
POST https://api.greenbubble.io/api/v2/whatsapp/groups/messages
cURL
curl -X POST 'https://api.greenbubble.io/api/v2/whatsapp/groups/messages' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"sender_id":"wa_snd_YOUR_SCAN_DEVICE_SENDER_ID","group_id":"120363042318711234@g.us","message":{"type":"text","text":{"body":"Hello team from Greenbubble"}}}'
JavaScript
const res = await fetch('https://api.greenbubble.io/api/v2/whatsapp/groups/messages', {
method: 'POST',
headers: {
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"sender_id": "wa_snd_YOUR_SCAN_DEVICE_SENDER_ID",
"group_id": "120363042318711234@g.us",
"message": {
"type": "text",
"text": {
"body": "Hello team from Greenbubble"
}
}
})
});
const data = await res.json();
console.log(data);
Python
import requests
url = "https://api.greenbubble.io/api/v2/whatsapp/groups/messages"
headers = {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
}
payload = {
"sender_id": "wa_snd_YOUR_SCAN_DEVICE_SENDER_ID",
"group_id": "120363042318711234@g.us",
"message": {
"type": "text",
"text": {
"body": "Hello team from Greenbubble"
}
}
}
response = requests.post(url, headers=headers, json=payload)
print(response.status_code)
print(response.json())
PHP
$ch = curl_init('https://api.greenbubble.io/api/v2/whatsapp/groups/messages');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'x-api-key: YOUR_API_KEY',
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"sender_id":"wa_snd_YOUR_SCAN_DEVICE_SENDER_ID","group_id":"120363042318711234@g.us","message":{"type":"text","text":{"body":"Hello team from Greenbubble"}}}');
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $httpCode . "\n" . $response;