L'API WatSell te permet d'intégrer ton agent WhatsApp dans tes propres outils : envoyer des messages, lire les conversations, gérer le catalogue et déclencher des livraisons, par programmation.
https://watsell.app/api/watsell/v1
Chaque requête doit inclure ta clé API dans l'en-tête X-API-Key. Génère ta clé dans l'app WatSell → Réglages → API développeur.
X-API-Key: wsk_live_xxxxxxxxxxxxxxxxxxxx
/healthVérifie ta clé et l'état de ta connexion WhatsApp.
curl https://watsell.app/api/watsell/v1/health \
-H "X-API-Key: $WATSELL_KEY"
# {"ok":true,"shop":"Ma Boutique","wa":"connected"}
/messagesEnvoie un message WhatsApp à un client depuis ton numéro connecté.
| Champ | Type | Description |
|---|---|---|
to | string | Numéro du destinataire (format international, ex 2376...) |
text | string | Le message (max 4000 caractères) |
curl -X POST https://watsell.app/api/watsell/v1/messages \
-H "X-API-Key: $WATSELL_KEY" \
-H "Content-Type: application/json" \
-d '{"to":"237699000000","text":"Bonjour, votre commande est prete !"}'
# {"ok":true,"to":"237699000000"}
/conversationsListe tes conversations (numéro, dernier message, état de l'agent).
curl https://watsell.app/api/watsell/v1/conversations \
-H "X-API-Key: $WATSELL_KEY"
/conversation?phone=2376...Récupère l'historique complet d'une conversation avec un client.
curl "https://watsell.app/api/watsell/v1/conversation?phone=237699000000" \
-H "X-API-Key: $WATSELL_KEY"
/catalogListe tes produits (nom, prix, description, lien de paiement).
curl https://watsell.app/api/watsell/v1/catalog \
-H "X-API-Key: $WATSELL_KEY"
/ordersCrée une commande. Produit numérique = lien envoyé automatiquement. Produit physique = confirmation client puis flux livreur (COD).
curl -X POST https://watsell.app/api/watsell/v1/orders \
-H "X-API-Key: $WATSELL_KEY" \
-H "Content-Type: application/json" \
-d '{"product":"Sac cuir","kind":"physical","amount":"25000 FCFA",
"address":"Bonamoussadi","clientName":"Awa","clientPhone":"237699000000"}'
/ordersListe tes commandes et leur état (awaiting_confirm, searching, delivered, received, cancelled...).
curl https://watsell.app/api/watsell/v1/orders \
-H "X-API-Key: $WATSELL_KEY"
Configure une URL de webhook dans l'app (Réglages → API). WatSell y enverra un POST JSON à chaque événement.
| Événement | Déclencheur |
|---|---|
message.received | Un client t'envoie un message |
order.created | Une commande est créée |
POST https://ton-serveur.com/webhook
X-WatSell-Event: message.received
{
"event": "message.received",
"at": 1787900000000,
"shop": "Ma Boutique",
"data": { "from": "237699000000", "text": "Bonjour, c'est dispo ?" }
}
| Code | Signification |
|---|---|
200 | Succès |
400 | Requête invalide (champ manquant, WhatsApp non connecté) |
401 | Clé API invalide ou manquante |
404 | Endpoint inconnu |