SDK mobiles (React Native / Flutter)
Il n'y a pas encore de package npm/pub dédié : utilisez l'API HTTP POST /api/send avec votre clé ntf_live_*.
React Native
TypeScript
await fetch("https://api.notif.ml/api/send", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-Key": NOTIF_KEY,
},
body: JSON.stringify({
to: "+22370000000",
channel: "whatsapp",
message: "Hello",
}),
});Flutter
Dart
final res = await http.post(
Uri.parse('$baseUrl/api/send'),
headers: {
'Content-Type': 'application/json',
'X-API-Key': notifKey,
},
body: jsonEncode({
'to': '+22370000000',
'channel': 'whatsapp',
'message': 'Hello',
}),
);TypeScript — email avec HTML
await fetch("https://api.notif.ml/api/send", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-Key": NOTIF_KEY,
},
body: JSON.stringify({
to: "client@example.com",
channel: "email",
subject: "Votre reçu",
message: "Merci pour votre achat.",
html: "<h1>Merci !</h1><p>Votre commande est confirmée.</p>",
}),
});Auto routing
TypeScript — routage automatique
await fetch("https://api.notif.ml/api/send", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-Key": NOTIF_KEY,
},
body: JSON.stringify({
to: "+22370000000",
channel: "auto",
message: "Votre colis est en route !",
}),
});Le canal auto route via WhatsApp → SMS → email selon la disponibilité du destinataire.
Analytics & Logs
TypeScript — analytics + logs
// Agrégats (par statut, par canal, aujourd'hui)
const analytics = await fetch("https://api.notif.ml/api/notif-analytics?sample=200", {
headers: { "X-API-Key": NOTIF_KEY },
}).then(r => r.json());
// analytics.analytics.byChannel → { whatsapp: 120, sms: 30, email: 50 }
// Historique des messages
const logs = await fetch("https://api.notif.ml/api/notif-logs?limit=50", {
headers: { "X-API-Key": NOTIF_KEY },
}).then(r => r.json());
// logs.messages → [{ to, channel, status, content, _creationTime }, ...]Bonnes pratiques
•
Ne stockez pas la clé en dur : utilisez expo-secure-store (React Native) ou flutter_secure_storage (Flutter).
•
Gérez les erreurs 429 (quota) et les retries avec backoff exponentiel.
•
Pour les tests : sandbox: true ou clé ntf_test_*.
Voir la documentation API complète pour tous les paramètres et exemples, ou le guide billing pour les crédits FCFA.