Introduction à l'API toKABOLA
L’API toKABOLA est une plateforme panafricaine permettant d’intégrer facilement WhatsApp Business dans vos applications, sans passer directement par les contraintes techniques de Meta Platforms.
Elle permet notamment de :
- ✅ Gérer des comptes API
- ✅ Connecter des numéros WhatsApp
- ✅ Envoyer des messages (texte, média, OTP, marketing)
- ✅ Recevoir des événements via webhook
- ✅ Gérer la facturation et les recharges
Cas d’utilisation
toKABOLA est conçue pour :
- ✅ SaaS (CRM, ERP, bots WhatsApp)
- ✅ Plateformes marketing
- ✅ Services financiers (OTP, notifications)
- ✅ Startups africaines utilisant Mobile Money
Architecture générale
Client (App / Backend)
↓
API toKABOLA
↓
WhatsApp (via Meta)
↓
Utilisateur final
Authentification
Toutes les requêtes sécurisées utilisent un Bearer Token.
🔑 Obtention du token
1. Créer un compte
2. Générer un token avec :
◦ id_user
◦ key_user
# Header requis
Authorization: Bearer VOTRE_TOKEN
Cycle de vie d’intégration
1. Création du compte
→ Permet d’obtenir :
• id_user
• key_user
curl --location 'https://api.tokabola.com/v1/' \
--header 'Content-Type: application/json' \
--data '{
"type": "signup",
"signup": {
"name": "NOM_APPLICATION_ICI",
"description": "VOTRE_DESCRIPTION_ICI",
"logourl": "https://www.votredomaine.com/img/logo.png",
"webhook": "https://www.votredomaine.com/webhook/"
}
}'
Webhooks
Les webhooks permettent de recevoir automatiquement le message de vos clients depuis WhatsApp. toKABOLA envoi les données en utilisant la méthode GET :
• Type de message (TEXT, IMAGE, VIDEO, AUDIO, DOCUMENT, ACTION SUR BOUTON, Etc...)
• Numéro de téléphone de l'expéditeur du message
• Votre ID de numéro de téléphone WhatsApp
• L'ID du message reçus.
Exemple d’événement :
{
"action_type": "text",
"tel_user": "243XXXXXXXXX",
"message": "Salut le monde",
"phone_number_id": "12XXXXXXXXXXXXXXX",
"message_id": "wamid.HBgMMjQzXXXXXXXXXXXXXXX"
}
2. Génération du token
→ Accès sécurisé à l’API pour chaque session ou requête.
curl --location 'https://api.tokabola.com/v1/' \
--header 'Content-Type: application/json' \
--data '{
"type": "token",
"token": {
"id_user": "14XXXXX",
"key_user": "1-874afXXX-XXXX-XXXX-XXXX-XXXXXXXX"
}
}'
3. Mises à jour infos compte
→ Modifiez les informations d'un compte.
curl --location 'https://api.tokabola.com/v1/' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer VOTRE_TOKEN_ICI' \
--data '{
"type": "update",
"update": {
"account": "infos"
},
"infos": {
"name": "NOM_APPLICATION_ICI",
"description": "VOTRE_DESCRIPTION_ICI",
"logourl": "https://www.votredomaine.com/img/logo.png",
"webhook": "https://www.votredomaine.com/goto/ws/"
}
}'
4. Abonnement/Réabonnement pour le compte créé
→ Vous pouvez changer votre type d'abonnement à tout moment comme bon vous semble. Par défaut à la création d'un nouveau compte, toKABOLA propose 3 jours des sessions gratuites pour vous aidez à tester facilement sans payer un frais.
curl --location 'https://api.tokabola.com/v1/' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer VOTRE_TOKEN_ICI' \
--data '{
"type": "update",
"update": {
"account": "renew"
},
"renew": {
"auto_pay": true,
"type": "GOLD"
}
}'
5. Ajout ou associer un numéro WhatsApp
→ Si vous avez besoin d'associer votre numéro qu'utilise déjà WhatsApp Business, vous pouvez l'associer depuis l'interface META en ajoutant votre ID user à la fin (Supporte uniquement le type d'abonnement OWNER).
https://api.tokabola.com/goto/addnumber/?id_user={{VOTRE_ID_USER_ICI}}
Par contre si vous pensez utiliser un nouveau numéro, vous pouvez procéder via l'API ci-après (Supporte tous types d'abonnement et n'oubliez pas de garder votre phone_number_id) :
curl --location 'https://api.tokabola.com/v1/' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer VOTRE_TOKEN_ICI' \
--data '{
"type": "add",
"add": {
"cc": "243",
"phone_number": "81XXXXXXX",
"phone_name": "NOM_SERVICE_ICI",
"language": "fr_FR"
}
}'
6. Vérification OTP
→ Activation du numéro : Une fois le numéro ajouté en utilisant l'API, vous devez demander le code et l'activer pour qu'il soit opérationnel.
curl --location 'https://api.tokabola.com/v1/' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer VOTRE_TOKEN_ICI' \
--data '{
"type": "number",
"number": {
"method": "ask_code",
"phone_number_id": "VOTRE_ID_PHONE_NUMBER_ICI",
"otp_type": "SMS", //SMS, VOICE
"language": "fr_FR"
}
}'
ACTIVER LE NUMERO AVEC LE CODE RECUS :
curl --location 'https://api.tokabola.com/v1/' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer VOTRE_TOKEN_ICI' \
--data '{
"type": "number",
"number": {
"method": "verify",
"phone_number_id": "VOTRE_ID_PHONE_NUMBER_ICI",
"otp_code": "LE_CODE_RECUS_ICI"
}
}'
7. Mises à jour des informations sur le numéro activé
→ Maintenant vous pouvez mettre à jour les informations de votre numéro pour qu'elles soient lisibles par les utilisateurs :
curl --location 'https://api.tokabola.com/v1/' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer VOTRE_TOKEN_ICI' \
--data '{
"type": "update",
"update": {
"account": "number"
},
"number": {
"phone_number_id": "VOTRE_ID_PHONE_NUMBER_ICI",
"about": "APROPOS_DU_NUMERO_ICI",
"address": "ADRESSE_DU_NUMERO_ICI",
"description": "LA_DESCRIPTION_DU_NUMERO_ICI",
"websites": "https://www.votredomaine.com",
"email": "contact@votredomaine.com",
"logo": "https://www.votredomaine.com/img/logo_big.png",
"language": "fr_FR"
}
}'
Types des messages supportés
⚙️ Structure des requêtes
Toutes les requêtes respectent ce format :
{
"type": "ACTION",
"ACTION_NAME": {}
}
Exemple :
Envoyer un message WhatsApp (texte, image, vidéo, document, audio)
Paramètres requis
| Champ |
Type |
Description |
to |
string |
Numéro de téléphone au format international (243...) |
method |
string |
Utilisez les méthodes : text, image, video, document, audio |
server |
string |
Si vous n'avez pas encore un numéro pour tester, vous pouvez utiliser ce champ pour SANDBOX. En outre, vous n'etes pas obliger de le definir comme paramètres (A supprimer). |
preview_url |
string |
Utilisez : true ou false si vous voulez afficher ou désactiver les contenus HEADER de votre URL depuis le paramètre body. |
body |
string |
Contenu du message texte (si type=text) |
1. Message texte
• Notifications simples
• Support client
curl --location 'https://api.tokabola.com/v1/' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer VOTRE_TOKEN_ICI' \
--data '{
"type": "assistance",
"assistance": {
"method": "text",
"server": "SANDBOX",
"to": "243XXXXXXXXX",
"preview_url": true,
"body": "Salut le monde"
}
}'
2. Média
• Image
• Vidéo
• Audio
curl --location 'https://api.tokabola.com/v1/' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer VOTRE_TOKEN_ICI' \
--data '{
"type": "assistance",
"assistance": {
"method": "image", //image, video, audio
"server": "SANDBOX",
"to": "243XXXXXXXXX",
"image_url": "https://www.votredomaine.com/img/logo_big.png",
"caption": "Mon image"
}
}'
3. Documents
• Pdf
• Docx
• AUtres...
curl --location 'https://api.tokabola.com/v1/' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer VOTRE_TOKEN_ICI' \
--data '{
"type": "assistance",
"assistance": {
"method": "docs",
"server": "SANDBOX",
"to": "243XXXXXXXXX",
"doc_url": "https://www.votredomaine.com/img/document.pdf",
"caption": "Mon document"
}
}'
4. Authentification (OTP)
• Codes de vérification
• Sécurité utilisateur
curl --location 'https://api.tokabola.com/v1/' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer VOTRE_TOKEN_ICI' \
--data '{
"type": "auth",
"auth": {
"method": "otp",
"to": "243XXXXXXXXX",
"otp_code": "LE_CODE_A_ENVOYER_ICI",
"language": "fr"
}
}'
5. Marketing
• Promotions
• Campagnes
6. Utilitaire
• Partage des données utilisateurs
Gestion Compte
Chaque compte qu'utilise le type d'abonnement STANDARD, GOLD, et OWNER devez etre recharger afin d'autoriser n'importe quelle action payante.
Recharger son compte
curl --location 'https://api.tokabola.com/v1/' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer VOTRE_TOKEN_ICI' \
--data '{
"type": "addfund",
"addfund": {
"from": "243XXXXXXXXX",
"amount": "25000",
"currency": "CDF"
}
}'
Confirmer la recharge
Vous devez confirmer votre depot (Recharge) mobile money en premier depuis votre téléphone avant d'utiliser ce point.
curl --location 'https://api.tokabola.com/v1/' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer VOTRE_TOKEN_ICI' \
--data '{
"type": "verify",
"verify": {
"deposit_id": "b75bXXXX-XXX-XXX-XXX-XXXXXXXXXX"
}
}'
Vérifier le solde
Vous pouvez vérifier le solde de votre compte à tout moment.
curl --location 'https://api.tokabola.com/v1/' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer VOTRE_TOKEN_ICI' \
--data '{"type": "solde"}'
Informations du compte
Afficher toutes les informations d’un compte. Chaque paramètre défini via l’API renvoie une information précise. Vous pouvez omettre certains paramètres ou tous les conserver selon votre convenance.
curl --location 'https://api.tokabola.com/v1/' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer VOTRE_TOKEN_ICI' \
--data '{
"type": "account",
"account": {
"name_user": "?",
"desc_user": "?",
"logo_url": "?",
"webhook_url": "?",
"id_user": "?",
"key_user": "?",
"date_user": "?",
"time_user": "?",
"autorisation": "?",
"type_abonnement": "?",
"date_expiration": "?",
"time_expiration": "?"
}
}'
Gestion des erreurs
L'API retourne des codes d'erreur standards avec des messages détaillés.
| Code |
Signification |
Solution |
1001 |
BAD_REQUEST |
Création de compte impossible. Certaines informations manquantes. |
1002 |
UNAUTHORIZED |
Création de compte impossible. Nom du compte existant. |
1004 |
NOT_FOUND |
L'ID ou la clé d'autorisation n'existe pas. |
404 |
FORBIDDEN |
Ressource introuvable |
500 |
SERVER_ERROR |
Contactez le support si le problème persiste |
{
"status": "error",
"message": "L'ID ou la clé d'autorisation n'existe pas.",
"code": 1004
}
Structure des réponses
✅ Succès
{
"status": "success",
"message": "Opération réussie",
"data": {}
}
❌ Erreur
{
"status": "error",
"message": "Description de l'erreur",
"code": 1001
}
SDKs & Librairies
Utilisez nos SDK officiels pour intégrer plus rapidement toKABOLA API à votre projet.
🟨
JavaScript/Node.js
SDK officiel pour Node.js et navigateurs
npm install tokabola-api
Documentation →
🐍
Python
Bibliothèque Python complète
pip install tokabola-api
Documentation →
🐘
PHP
Client PHP via Composer
composer require tokabola-api
Documentation →
📚 Documentation complète
Consultez notre documentation complète pour des guides détaillés, tutoriels et exemples de code.