Envoyer message newsletter
curl --request POST \
--url https://api.wachap.com/v1/whatsapp/newsletters/send \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"accountId": "<string>",
"newsletterJid": "<string>",
"content": "<string>"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({accountId: '<string>', newsletterJid: '<string>', content: '<string>'})
};
fetch('https://api.wachap.com/v1/whatsapp/newsletters/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: '<string>', newsletterJid: '<string>', content: '<string>'})
};
fetch('https://api.wachap.com/v1/whatsapp/newsletters/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/newsletters/send"
payload = {
"accountId": "<string>",
"newsletterJid": "<string>",
"content": "<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/newsletters/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' => '<string>',
'newsletterJid' => '<string>',
'content' => '<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/newsletters/send"
payload := strings.NewReader("{\n \"accountId\": \"<string>\",\n \"newsletterJid\": \"<string>\",\n \"content\": \"<string>\"\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))
}Chaînes WhatsApp
Envoyer un message dans une chaîne
Publiez un message dans un canal WhatsApp
POST
/
whatsapp
/
newsletters
/
send
Envoyer message newsletter
curl --request POST \
--url https://api.wachap.com/v1/whatsapp/newsletters/send \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"accountId": "<string>",
"newsletterJid": "<string>",
"content": "<string>"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({accountId: '<string>', newsletterJid: '<string>', content: '<string>'})
};
fetch('https://api.wachap.com/v1/whatsapp/newsletters/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: '<string>', newsletterJid: '<string>', content: '<string>'})
};
fetch('https://api.wachap.com/v1/whatsapp/newsletters/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/newsletters/send"
payload = {
"accountId": "<string>",
"newsletterJid": "<string>",
"content": "<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/newsletters/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' => '<string>',
'newsletterJid' => '<string>',
'content' => '<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/newsletters/send"
payload := strings.NewReader("{\n \"accountId\": \"<string>\",\n \"newsletterJid\": \"<string>\",\n \"content\": \"<string>\"\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 canal (Newsletter)
Publiez un message dans un canal WhatsApp que vous gérez (Rôle OWNER ou ADMIN requis).Endpoint
Headers
string
requis
Bearer token avec votre Secret Key (format:
Bearer sk_...)Body Parameters
string
requis
L’identifiant du compte WhatsApp
string
requis
JID du canal (format:
xxxxx@newsletter)string
requis
Type de message:
text, image, video, documentstring
Contenu du message texte (Requis si type=
text)Exemples de requêtes
curl -X POST https://api.wachap.com/v1/whatsapp/newsletters/send \
-H "Content-Type: application/json" \
-H "Authorization: Bearer token" \
-d '{
"accountId": "a1233b-a1233b-a1233b-a1233b-a1233bcdjdg9878",
"newsletterJid": "120363123456789012@newsletter",
"type": "text",
"content": "🚀 Nouvelle mise à jour disponible !"
}'
Exemple de réponse
{
"success": true,
"messageId": "3EB0123456789ABCDEF",
"message": "Message publié avec succès"
}
Codes d’erreur
| Code | Description |
|---|---|
400 | MISSING_ACCOUNT_ID, MISSING_NEWSLETTER_JID |
401 | INVALID_SECRET_KEY - Clé secrète invalide |
403 | UNAUTHORIZED - Vous n’êtes pas admin/owner |
404 | NEWSLETTER_NOT_FOUND - Canal introuvable |
