LangageGuide · SDK officiel bientôt
Envoyez des SMS en Tunisie depuis PHP, sans dépendance.
L’extension cURL, présente sur presque tous les serveurs PHP, suffit pour appeler l’API Sendimo. Pas de framework imposé, pas de paquet à installer. Le SDK PHP officiel arrive.
Ce que ça fait
- Fonctionne en PHP natif, avec n’importe quel framework.
- Codes OTP, confirmations de commande, rappels de rendez-vous.
- Erreurs au format JSON avec un code stable (insufficient_balance, sender_not_approved…).
- Numéros locaux à 8 chiffres acceptés et convertis en +216.
Mise en place
- 1Vérifiez que l’extension cURL est active (php -m | grep curl).
- 2Ajoutez votre clé API dans la variable d’environnement SENDIMO_API_KEY.
- 3Envoyez un POST sur /v1/messages et vérifiez le code HTTP 202.
- 4Recevez les statuts de livraison par webhook.
<?php
$ch = curl_init('https://api.sendimo.tn/v1/messages');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 10,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('SENDIMO_API_KEY'),
'Content-Type: application/json',
'Idempotency-Key: order-4821-otp',
],
CURLOPT_POSTFIELDS => json_encode([
'to' => '+21620123456',
'from' => 'SENDIMO',
'text' => 'Votre code est 482913. Il expire dans 5 minutes.',
'reference' => 'order-4821',
]),
]);
$body = json_decode(curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE); // 202
curl_close($ch);
if ($status !== 202) {
throw new RuntimeException($body['error']['code'] . ': ' . $body['error']['message']);
}
echo $body['id']; // msg_01HF8Z3K9QX2{
"id": "msg_01HF8Z3K9QX2",
"status": "queued",
"to": "+21620123456",
"from": "SENDIMO",
"text": "Votre code est 482913. Il expire dans 5 minutes.",
"encoding": "GSM-7",
"segments": 1,
"network": "ooredoo",
"cost": { "amount": "0.140", "currency": "TND" },
"reference": "order-4821",
"scheduled_at": null,
"created_at": "2026-10-30T09:15:00Z"
}Et ensuite
Les autres intégrations
PythonLangage
Envoyez des SMS en Tunisie depuis Python avec l’API Sendimo.
Voir l’intégrationLaravelFramework PHP
Envoyez des SMS en Tunisie depuis Laravel avec le client HTTP intégré.
Voir l’intégrationJavaScript / Node.jsLangage
Envoyez des SMS en Tunisie depuis Node.js avec fetch.
Voir l’intégrationJavaLangage
Envoyez des SMS en Tunisie depuis Java, sans dépendance.
Voir l’intégrationSpring BootFramework Java
Envoyez des SMS en Tunisie depuis Spring Boot avec RestClient.
Voir l’intégrationGoLangage
Envoyez des SMS en Tunisie depuis Go avec net/http.
Voir l’intégration