Envoyer un message groupe
curl --request POST \
--url https://api.wachap.com/v1/whatsapp/groups/send \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"accountId": "account_123",
"groupJid": "120363123456789012@g.us",
"type": "text",
"content": "Confirmez-vous votre participation ?",
"buttons": [
{
"id": "yes",
"text": "Oui",
"type": "reply"
},
{
"id": "no",
"text": "Non",
"type": "reply"
}
],
"footerText": "Réunion WaChap"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
accountId: 'account_123',
groupJid: '120363123456789012@g.us',
type: 'text',
content: 'Confirmez-vous votre participation ?',
buttons: [
{id: 'yes', text: 'Oui', type: 'reply'},
{id: 'no', text: 'Non', type: 'reply'}
],
footerText: 'Réunion WaChap'
})
};
fetch('https://api.wachap.com/v1/whatsapp/groups/send', 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: 'account_123',
groupJid: '120363123456789012@g.us',
type: 'text',
content: 'Confirmez-vous votre participation ?',
buttons: [
{id: 'yes', text: 'Oui', type: 'reply'},
{id: 'no', text: 'Non', type: 'reply'}
],
footerText: 'Réunion WaChap'
})
};
fetch('https://api.wachap.com/v1/whatsapp/groups/send', 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/send"
payload = {
"accountId": "account_123",
"groupJid": "120363123456789012@g.us",
"type": "text",
"content": "Confirmez-vous votre participation ?",
"buttons": [
{
"id": "yes",
"text": "Oui",
"type": "reply"
},
{
"id": "no",
"text": "Non",
"type": "reply"
}
],
"footerText": "Réunion WaChap"
}
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/send",
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' => 'account_123',
'groupJid' => '120363123456789012@g.us',
'type' => 'text',
'content' => 'Confirmez-vous votre participation ?',
'buttons' => [
[
'id' => 'yes',
'text' => 'Oui',
'type' => 'reply'
],
[
'id' => 'no',
'text' => 'Non',
'type' => 'reply'
]
],
'footerText' => 'Réunion WaChap'
]),
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/send"
payload := strings.NewReader("{\n \"accountId\": \"account_123\",\n \"groupJid\": \"120363123456789012@g.us\",\n \"type\": \"text\",\n \"content\": \"Confirmez-vous votre participation ?\",\n \"buttons\": [\n {\n \"id\": \"yes\",\n \"text\": \"Oui\",\n \"type\": \"reply\"\n },\n {\n \"id\": \"no\",\n \"text\": \"Non\",\n \"type\": \"reply\"\n }\n ],\n \"footerText\": \"Réunion WaChap\"\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
Envoyer un message dans un groupe
Envoyez un message dans un groupe WhatsApp
POST
/
whatsapp
/
groups
/
send
Envoyer un message groupe
curl --request POST \
--url https://api.wachap.com/v1/whatsapp/groups/send \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"accountId": "account_123",
"groupJid": "120363123456789012@g.us",
"type": "text",
"content": "Confirmez-vous votre participation ?",
"buttons": [
{
"id": "yes",
"text": "Oui",
"type": "reply"
},
{
"id": "no",
"text": "Non",
"type": "reply"
}
],
"footerText": "Réunion WaChap"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
accountId: 'account_123',
groupJid: '120363123456789012@g.us',
type: 'text',
content: 'Confirmez-vous votre participation ?',
buttons: [
{id: 'yes', text: 'Oui', type: 'reply'},
{id: 'no', text: 'Non', type: 'reply'}
],
footerText: 'Réunion WaChap'
})
};
fetch('https://api.wachap.com/v1/whatsapp/groups/send', 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: 'account_123',
groupJid: '120363123456789012@g.us',
type: 'text',
content: 'Confirmez-vous votre participation ?',
buttons: [
{id: 'yes', text: 'Oui', type: 'reply'},
{id: 'no', text: 'Non', type: 'reply'}
],
footerText: 'Réunion WaChap'
})
};
fetch('https://api.wachap.com/v1/whatsapp/groups/send', 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/send"
payload = {
"accountId": "account_123",
"groupJid": "120363123456789012@g.us",
"type": "text",
"content": "Confirmez-vous votre participation ?",
"buttons": [
{
"id": "yes",
"text": "Oui",
"type": "reply"
},
{
"id": "no",
"text": "Non",
"type": "reply"
}
],
"footerText": "Réunion WaChap"
}
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/send",
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' => 'account_123',
'groupJid' => '120363123456789012@g.us',
'type' => 'text',
'content' => 'Confirmez-vous votre participation ?',
'buttons' => [
[
'id' => 'yes',
'text' => 'Oui',
'type' => 'reply'
],
[
'id' => 'no',
'text' => 'Non',
'type' => 'reply'
]
],
'footerText' => 'Réunion WaChap'
]),
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/send"
payload := strings.NewReader("{\n \"accountId\": \"account_123\",\n \"groupJid\": \"120363123456789012@g.us\",\n \"type\": \"text\",\n \"content\": \"Confirmez-vous votre participation ?\",\n \"buttons\": [\n {\n \"id\": \"yes\",\n \"text\": \"Oui\",\n \"type\": \"reply\"\n },\n {\n \"id\": \"no\",\n \"text\": \"Non\",\n \"type\": \"reply\"\n }\n ],\n \"footerText\": \"Réunion WaChap\"\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))
}Envoyer un message dans un groupe
Envoyez un message (texte, image, vidéo, etc.) dans un groupe WhatsApp.Endpoint
Headers
string
requis
Bearer token avec votre Secret Key (format:
Bearer sk_...)Body Parameters
string
requis
L’identifiant du compte WhatsApp
string
requis
L’identifiant du groupe (format:
120363...@g.us)string
requis
Type de message:
text, image, video, document, audio, location, contactstring
Contenu du message texte (Requis si type=
text)string
URL de l’image (Requis si type=
image)string
Légende pour une image, une vidéo ou un document
string
URL de la vidéo (Requis si type=
video)string
URL du document (Requis si type=
document)string
Nom du fichier pour un document
string
URL du fichier audio (Requis si type=
audio)array
Jusqu’à trois boutons interactifs pour
text, image, video ou document.string
Pied affiché sous les boutons, limité à 60 caractères.
POST /v1/whatsapp/groups/:groupJid/send en plaçant le JID dans l’URL et en omettant groupJid du body. Les mêmes champs de boutons sont acceptés.
Exemples de requêtes
curl -X POST https://api.wachap.com/v1/whatsapp/groups/send \
-H "Content-Type: application/json" \
-H "Authorization: Bearer token" \
-d '{
"accountId": "a1233b-a1233b-a1233b-a1233b-a1233bcdjdg9878",
"groupJid": "120363123456789012@g.us",
"type": "text",
"content": "Confirmez-vous votre participation ?",
"buttons": [
{"id": "yes", "text": "Oui", "type": "reply"},
{"id": "no", "text": "Non", "type": "reply"}
],
"footerText": "Réunion WaChap"
}'
curl -X POST https://api.wachap.com/v1/whatsapp/groups/send \
-H "Content-Type: application/json" \
-H "Authorization: Bearer token" \
-d '{
"accountId": "a1233b-a1233b-a1233b-a1233b-a1233bcdjdg9878",
"groupJid": "120363123456789012@g.us",
"type": "image",
"imageUrl": "https://example.com/image.jpg",
"caption": "Regardez cette image !",
"buttons": [
{"id": "details", "text": "Voir les détails", "type": "url", "url": "https://wachap.com/details"}
]
}'
Exemple de réponse
{
"success": true,
"message": "Message envoyé avec succès",
"messageId": "3EB0123456789ABCDEF",
"groupJid": "120363123456789012@g.us"
}
Codes d’erreur
| Code | Description |
|---|---|
400 | MISSING_ACCOUNT_ID, MISSING_GROUP_JID, MISSING_TYPE |
401 | INVALID_SECRET_KEY - Clé secrète invalide |
403 | NOT_MEMBER - Vous n’êtes pas membre du groupe |
404 | ACCOUNT_NOT_FOUND, GROUP_NOT_FOUND |
Autorisations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Corps
application/json
Options disponibles:
text, image, video, document, audio, location, contact Disponible pour text, image, video et document.
Required array length:
1 - 3 elementsShow child attributes
Show child attributes
Maximum string length:
60Réponse
OK
