SDK mobiles (React Native / Flutter)

Installez les packages mobiles Notif pour envoyer des messages, planifier des relances, vérifier un statut, lire les logs et suivre votre solde depuis vos apps internes.

React Native

Install
npm i notifml-react-native
TypeScript
import { createNotifClient } from "notifml-react-native";

const notif = createNotifClient({ apiKey: "ntf_live_xxx" });

await notif.send({
  to: "+22370000000",
  channel: "whatsapp",
  message: "Votre commande est prete.",
});

await notif.schedule(
  {
    to: "+22370000000",
    channel: "whatsapp",
    message: "Relance client",
  },
  "2026-05-06T18:30:00.000Z",
);

await notif.balance();
await notif.status("ntf_msg_xxx");

Flutter

Install
flutter pub add notifml_flutter
Dart
import 'package:notifml_flutter/notifml_flutter.dart';

final notif = NotifClient(apiKey: 'ntf_live_xxx');

final result = await notif.send(
  const NotifSendRequest(
    to: '+22370000000',
    channel: 'whatsapp',
    message: 'Votre commande est prete.',
  ),
);

await notif.schedule(
  const NotifSendRequest(
    to: '+22370000000',
    channel: 'whatsapp',
    message: 'Relance client',
  ),
  '2026-05-06T18:30:00.000Z',
);

await notif.balance();
await notif.status('ntf_msg_xxx');
notif.close();

Email

TypeScript — email avec HTML
await notif.send({
  to: "client@example.com",
  channel: "email",
  subject: "Votre recu",
  message: "Merci pour votre achat.",
  html: "<h1>Merci !</h1><p>Votre commande est confirmee.</p>",
});

Auto routing

TypeScript — routage automatique
await notif.send({
  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
// Agregats (par statut, par canal, aujourd'hui)
const analytics = await notif.analytics({ sample: 200 });
// analytics.analytics.byChannel -> { whatsapp: 120, sms: 30, email: 50 }

// Historique des messages
const logs = await notif.logs({ limit: 50 });
// 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.