Gérer les membres
curl --request POST \
--url https://api.wachap.com/v1/whatsapp/groups/members \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"accountId": "<string>",
"groupJid": "<string>",
"participants": [
"<string>"
]
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({accountId: '<string>', groupJid: '<string>', participants: ['<string>']})
};
fetch('https://api.wachap.com/v1/whatsapp/groups/members', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({accountId: '<string>', groupJid: '<string>', participants: ['<string>']})
};
fetch('https://api.wachap.com/v1/whatsapp/groups/members', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.wachap.com/v1/whatsapp/groups/members"
payload = {
"accountId": "<string>",
"groupJid": "<string>",
"participants": ["<string>"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.wachap.com/v1/whatsapp/groups/members",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'accountId' => '<string>',
'groupJid' => '<string>',
'participants' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.wachap.com/v1/whatsapp/groups/members"
payload := strings.NewReader("{\n \"accountId\": \"<string>\",\n \"groupJid\": \"<string>\",\n \"participants\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}Groupes WhatsApp
Ajouter des membres
Ajoutez un ou plusieurs participants à un groupe WhatsApp.
POST
/
whatsapp
/
groups
/
members
Gérer les membres
curl --request POST \
--url https://api.wachap.com/v1/whatsapp/groups/members \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"accountId": "<string>",
"groupJid": "<string>",
"participants": [
"<string>"
]
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({accountId: '<string>', groupJid: '<string>', participants: ['<string>']})
};
fetch('https://api.wachap.com/v1/whatsapp/groups/members', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({accountId: '<string>', groupJid: '<string>', participants: ['<string>']})
};
fetch('https://api.wachap.com/v1/whatsapp/groups/members', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.wachap.com/v1/whatsapp/groups/members"
payload = {
"accountId": "<string>",
"groupJid": "<string>",
"participants": ["<string>"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.wachap.com/v1/whatsapp/groups/members",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'accountId' => '<string>',
'groupJid' => '<string>',
'participants' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.wachap.com/v1/whatsapp/groups/members"
payload := strings.NewReader("{\n \"accountId\": \"<string>\",\n \"groupJid\": \"<string>\",\n \"participants\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}Endpoints
Option 1: GroupJid dans le body
POST https://api.wachap.com/v1/whatsapp/groups/members
Option 2: GroupJid dans l’URL (rétrocompatibilité)
POST https://api.wachap.com/v1/whatsapp/groups/:groupJid/members
Headers
| Paramètre | Type | Requis | Description |
|---|---|---|---|
| Authorization | string | Oui | Bearer token avec votre Secret Key (format: Bearer sk_...) |
Body Parameters (Option 1)
| Paramètre | Type | Requis | Description |
|---|---|---|---|
| accountId | string | Oui | L’identifiant du compte WhatsApp |
| groupJid | string | Oui | L’identifiant du groupe (format: 120363123456789012@g.us) |
| action | string | Oui | Action à effectuer: add |
| participants | array | Oui | Liste des numéros de téléphone au format international |
Body Parameters (Option 2)
| Paramètre | Type | Requis | Description |
|---|---|---|---|
| accountId | string | Oui | L’identifiant du compte WhatsApp |
| action | string | Oui | Action à effectuer: add |
| participants | array | Oui | Liste des numéros de téléphone au format international |
Exemple de requête
Option 1: GroupJid dans le body
curl -X POST https://api.wachap.com/v1/whatsapp/groups/members \
-H "Content-Type: application/json" \
-H "Authorization: Bearer token" \
-d '{
"accountId": "a1233b-a1233b-a1233b-a1233b-a1233bcdjdg9878",
"groupJid": "120363123456789012@g.us",
"action": "add",
"participants": ["+33612345678", "+2290112345678"]
}'
Option 2: GroupJid dans l’URL
curl -X POST https://api.wachap.com/v1/whatsapp/groups/120363123456789012@g.us/members \
-H "Content-Type: application/json" \
-H "Authorization: Bearer token" \
-d '{
"accountId": "a1233b-a1233b-a1233b-a1233b-a1233bcdjdg9878",
"action": "add",
"participants": ["+33612345678", "+2290112345678"]
}'
Exemple de réponse
{
"success": true,
"message": "Participants ajoutés avec succès",
"action": "add",
"groupJid": "120363123456789012@g.us",
"participants": [
"33612345678@s.whatsapp.net",
"2290112345678@s.whatsapp.net"
]
}
Notes
- Vous devez être administrateur du groupe pour ajouter des participants
- Les numéros doivent être au format international (+33612345678)
- Les participants reçoivent une notification d’ajout
Codes d’erreur
| Code | Description |
|---|---|
| 400 | MISSING_ACCOUNT_ID - accountId manquant |
| 400 | MISSING_GROUP_JID - groupJid manquant |
| 400 | MISSING_ACTION - action manquante |
| 400 | MISSING_PARTICIPANTS - participants manquant ou vide |
| 401 | INVALID_SECRET_KEY - Clé secrète invalide |
| 403 | NOT_ADMIN - Vous n’êtes pas administrateur du groupe |
| 404 | ACCOUNT_NOT_FOUND - Compte WhatsApp non trouvé |
| 404 | GROUP_NOT_FOUND - Groupe non trouvé |
Autorisations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Corps
application/json
Réponse
200
OK
⌘I
