Référence · API v1

Documentation API

Guide complet pour intégrer WhatsApp via Whazora.

Avant de commencer

1

Abonnement actif

2

Créer un canal

3

Connecter WhatsApp

4

Générer la clé API

5

Webhooks (optionnel)

URL de l'API

GET https://whazora.com/api/v1/health

POST https://whazora.com/api/v1/messages

POST https://whazora.com/api/v1/media

Authentification

Exemple

Authorization: Bearer whz_live_VOTRE_CLE_ICI

Paramètre channel

Envoyer des messages

Contrôle de disponibilité

Exemple

curl -sS "https://whazora.com/api/v1/health"

Message texte

Champ Obligatoire Description
channeloui
tooui
typeouitext
text.bodyoui

Exemple

curl -sS -X POST "https://whazora.com/api/v1/messages" \
  -H "Authorization: Bearer whz_live_VOTRE_CLE" \
  -H "Content-Type: application/json" \
  -d '{
  "channel": "oaza",
  "to": "243971106771",
  "type": "text",
  "text": { "body": "Bonjour, merci pour votre commande." }
}'

Image

typeouiimage
image.idid ou link
image.linkid ou link
image.captionnon

Exemple

{
  "channel": "oaza",
  "to": "243971106771",
  "type": "image",
  "image": {
    "id": "MEDIA_ID_APRES_UPLOAD",
    "caption": "Photo du produit"
  }
}

Vidéo

typeouivideo
video.idid ou link
video.linkid ou link
video.captionnon

Exemple

{
  "channel": "oaza",
  "to": "243971106771",
  "type": "video",
  "video": { "id": "MEDIA_ID", "caption": "Démonstration" }
}

Audio

typeouiaudio
audio.idoui

Exemple

{
  "channel": "oaza",
  "to": "243971106771",
  "type": "audio",
  "audio": { "id": "MEDIA_ID" }
}

Sticker

typeouisticker
sticker.idoui

Exemple

{
  "channel": "oaza",
  "to": "243971106771",
  "type": "sticker",
  "sticker": { "id": "MEDIA_ID_STICKER" }
}

Réaction

typeouireaction
reaction.message_idoui
reaction.emojioui*

Exemple

{
  "channel": "oaza",
  "to": "243971106771",
  "type": "reaction",
  "reaction": {
    "message_id": "wamid.HBgLMjQzOTcxMTA2NzcxFQIAERgUM0VBN0QyQ0E4NkM1MzJCMzAA",
    "emoji": "👍"
  }
}

Téléverser un fichier

Exemple

curl -sS -X POST "https://whazora.com/api/v1/media" \
  -H "Authorization: Bearer whz_live_VOTRE_CLE" \
  -F "channel=oaza" \
  -F "type=image/jpeg" \
  -F "file=@./photo.jpg"

Recevoir des messages (webhooks)

Exemple — corps reçu sur votre webhook

{
  "object": "whatsapp_business_account",
  "channel": "oaza",
  "channel_id": "identifiant-interne",
  "field": "messages",
  "value": {
    "messages": [{
      "from": "243971106771",
      "id": "wamid.xxx",
      "type": "text",
      "text": { "body": "Bonjour" }
    }]
  }
}

Crédits

Limites

Codes d'erreur

Code HTTP Que faire
invalid_api_key401
channel_not_found404
whatsapp_not_connected409
channel_not_configured503
insufficient_credits402
subscription_required402
graph_send_failed5xx
rate_limit_exceeded429
channel_required400
to_required400
invalid_message_type400
test_key_no_send403
insufficient_scope403
invalid_json400
not_found404