Documentation Sendmako
Sendmako vous permet d'envoyer et de recevoir des messages WhatsApp de manière programmatique. Connectez votre numéro WhatsApp via QR code, puis utilisez n'importe quel client HTTP pour envoyer des messages, gérer vos sessions, recevoir des événements en temps réel via webhooks et déchiffrer les fichiers médias entrants.
5
Endpoints sessions
8
Types de messages
4
Événements webhook
REST
API JSON
URL de base
Toutes les requêtes API utilisent l'URL de base suivante :
Toutes les requêtes et réponses utilisent application/json sauf indication contraire (decrypt-media retourne du binaire).
Authentification
Toutes les requêtes doivent inclure votre clé API dans l'en-tête Authorization.
En-tête
Authorization: Bearer wsa_votre_cle_api
Générez et gérez vos clés API depuis la page Tableau de bord → Clés API.
Erreurs & Réponses
Sendmako utilise les codes HTTP standards. Toutes les erreurs incluent un champ message.
| Code | Signification |
|---|---|
| 200 | OK — requête réussie |
| 201 | Created — ressource créée |
| 400 | Bad Request — champs manquants ou invalides |
| 401 | Unauthorized — clé API invalide ou absente |
| 403 | Forbidden — limite du forfait atteinte |
| 404 | Not Found — ressource introuvable |
| 422 | Unprocessable — requête valide mais opération échouée |
| 503 | Service Unavailable — service WhatsApp inaccessible |
Réponse d'erreur
{
"success": false,
"message": "No WhatsApp session found. Connect a number first."
}
Sessions
/api/whatsapp/sessions/
Lister toutes les sessions
Retourne toutes les sessions WhatsApp de l'utilisateur authentifié avec leur statut en temps réel.
curl -X GET "https://sendmako.com/api/whatsapp/sessions/" \ -H "Authorization: Bearer wsa_votre_cle_api"
import requests
r = requests.get(
"https://sendmako.com/api/whatsapp/sessions/",
headers={"Authorization": "Bearer wsa_votre_cle_api"}
)
print(r.json())
const r = await fetch("https://sendmako.com/api/whatsapp/sessions/", {
headers: { "Authorization": "Bearer wsa_votre_cle_api" }
});
console.log(await r.json());
["Authorization: Bearer wsa_votre_cle_api"],
CURLOPT_RETURNTRANSFER => true,
]);
print_r(json_decode(curl_exec($ch), true));
Réponse
[
{
"id": 1,
"session_id": "user_1",
"session_name": "Personnel",
"status": "connected",
"phone_number": "22241857975",
"qr": null
}
]
/api/whatsapp/sessions/
Créer une session
Crée un nouvel emplacement de session WhatsApp. Après la création, interrogez le statut jusqu'à ce que status = qr_ready, puis affichez le QR code pour le scanner. Limité par votre forfait.
curl -X POST "https://sendmako.com/api/whatsapp/sessions/" \
-H "Authorization: Bearer wsa_votre_cle_api" \
-H "Content-Type: application/json" \
-d '{"session_name": "Professionnel"}'
r = requests.post(
"https://sendmako.com/api/whatsapp/sessions/",
headers={"Authorization": "Bearer wsa_votre_cle_api"},
json={"session_name": "Professionnel"}
)
print(r.json())
const r = await fetch("https://sendmako.com/api/whatsapp/sessions/", {
method: "POST",
headers: {"Authorization":"Bearer wsa_votre_cle_api","Content-Type":"application/json"},
body: JSON.stringify({session_name: "Professionnel"})
});
console.log(await r.json());
$ch = curl_init("https://sendmako.com/api/whatsapp/sessions/");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode(["session_name" => "Professionnel"]),
CURLOPT_HTTPHEADER => ["Authorization: Bearer wsa_votre_cle_api","Content-Type: application/json"],
CURLOPT_RETURNTRANSFER => true,
]);
print_r(json_decode(curl_exec($ch), true));
Réponse 201
{
"success": true,
"id": 2,
"session_id": "user_1_2",
"session_name": "Professionnel",
"status": "connecting"
}
/api/whatsapp/sessions/{session_id}/
Statut de session & QR Code
Retourne le statut en temps réel d'une session. Lorsque status = qr_ready, la réponse inclut une image QR en base64 à afficher pour le scan.
curl -X GET "https://sendmako.com/api/whatsapp/sessions/user_1/" \ -H "Authorization: Bearer wsa_votre_cle_api"
r = requests.get(
"https://sendmako.com/api/whatsapp/sessions/user_1/",
headers={"Authorization": "Bearer wsa_votre_cle_api"}
)
print(r.json())
const r = await fetch("https://sendmako.com/api/whatsapp/sessions/user_1/", {
headers: { "Authorization": "Bearer wsa_votre_cle_api" }
});
console.log(await r.json());
$ch = curl_init("https://sendmako.com/api/whatsapp/sessions/user_1/");
curl_setopt_array($ch,[CURLOPT_HTTPHEADER=>["Authorization: Bearer wsa_votre_cle_api"],CURLOPT_RETURNTRANSFER=>true]);
print_r(json_decode(curl_exec($ch),true));
Quand connecté
{"status": "connected", "qr": null}
Quand QR prêt
{"status": "qr_ready", "qr": "data:image/png;base64,iVBO..."}
/api/whatsapp/sessions/{session_id}/
Renommer une session
Met à jour le nom d'affichage d'une session.
curl -X PATCH "https://sendmako.com/api/whatsapp/sessions/user_1/" \
-H "Authorization: Bearer wsa_votre_cle_api" \
-H "Content-Type: application/json" \
-d '{"session_name": "Ma ligne pro"}'
r = requests.patch(
"https://sendmako.com/api/whatsapp/sessions/user_1/",
headers={"Authorization": "Bearer wsa_votre_cle_api"},
json={"session_name": "Ma ligne pro"}
)
await fetch("https://sendmako.com/api/whatsapp/sessions/user_1/", {
method: "PATCH",
headers: {"Authorization":"Bearer wsa_votre_cle_api","Content-Type":"application/json"},
body: JSON.stringify({session_name: "Ma ligne pro"})
});
$ch = curl_init("https://sendmako.com/api/whatsapp/sessions/user_1/");
curl_setopt_array($ch,[CURLOPT_CUSTOMREQUEST=>"PATCH",
CURLOPT_POSTFIELDS=>json_encode(["session_name"=>"Ma ligne pro"]),
CURLOPT_HTTPHEADER=>["Authorization: Bearer wsa_votre_cle_api","Content-Type: application/json"],
CURLOPT_RETURNTRANSFER=>true]);
print_r(json_decode(curl_exec($ch),true));
Réponse
{"success": true, "session_name": "Ma ligne pro"}
/api/whatsapp/sessions/{session_id}/
Supprimer une session
Déconnecte et supprime définitivement une session WhatsApp. Le numéro devra se reconnecter via QR code pour être réutilisé.
curl -X DELETE "https://sendmako.com/api/whatsapp/sessions/user_1/" \ -H "Authorization: Bearer wsa_votre_cle_api"
requests.delete("https://sendmako.com/api/whatsapp/sessions/user_1/",
headers={"Authorization": "Bearer wsa_votre_cle_api"})
await fetch("https://sendmako.com/api/whatsapp/sessions/user_1/", {
method: "DELETE",
headers: {"Authorization": "Bearer wsa_votre_cle_api"}
});
$ch = curl_init("https://sendmako.com/api/whatsapp/sessions/user_1/");
curl_setopt_array($ch,[CURLOPT_CUSTOMREQUEST=>"DELETE",
CURLOPT_HTTPHEADER=>["Authorization: Bearer wsa_votre_cle_api"],
CURLOPT_RETURNTRANSFER=>true]);
print_r(json_decode(curl_exec($ch),true));
Réponse
{"success": true}
Messages
/api/send-message
Envoyer un message texte
Envoie un message texte brut à un numéro WhatsApp.
textcurl -X POST "https://sendmako.com/api/send-message" \
-H "Authorization: Bearer wsa_votre_cle_api" \
-H "Content-Type: application/json" \
-d '{
"to": "22241857975",
"type": "text",
"text": "Bonjour depuis Sendmako !"
}'
import requests
r = requests.post(
"https://sendmako.com/api/send-message",
headers={"Authorization": "Bearer wsa_votre_cle_api"},
json={"to": "22241857975", "type": "text", "text": "Bonjour depuis Sendmako !"}
)
print(r.json())
const r = await fetch("https://sendmako.com/api/send-message", {
method: "POST",
headers: {
"Authorization": "Bearer wsa_votre_cle_api",
"Content-Type": "application/json"
},
body: JSON.stringify({
to: "22241857975",
type: "text",
text: "Bonjour depuis Sendmako !"
})
});
console.log(await r.json());
true,
CURLOPT_POSTFIELDS => json_encode([
"to" => "22241857975",
"type" => "text",
"text" => "Bonjour depuis Sendmako !"
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer wsa_votre_cle_api",
"Content-Type: application/json"
],
CURLOPT_RETURNTRANSFER => true,
]);
print_r(json_decode(curl_exec($ch), true));
Réponse
{"success": true}
/api/send-message
Envoyer une image
Envoie une image depuis une URL publique. Taille maximale : 16 Mo.
imagecurl -X POST "https://sendmako.com/api/send-message" \
-H "Authorization: Bearer wsa_votre_cle_api" \
-H "Content-Type: application/json" \
-d '{
"to": "22241857975",
"type": "image",
"imageUrl": "https://example.com/photo.jpg",
"caption": "Regardez ça !"
}'
r = requests.post(
"https://sendmako.com/api/send-message",
headers={"Authorization": "Bearer wsa_votre_cle_api"},
json={
"to": "22241857975", "type": "image",
"imageUrl": "https://example.com/photo.jpg",
"caption": "Regardez ça !"
}
)
await fetch("https://sendmako.com/api/send-message", {
method: "POST",
headers: {"Authorization":"Bearer wsa_votre_cle_api","Content-Type":"application/json"},
body: JSON.stringify({
to: "22241857975", type: "image",
imageUrl: "https://example.com/photo.jpg",
caption: "Regardez ça !"
})
});
$data = ["to"=>"22241857975","type"=>"image",
"imageUrl"=>"https://example.com/photo.jpg","caption"=>"Regardez ça !"];
// ... même configuration curl que l'exemple texte ...
/api/send-messageEnvoyer une vidéo
Envoie une vidéo depuis une URL publique. Taille maximale : 50 Mo.
videocurl -X POST "https://sendmako.com/api/send-message" \
-H "Authorization: Bearer wsa_votre_cle_api" \
-H "Content-Type: application/json" \
-d '{"to":"22241857975","type":"video","videoUrl":"https://example.com/clip.mp4","caption":"Regardez !"}'
r = requests.post("https://sendmako.com/api/send-message",
headers={"Authorization":"Bearer wsa_votre_cle_api"},
json={"to":"22241857975","type":"video","videoUrl":"https://example.com/clip.mp4"})
await fetch("https://sendmako.com/api/send-message",{method:"POST",
headers:{"Authorization":"Bearer wsa_votre_cle_api","Content-Type":"application/json"},
body:JSON.stringify({to:"22241857975",type:"video",videoUrl:"https://example.com/clip.mp4"})});
$data=["to"=>"22241857975","type"=>"video","videoUrl"=>"https://example.com/clip.mp4"];
/api/send-messageEnvoyer un audio
Envoie un fichier audio. Définissez voiceNote: true pour l'afficher comme note vocale WhatsApp avec forme d'onde. Max : 15 Mo.
audiocurl -X POST "https://sendmako.com/api/send-message" \
-H "Authorization: Bearer wsa_votre_cle_api" \
-H "Content-Type: application/json" \
-d '{"to":"22241857975","type":"audio","audioUrl":"https://example.com/audio.mp3","voiceNote":false}'
r = requests.post("https://sendmako.com/api/send-message",
headers={"Authorization":"Bearer wsa_votre_cle_api"},
json={"to":"22241857975","type":"audio","audioUrl":"https://example.com/audio.mp3","voiceNote":False})
await fetch("https://sendmako.com/api/send-message",{method:"POST",
headers:{"Authorization":"Bearer wsa_votre_cle_api","Content-Type":"application/json"},
body:JSON.stringify({to:"22241857975",type:"audio",audioUrl:"https://example.com/audio.mp3",voiceNote:false})});
$data=["to"=>"22241857975","type"=>"audio","audioUrl"=>"https://example.com/audio.mp3","voiceNote"=>false];
/api/send-messageEnvoyer un document
Envoie un fichier document (PDF, DOCX, XLSX, etc.). Taille maximale : 70 Mo.
documentcurl -X POST "https://sendmako.com/api/send-message" \
-H "Authorization: Bearer wsa_votre_cle_api" \
-H "Content-Type: application/json" \
-d '{
"to": "22241857975",
"type": "document",
"documentUrl": "https://example.com/facture.pdf",
"filename": "facture.pdf",
"mimetype": "application/pdf"
}'
r = requests.post("https://sendmako.com/api/send-message",
headers={"Authorization":"Bearer wsa_votre_cle_api"},
json={"to":"22241857975","type":"document",
"documentUrl":"https://example.com/facture.pdf",
"filename":"facture.pdf","mimetype":"application/pdf"})
await fetch("https://sendmako.com/api/send-message",{method:"POST",
headers:{"Authorization":"Bearer wsa_votre_cle_api","Content-Type":"application/json"},
body:JSON.stringify({to:"22241857975",type:"document",
documentUrl:"https://example.com/facture.pdf",
filename:"facture.pdf",mimetype:"application/pdf"})});
$data=["to"=>"22241857975","type"=>"document",
"documentUrl"=>"https://example.com/facture.pdf",
"filename"=>"facture.pdf","mimetype"=>"application/pdf"];
/api/send-messageEnvoyer une position GPS
Envoie un repère de localisation GPS qui s'ouvre dans les cartes.
locationcurl -X POST "https://sendmako.com/api/send-message" \
-H "Authorization: Bearer wsa_votre_cle_api" \
-H "Content-Type: application/json" \
-d '{"to":"22241857975","type":"location","latitude":14.6928,"longitude":-17.4467}'
r = requests.post("https://sendmako.com/api/send-message",
headers={"Authorization":"Bearer wsa_votre_cle_api"},
json={"to":"22241857975","type":"location","latitude":14.6928,"longitude":-17.4467})
await fetch("https://sendmako.com/api/send-message",{method:"POST",
headers:{"Authorization":"Bearer wsa_votre_cle_api","Content-Type":"application/json"},
body:JSON.stringify({to:"22241857975",type:"location",latitude:14.6928,longitude:-17.4467})});
$data=["to"=>"22241857975","type"=>"location","latitude"=>14.6928,"longitude"=>-17.4467];
/api/send-bulkEnvoi groupé
Envoie le même message à jusqu'à 100 destinataires en une seule requête. Un délai de 500 ms est appliqué entre chaque envoi pour respecter les limites WhatsApp.
curl -X POST "https://sendmako.com/api/send-bulk" \
-H "Authorization: Bearer wsa_votre_cle_api" \
-H "Content-Type: application/json" \
-d '{
"recipients": ["22241857975", "221781234567", "237691234567"],
"type": "text",
"text": "Bonjour à tous !"
}'
r = requests.post(
"https://sendmako.com/api/send-bulk",
headers={"Authorization": "Bearer wsa_votre_cle_api"},
json={
"recipients": ["22241857975", "221781234567", "237691234567"],
"type": "text",
"text": "Bonjour à tous !"
}
)
print(r.json())
const r = await fetch("https://sendmako.com/api/send-bulk", {
method: "POST",
headers: {"Authorization":"Bearer wsa_votre_cle_api","Content-Type":"application/json"},
body: JSON.stringify({
recipients: ["22241857975","221781234567","237691234567"],
type: "text",
text: "Bonjour à tous !"
})
});
console.log(await r.json());
$data = [
"recipients" => ["22241857975","221781234567","237691234567"],
"type" => "text",
"text" => "Bonjour à tous !"
];
$ch = curl_init("https://sendmako.com/api/send-bulk");
curl_setopt_array($ch,[CURLOPT_POST=>true,CURLOPT_POSTFIELDS=>json_encode($data),
CURLOPT_HTTPHEADER=>["Authorization: Bearer wsa_votre_cle_api","Content-Type: application/json"],
CURLOPT_RETURNTRANSFER=>true]);
print_r(json_decode(curl_exec($ch),true));
Réponse
{
"success": true,
"summary": {"total": 3, "sent": 3, "failed": 0},
"results": [
{"to": "22241857975", "success": true},
{"to": "221781234567", "success": true},
{"to": "237691234567", "success": true}
]
}
/api/decrypt-mediaDéchiffrer un fichier média
Télécharge et déchiffre un fichier média WhatsApp chiffré en utilisant la mediaKey reçue dans le payload webhook. Retourne le binaire brut déchiffré avec l'en-tête Content-Type approprié — enregistrez-le directement en .jpg, .mp4, .mp3, etc.
data.media.urldata.media.mediaKeydata.media.mimetypedata.media.directPathdata.media.fileEncSha256curl -X POST "https://sendmako.com/api/decrypt-media" \
-H "Authorization: Bearer wsa_votre_cle_api" \
-H "Content-Type: application/json" \
-d '{
"url": "https://mmg.whatsapp.net/v/t62.7118-24/...",
"mediaKey": "tE5cFixjaflyXbwRha8IdwovYHzrjAQ4mz16uhNcR6o=",
"mimetype": "image/jpeg",
"directPath": "/v/t62.7118-24/...",
"fileEncSha256": "Dhg75NZE9fSYDm1P6ovnCs7bNXHzWgSbSRPq4Uj7CIc="
}' \
--output data
r = requests.post(
"https://sendmako.com/api/decrypt-media",
headers={"Authorization": "Bearer wsa_votre_cle_api"},
json={
"url": "https://mmg.whatsapp.net/v/...",
"mediaKey": "tE5cFixjaflyXbwRha8IdwovYHzrjAQ4mz16uhNcR6o=",
"mimetype": "image/jpeg",
"directPath": "/v/t62.7118-24/...",
"fileEncSha256": "Dhg75NZE9fSYDm1P6ovnCs7bNX..."
}
)
with open("image.jpg", "wb") as f:
f.write(r.content)
const r = await fetch("https://sendmako.com/api/decrypt-media", {
method: "POST",
headers: {"Authorization":"Bearer wsa_votre_cle_api","Content-Type":"application/json"},
body: JSON.stringify({
url: "https://mmg.whatsapp.net/v/...",
mediaKey: "tE5cFixjaflyXbwRha8IdwovYHzrjAQ4mz16uhNcR6o=",
mimetype: "image/jpeg",
directPath: "/v/t62.7118-24/...",
fileEncSha256: "Dhg75NZE9fSYDm1P6ovnCs7bNX..."
})
});
const blob = await r.blob();
// blob contient l'image déchiffrée — enregistrez ou affichez-la
$ch = curl_init("https://sendmako.com/api/decrypt-media");
$data = [
"url" => "https://mmg.whatsapp.net/v/...",
"mediaKey" => "tE5cFixjaflyXbwRha8IdwovYHzrjAQ4mz16uhNcR6o=",
"mimetype" => "image/jpeg",
"directPath" => "/v/t62.7118-24/...",
"fileEncSha256" => "Dhg75NZE9fSYDm1P6ovnCs7bNX..."
];
curl_setopt_array($ch,[CURLOPT_POST=>true,CURLOPT_POSTFIELDS=>json_encode($data),
CURLOPT_HTTPHEADER=>["Authorization: Bearer wsa_votre_cle_api","Content-Type: application/json"],
CURLOPT_RETURNTRANSFER=>true]);
file_put_contents("image.jpg", curl_exec($ch));
Réponse
Fichier binaire avec Content-Type: image/jpeg (ou le type MIME approprié). Utilisez --output data avec cURL ou écrivez r.content dans un fichier en Python.
Contacts
/api/whatsapp/contacts/Récupérer tous les contacts
Retourne tous les contacts synchronisés depuis votre numéro WhatsApp connecté. Les contacts sont chargés automatiquement à la connexion de la session.
curl -X GET "https://sendmako.com/api/whatsapp/contacts/" \ -H "Authorization: Bearer wsa_votre_cle_api"
r = requests.get("https://sendmako.com/api/whatsapp/contacts/",
headers={"Authorization": "Bearer wsa_votre_cle_api"})
print(r.json())
const r = await fetch("https://sendmako.com/api/whatsapp/contacts/", {
headers: {"Authorization": "Bearer wsa_votre_cle_api"}
});
console.log(await r.json());
$ch = curl_init("https://sendmako.com/api/whatsapp/contacts/");
curl_setopt_array($ch,[CURLOPT_HTTPHEADER=>["Authorization: Bearer wsa_votre_cle_api"],CURLOPT_RETURNTRANSFER=>true]);
print_r(json_decode(curl_exec($ch),true));
Réponse
{
"success": true,
"contacts": [
{"id": "22241857975@s.whatsapp.net", "phone": "22241857975", "name": "Alassane Diallo"},
{"id": "221781234567@s.whatsapp.net", "phone": "221781234567", "name": "Fatou Ndiaye"}
]
}
Groupes
/api/groupsLister tous les groupes
Retourne tous les groupes WhatsApp dont le compte connecté est membre.
curl -X GET "https://sendmako.com/api/groups" \ -H "Authorization: Bearer wsa_votre_cle_api"
r = requests.get("https://sendmako.com/api/groups",
headers={"Authorization": "Bearer wsa_votre_cle_api"})
print(r.json())
const r = await fetch("https://sendmako.com/api/groups", {
headers: {"Authorization": "Bearer wsa_votre_cle_api"}
});
console.log(await r.json());
Réponse
{
"success": true,
"groups": [
{
"id": "120363XXXXXXXXXX@g.us",
"subject": "Équipe Sendmako",
"creation": 1711209600,
"owner": "22241857975@s.whatsapp.net",
"participants": [...]
}
]
}
/api/groupsCréer un groupe
Crée un nouveau groupe WhatsApp avec un nom et une liste de participants.
["22241857975"])curl -X POST "https://sendmako.com/api/groups" \
-H "Authorization: Bearer wsa_votre_cle_api" \
-H "Content-Type: application/json" \
-d '{"name":"Équipe Sendmako","participants":["22241857975","221781234567"]}'
r = requests.post("https://sendmako.com/api/groups",
headers={"Authorization": "Bearer wsa_votre_cle_api"},
json={"name": "Équipe Sendmako", "participants": ["22241857975", "221781234567"]})
print(r.json())
/api/send-messageMessage de groupe / avec mentions
Envoyez un message dans un groupe en passant le JID du groupe (120363XXXXXXXXXX@g.us) dans le champ to. Pour les mentions, ajoutez un tableau mentions.
curl -X POST "https://sendmako.com/api/send-message" \
-H "Authorization: Bearer wsa_votre_cle_api" \
-H "Content-Type: application/json" \
-d '{"to":"120363XXXXXXXXXX@g.us","type":"text","text":"Bonjour le groupe!"}'
curl -X POST "https://sendmako.com/api/send-message" \
-H "Authorization: Bearer wsa_votre_cle_api" \
-H "Content-Type: application/json" \
-d '{
"to": "120363XXXXXXXXXX@g.us",
"type": "text",
"text": "@22241857975 regarde ça !",
"mentions": ["22241857975"]
}'
/api/groups/{groupJid}/metadataMétadonnées du groupe
Retourne le sujet, la description, la date de création, le propriétaire et la liste des participants.
curl "https://sendmako.com/api/groups/120363XXXXXXXXXX%40g.us/metadata" \ -H "Authorization: Bearer wsa_votre_cle_api"
r = requests.get("https://sendmako.com/api/groups/120363XXXXXXXXXX@g.us/metadata",
headers={"Authorization": "Bearer wsa_votre_cle_api"})
print(r.json())
/api/groups/{groupJid}/participantsParticipants du groupe
Retourne la liste des participants. Si la liste est vide, la synchronisation initiale est peut-être encore en cours.
curl "https://sendmako.com/api/groups/120363XXXXXXXXXX%40g.us/participants" \ -H "Authorization: Bearer wsa_votre_cle_api"
r = requests.get("https://sendmako.com/api/groups/120363XXXXXXXXXX@g.us/participants",
headers={"Authorization": "Bearer wsa_votre_cle_api"})
print(r.json())
/api/groups/{groupJid}/participants/addAjouter des participants
Ajoute un ou plusieurs participants au groupe. Nécessite les droits admin.
curl -X POST "https://sendmako.com/api/groups/120363XXXXXXXXXX%40g.us/participants/add" \
-H "Authorization: Bearer wsa_votre_cle_api" \
-H "Content-Type: application/json" \
-d '{"participants":["22241857975"]}'
r = requests.post(
"https://sendmako.com/api/groups/120363XXXXXXXXXX@g.us/participants/add",
headers={"Authorization": "Bearer wsa_votre_cle_api"},
json={"participants": ["22241857975"]})
print(r.json())
/api/groups/{groupJid}/participants/removeRetirer des participants
Retire un ou plusieurs participants du groupe. Nécessite les droits admin.
curl -X POST "https://sendmako.com/api/groups/120363XXXXXXXXXX%40g.us/participants/remove" \
-H "Authorization: Bearer wsa_votre_cle_api" \
-H "Content-Type: application/json" \
-d '{"participants":["221781234567"]}'
r = requests.post(
"https://sendmako.com/api/groups/120363XXXXXXXXXX@g.us/participants/remove",
headers={"Authorization": "Bearer wsa_votre_cle_api"},
json={"participants": ["221781234567"]})
print(r.json())
/api/groups/{groupJid}/participants/updatePromouvoir / Rétrograder
Promeut des participants en admin ou les rétrograde. Nécessite les droits admin.
"promote" ou "demote"curl -X PUT "https://sendmako.com/api/groups/120363XXXXXXXXXX%40g.us/participants/update" \
-H "Authorization: Bearer wsa_votre_cle_api" \
-H "Content-Type: application/json" \
-d '{"participants":["221781234567"],"action":"promote"}'
r = requests.put(
"https://sendmako.com/api/groups/120363XXXXXXXXXX@g.us/participants/update",
headers={"Authorization": "Bearer wsa_votre_cle_api"},
json={"participants": ["221781234567"], "action": "promote"})
print(r.json())
/api/groups/{groupJid}/settingsParamètres du groupe
Modifie le nom, la description, le mode annonce ou le mode restriction. Nécessite les droits admin.
true = seuls les admins peuvent envoyertrue = seuls les admins peuvent modifier les infoscurl -X PUT "https://sendmako.com/api/groups/120363XXXXXXXXXX%40g.us/settings" \
-H "Authorization: Bearer wsa_votre_cle_api" \
-H "Content-Type: application/json" \
-d '{"subject":"Nouveau nom","announce":true}'
r = requests.put(
"https://sendmako.com/api/groups/120363XXXXXXXXXX@g.us/settings",
headers={"Authorization": "Bearer wsa_votre_cle_api"},
json={"subject": "Nouveau nom", "announce": True})
print(r.json())
/api/groups/{groupJid}/invite-linkLien d'invitation
Récupère le lien d'invitation du groupe. Nécessite les droits admin.
curl "https://sendmako.com/api/groups/120363XXXXXXXXXX%40g.us/invite-link" \ -H "Authorization: Bearer wsa_votre_cle_api"
r = requests.get("https://sendmako.com/api/groups/120363XXXXXXXXXX@g.us/invite-link",
headers={"Authorization": "Bearer wsa_votre_cle_api"})
print(r.json())
Réponse
{"success": true, "invite_code": "AbCdEfGhIjKlMn", "invite_link": "https://chat.whatsapp.com/AbCdEfGhIjKlMn"}
/api/groups/invite/{inviteCode}Infos d'une invitation
Récupère les métadonnées d'un groupe à partir de son code d'invitation, sans rejoindre le groupe.
curl "https://sendmako.com/api/groups/invite/AbCdEfGhIjKlMn" \ -H "Authorization: Bearer wsa_votre_cle_api"
r = requests.get("https://sendmako.com/api/groups/invite/AbCdEfGhIjKlMn",
headers={"Authorization": "Bearer wsa_votre_cle_api"})
print(r.json())
/api/groups/invite/acceptAccepter une invitation
Rejoindre un groupe via un code d'invitation.
curl -X POST "https://sendmako.com/api/groups/invite/accept" \
-H "Authorization: Bearer wsa_votre_cle_api" \
-H "Content-Type: application/json" \
-d '{"inviteCode":"AbCdEfGhIjKlMn"}'
r = requests.post("https://sendmako.com/api/groups/invite/accept",
headers={"Authorization": "Bearer wsa_votre_cle_api"},
json={"inviteCode": "AbCdEfGhIjKlMn"})
print(r.json())
/api/groups/{groupJid}/picturePhoto du groupe
Retourne l'URL de la photo de profil du groupe. Retourne null si aucune photo n'est définie.
curl "https://sendmako.com/api/groups/120363XXXXXXXXXX%40g.us/picture" \ -H "Authorization: Bearer wsa_votre_cle_api"
r = requests.get("https://sendmako.com/api/groups/120363XXXXXXXXXX@g.us/picture",
headers={"Authorization": "Bearer wsa_votre_cle_api"})
print(r.json())
Réponse
{"success": true, "picture_url": "https://pps.whatsapp.net/v/..."}
/api/groups/{groupJid}/leaveQuitter le groupe
Quitter un groupe WhatsApp spécifique.
curl -X POST "https://sendmako.com/api/groups/120363XXXXXXXXXX%40g.us/leave" \
-H "Authorization: Bearer wsa_votre_cle_api" \
-H "Content-Type: application/json" \
-d '{}'
r = requests.post("https://sendmako.com/api/groups/120363XXXXXXXXXX@g.us/leave",
headers={"Authorization": "Bearer wsa_votre_cle_api"})
print(r.json())
Réponse
{"success": true}
Webhooks
Configuration & Vérification de signature
Configurez votre URL webhook depuis Tableau de bord → Webhooks. Sendmako envoie un POST HTTP signé à votre URL pour chaque événement.
Vérifier les signatures
Chaque requête inclut X-Sendmako-Signature: sha256=<hmac>. Vérifiez-la pour vous assurer que la requête est authentique et non falsifiée.
import hmac, hashlib
def verify_signature(payload_body: bytes, signature_header: str, secret: str) -> bool:
expected = "sha256=" + hmac.new(
secret.encode(), payload_body, hashlib.sha256
).hexdigest()
return hmac.compare_digest(expected, signature_header)
# Utilisation Django/Flask :
# sig = request.headers.get("X-Sendmako-Signature", "")
# if not verify_signature(request.body, sig, "votre_secret_webhook"):
# return HttpResponse(status=403)
const crypto = require('crypto');
function verifySignature(payload, signature, secret) {
const expected = 'sha256=' + crypto
.createHmac('sha256', secret)
.update(payload)
.digest('hex');
return crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(signature));
}
// Utilisation Express :
// app.post('/webhook', (req, res) => {
// const sig = req.headers['x-sendmako-signature'];
// if (!verifySignature(JSON.stringify(req.body), sig, 'votre_secret')) {
// return res.sendStatus(403);
// }
// });
function verifySignature(string $payload, string $signature, string $secret): bool {
$expected = 'sha256=' . hash_hmac('sha256', $payload, $secret);
return hash_equals($expected, $signature);
}
// Utilisation :
// $payload = file_get_contents('php://input');
// $sig = $_SERVER['HTTP_X_SENDMAKO_SIGNATURE'] ?? '';
// if (!verifySignature($payload, $sig, 'votre_secret_webhook')) {
// http_response_code(403); exit;
// }
Référence des événements webhook
Tous les événements utilisent la même enveloppe. L'objet data varie selon l'événement.
Enveloppe commune
{
"event": "message.received",
"timestamp": "2026-03-23T17:00:00Z",
"session_id": "user_1",
"data": { ... }
}
Déclenché quand un nouveau message entrant arrive sur votre numéro.
{
"event": "message.received",
"timestamp": "2026-03-23T17:00:00Z",
"session_id": "user_1",
"data": {
"message_id": "3EB043CFB548568C7532C1",
"from": "22241857975",
"sender_name": "Alassane Diallo",
"type": "conversation",
"body": "Bonjour !",
"timestamp": 1711209600,
// Pour les messages médias (imageMessage, videoMessage, audioMessage, documentMessage) :
"media": {
"url": "https://mmg.whatsapp.net/v/...",
"mimetype": "image/jpeg",
"mediaKey": "tE5cFixjaflyXbwRha8IdwovYHzrjAQ4mz16uhNcR6o=",
"fileEncSha256": "Dhg75NZE9fSYDm1P6ovnCs7bNXHzWgSbSRPq4Uj7CIc=",
"directPath": "/v/t62.7118-24/...",
"fileSize": "122866",
"width": 905,
"height": 1280,
"duration": 30
}
}
}
Déclenché quand un message envoyé est remis ou lu par le destinataire.
{
"event": "message.status",
"timestamp": "2026-03-23T17:01:00Z",
"session_id": "user_1",
"data": {
"message_id": "3EB043CFB548568C7532C1",
"to": "22241857975",
"status": "delivered" // "delivered" ou "read"
}
}
Déclenché quand un numéro WhatsApp se connecte avec succès après le scan QR.
{
"event": "session.connected",
"timestamp": "2026-03-23T17:00:00Z",
"session_id": "user_1",
"data": {
"phone_number": "22241857975"
}
}
Déclenché quand une session se déconnecte — par déconnexion manuelle ou perte de connexion.
{
"event": "session.disconnected",
"timestamp": "2026-03-23T17:05:00Z",
"session_id": "user_1",
"data": {
"reason": "logged_out" // "logged_out" ou "connection_lost"
}
}
