Skip to content

Use Cases

SMS notifications playbook

Turn payment and payout events into SMS messages without duplicates, and watch delivery and balance.

The playbook in one page

Customers want to know what happened: payment received, order shipped, payout sent, invoice due. Moolre sends SMS for you. This playbook turns the events your system already knows about into messages you can trust, without sending duplicates or blowing the balance.

EventTriggerMessage
Payment receivedpayment.succeeded callback or webhookThank you, we received GHS 120.00 for order 1001
Payment failedpayment.failed callback or webhookYour payment did not go through: wrong PIN. Try again
Payout sentpayout.succeeded webhookGHS 85.00 was sent to your MoMo number
Invoice due soonYour scheduler + List invoicesFees of GHS 450.00 are due on 31 Dec: pay at the link
One-time passcodes of your own appYour login flowYour code is 123456

Step by step

  1. Get an approved Sender ID (Create Sender ID, then Sender ID Status) and the SMS X-API-VASKEY. Check the balance with SMS Account Status.
  2. Decide the messages and keep each under 160 GSM characters where you can (the SMS counter shows how many segments a text uses). Avoid characters outside the GSM set unless you need them.
  3. Receive the events: callbacks for payments, and webhooks (webhook 1 and webhook_url on the wallet) for payouts. In your handler, after the signature check and the event_id dedupe, create one message record per transaction instead of sending straight away: ref = the event and the transaction id (for example sms-payout.succeeded-10000001), recipient, text. A webhook can list several transactions in data.hooks.
  4. A sender job reads unsent records and calls Send SMS with their refs. Because the ref is derived from the transaction, a retried callback or webhook cannot create a second message.
  5. Mark records sent when the call is accepted. Later ask SMS Status with the refs to learn delivery, and mark delivered or failed.
  6. Retry only failed messages, with a new ref ("-r1"), and cap retries.
  7. Watch the balance: alert when it is below what a day's traffic needs, and pause marketing sends before transactional ones.

curl https://api.moolre.com/open/sms/send \  -H "Content-Type: application/json" \  -H "X-API-VASKEY: $MOOLRE_SMS_VASKEY" \  -d '{    "type": 1,    "senderid": "Acme",    "messages": [      { "recipient": "0240000001", "message": "Thank you. We received GHS 120.00 for order 1001.", "ref": "sms-payment.succeeded-10000001" }    ]  }'

Edge cases

SituationWhat to do
The event is delivered twiceThe message ref comes from the transaction, so you send one message
The customer has no phone number on fileSkip SMS and use your in-app or email receipt; do not guess numbers
The Sender ID is not approvedThe send returns ASMS07. Fix the approval before launch
The balance runs outSends fail. Alert early and top up; queue the messages instead of dropping them
A message is longIt uses several segments and costs more. Shorten it
The recipient opted out of marketingDo not send marketing; transactional messages about their own payment are fine

Checklist

  • Messages are queued from verified, deduped events, never sent inline from a callback or webhook.
  • Every message ref is unique and derived from the event and transaction so a retry cannot duplicate it.
  • You track delivery with SMS Status and retry only failures.
  • The Sender ID is approved and the balance is monitored.
  • No secrets or unnecessary personal data are in a message.