Envoyer plusieurs messages
curl --request POST \
--url https://api.wachap.com/v1/whatsapp/messages/send-batch \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"messages": [
{
"accountId": "account_123",
"to": "+2290100000000",
"type": "text",
"content": "Confirmez-vous votre présence ?",
"buttons": [
{
"id": "yes",
"text": "Oui",
"type": "reply"
},
{
"id": "no",
"text": "Non",
"type": "reply"
}
]
}
]
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
messages: [
{
accountId: 'account_123',
to: '+2290100000000',
type: 'text',
content: 'Confirmez-vous votre présence ?',
buttons: [
{id: 'yes', text: 'Oui', type: 'reply'},
{id: 'no', text: 'Non', type: 'reply'}
]
}
]
})
};
fetch('https://api.wachap.com/v1/whatsapp/messages/send-batch', 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({
messages: [
{
accountId: 'account_123',
to: '+2290100000000',
type: 'text',
content: 'Confirmez-vous votre présence ?',
buttons: [
{id: 'yes', text: 'Oui', type: 'reply'},
{id: 'no', text: 'Non', type: 'reply'}
]
}
]
})
};
fetch('https://api.wachap.com/v1/whatsapp/messages/send-batch', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.wachap.com/v1/whatsapp/messages/send-batch"
payload = { "messages": [
{
"accountId": "account_123",
"to": "+2290100000000",
"type": "text",
"content": "Confirmez-vous votre présence ?",
"buttons": [
{
"id": "yes",
"text": "Oui",
"type": "reply"
},
{
"id": "no",
"text": "Non",
"type": "reply"
}
]
}
] }
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/messages/send-batch",
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([
'messages' => [
[
'accountId' => 'account_123',
'to' => '+2290100000000',
'type' => 'text',
'content' => 'Confirmez-vous votre présence ?',
'buttons' => [
[
'id' => 'yes',
'text' => 'Oui',
'type' => 'reply'
],
[
'id' => 'no',
'text' => 'Non',
'type' => 'reply'
]
]
]
]
]),
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/messages/send-batch"
payload := strings.NewReader("{\n \"messages\": [\n {\n \"accountId\": \"account_123\",\n \"to\": \"+2290100000000\",\n \"type\": \"text\",\n \"content\": \"Confirmez-vous votre présence ?\",\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 }\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))
}Messages WhatsApp
Envoyer plusieurs messages
Envoyez jusqu’à 100 messages WhatsApp dans une même requête
POST
/
whatsapp
/
messages
/
send-batch
Envoyer plusieurs messages
curl --request POST \
--url https://api.wachap.com/v1/whatsapp/messages/send-batch \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"messages": [
{
"accountId": "account_123",
"to": "+2290100000000",
"type": "text",
"content": "Confirmez-vous votre présence ?",
"buttons": [
{
"id": "yes",
"text": "Oui",
"type": "reply"
},
{
"id": "no",
"text": "Non",
"type": "reply"
}
]
}
]
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
messages: [
{
accountId: 'account_123',
to: '+2290100000000',
type: 'text',
content: 'Confirmez-vous votre présence ?',
buttons: [
{id: 'yes', text: 'Oui', type: 'reply'},
{id: 'no', text: 'Non', type: 'reply'}
]
}
]
})
};
fetch('https://api.wachap.com/v1/whatsapp/messages/send-batch', 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({
messages: [
{
accountId: 'account_123',
to: '+2290100000000',
type: 'text',
content: 'Confirmez-vous votre présence ?',
buttons: [
{id: 'yes', text: 'Oui', type: 'reply'},
{id: 'no', text: 'Non', type: 'reply'}
]
}
]
})
};
fetch('https://api.wachap.com/v1/whatsapp/messages/send-batch', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.wachap.com/v1/whatsapp/messages/send-batch"
payload = { "messages": [
{
"accountId": "account_123",
"to": "+2290100000000",
"type": "text",
"content": "Confirmez-vous votre présence ?",
"buttons": [
{
"id": "yes",
"text": "Oui",
"type": "reply"
},
{
"id": "no",
"text": "Non",
"type": "reply"
}
]
}
] }
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/messages/send-batch",
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([
'messages' => [
[
'accountId' => 'account_123',
'to' => '+2290100000000',
'type' => 'text',
'content' => 'Confirmez-vous votre présence ?',
'buttons' => [
[
'id' => 'yes',
'text' => 'Oui',
'type' => 'reply'
],
[
'id' => 'no',
'text' => 'Non',
'type' => 'reply'
]
]
]
]
]),
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/messages/send-batch"
payload := strings.NewReader("{\n \"messages\": [\n {\n \"accountId\": \"account_123\",\n \"to\": \"+2290100000000\",\n \"type\": \"text\",\n \"content\": \"Confirmez-vous votre présence ?\",\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 }\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))
}Endpoint
/v1/whatsapp/messages/send-batch
Tableau de 1 à 100 messages. Chaque entrée utilise la même structure que l’objet
data de l’endpoint d’envoi individuel.text, image, video et document.
Exemple
curl -X POST https://api.wachap.com/v1/whatsapp/messages/send-batch \
-H "Authorization: Bearer token" \
-H "Content-Type: application/json" \
-d '{
"messages": [
{
"accountId": "account_123",
"to": "+2290100000000",
"type": "text",
"content": "Confirmez-vous votre présence ?",
"buttons": [
{"id": "yes", "text": "Oui", "type": "reply"},
{"id": "no", "text": "Non", "type": "reply"}
]
},
{
"accountId": "account_123",
"to": "+2290199999999",
"type": "image",
"imageUrl": "https://example.com/invitation.jpg",
"caption": "Voici votre invitation",
"buttons": [
{"id": "details", "text": "Voir les détails", "type": "url", "url": "https://example.com/evenement"}
],
"footerText": "Événement WaChap"
}
]
}'
La limite est de 100 messages par requête. Les règles de Boutons interactifs s’appliquent séparément à chaque entrée.
⌘I
