Moolre Documentation

Step-by-step guides

SMS and WhatsApp, step by step

Send and track SMS and WhatsApp messages with VAS keys, Sender IDs and templates, and avoid duplicates and surprises.

SMS and WhatsApp in one picture

SMS and WhatsApp use their own credential: an X-API-VASKEY. SMS and WhatsApp each have a separate key, created for that service in the Moolre app. They need no X-API-USER or X-API-KEY.

Both are asynchronous: the API accepts your message, and delivery happens afterwards. You track delivery with a status call, using the reference you gave each message.

SMSWhatsApp
CredentialSMS X-API-VASKEYWhatsApp X-API-VASKEY
Before you sendAn approved Sender IDAn approved template
SendSend SMS (POST, or GET for one message)Send Message with a template and placeholders
TrackSMS Status by refMessage Status by ref
BalanceSMS Account StatusIncluded messages shown in the app

Step by step: send an SMS

  1. Create a Sender ID in the app or with Create Sender ID, and wait until it is approved. Check it with Sender ID Status or List Sender IDs. Read the Sender ID guidelines first: up to 11 characters, and it must identify you.
  2. Check your SMS balance with SMS Account Status, so a campaign does not stop half way.
  3. Count the message length (the character counter shows segments): a message over 160 GSM characters, or any message with a non-GSM character, uses more than one segment.
  4. Send Send SMS with type 1, your senderid and a messages list. Each message has a recipient, the message text and a ref that you choose and keep unique.
  5. Read the reply. Store the refs. A successful call means the messages were accepted, not delivered.
  6. Later, ask SMS Status with the refs (type 5, ref as a list) to see delivery, and retry only the ones that failed with a new ref.
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": "Your order ORDER-1001 is ready for pickup.",        "ref": "sms-order-1001"      }    ]  }'

SMS rules that save you money

  • Use one ref per message and make it traceable to your own record, for example sms-order-1001.
  • Send each batch in chunks and watch the balance. Do not send the same ref twice: duplicates are your problem to detect.
  • Do not put API keys, one-time codes of other services or personal data you do not need in a message.
  • Respect opt-outs: send marketing only to people who agreed.

Step by step: send a WhatsApp message

  1. Set up your WhatsApp service in the app (the WhatsApp guide walks through the business verification). Generate the WhatsApp X-API-VASKEY.
  2. Fetch your approved templates with Get Templates. Page through them with next if there are many.
  3. Pick a template by its name and language, and note how many placeholders it has.
  4. Send Send Message with template_name, language and a messages list. Each message has a recipient (international format), a ref and the placeholders values in order.
  5. Track each message with Message Status and its ref.
{  "template_name": "order_update",  "language": "en",  "messages": [    {      "recipient": "233240000001",      "ref": "wa-order-1001",      "placeholders": [        "Ama",        "ORDER-1001"      ]    }  ]}

Common errors and fixes

CodeMeaningFix
AIN11VAS key missing or rejectedSend the key for that service (SMS or WhatsApp) in X-API-VASKEY
ASMS07Sender ID is not approvedWait for approval or use an approved Sender ID
ASMS09Request unknownCheck type and the body
ASMQ06senderid is requiredSend a senderid
WAS401WhatsApp authentication problemCheck the WhatsApp VAS key
WAS404Template or message not foundUse a template name and language from Get Templates
  • The right VAS key is used for each service and kept server-side.
  • The Sender ID is approved before the first send.
  • Every message has a unique ref you can trace.
  • You check delivery with the status call and retry only failures, with new refs.
  • You watch the SMS balance.