curl --request POST \
--url https://api.wachap.com/v1/whatsapp/messages/send \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"data": {
"accountId": "a1233b-a1233b-a1233b-a1233b-a1233bcdjdg9878",
"to": "+33612345678",
"type": "text",
"content": "Souhaitez-vous confirmer ?",
"buttons": [
{
"id": "yes",
"text": "Oui",
"type": "reply"
},
{
"id": "website",
"text": "Voir le site",
"type": "url",
"url": "https://wachap.com"
}
],
"footerText": "WaChap"
}
}
'Messages WhatsApp
Envoyer une localisation
Envoyez une position géographique (GPS) à un contact WhatsApp
POST
/
whatsapp
/
messages
/
send
curl --request POST \
--url https://api.wachap.com/v1/whatsapp/messages/send \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"data": {
"accountId": "a1233b-a1233b-a1233b-a1233b-a1233bcdjdg9878",
"to": "+33612345678",
"type": "text",
"content": "Souhaitez-vous confirmer ?",
"buttons": [
{
"id": "yes",
"text": "Oui",
"type": "reply"
},
{
"id": "website",
"text": "Voir le site",
"type": "url",
"url": "https://wachap.com"
}
],
"footerText": "WaChap"
}
}
'Endpoint
Headers
string
requis
Bearer token avec votre Secret Key (format:
Bearer sk_...)Body Parameters
string
requis
ID du compte WhatsApp
string
requis
Numéro destinataire
string
requis
Doit être “location”
number
requis
Latitude (ex: 48.8566)
number
requis
Longitude (ex: 2.3522)
string
Nom du lieu
string
Adresse du lieu
NoteLes coordonnées doivent être valides :
- Latitude: -90 à 90
- Longitude: -180 à 180
Exemples de requêtes
curl -X POST https://api.wachap.com/v1/whatsapp/messages/send \
-H "Content-Type: application/json" \
-H "Authorization: Bearer token" \
-d '{
"data": {
"accountId": "account_123",
"to": "+33612345678",
"type": "location",
"latitude": 48.8566,
"longitude": 2.3522,
"name": "Tour Eiffel",
"address": "Champ de Mars, 5 Avenue Anatole France, 75007 Paris"
}
}'
const response = await fetch('https://api.wachap.com/v1/whatsapp/messages/send', {
method: 'POST',
headers: {
'Authorization': 'Bearer token',
'Content-Type': 'application/json'
},
body: JSON.stringify({
data: {
accountId: 'account_123',
to: '+33612345678',
type: 'location',
latitude: 48.8566,
longitude: 2.3522,
name: 'Tour Eiffel',
address: 'Champ de Mars, 5 Avenue Anatole France, 75007 Paris'
}
})
});
const data = await response.json();
console.log(data);
import requests
url = "https://api.wachap.com/v1/whatsapp/messages/send"
headers = {
"Authorization": "Bearer token",
"Content-Type": "application/json"
}
payload = {
"data": {
"accountId": "account_123",
"to": "+33612345678",
"type": "location",
"latitude": 48.8566,
"longitude": 2.3522,
"name": "Tour Eiffel",
"address": "Champ de Mars, 5 Avenue Anatole France, 75007 Paris"
}
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
<?php
$curl = curl_init();
$payload = [
"data" => [
"accountId" => "account_123",
"to" => "+33612345678",
"type" => "location",
"latitude" => 48.8566,
"longitude" => 2.3522,
"name" => "Tour Eiffel",
"address" => "Champ de Mars, 5 Avenue Anatole France, 75007 Paris"
]
];
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.wachap.com/v1/whatsapp/messages/send",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode($payload),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer token",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
?>
