Web Rabbit MediaDocs
Messaging

WhatsApp, opt-outs & lookup

WhatsApp templates, the do-not-contact list, number lookup and phone verification.

Beyond SMS, OTP and voice, the messaging API covers WhatsApp template campaigns, a do-not-contact list, network number lookup and phone verification. All four are priced per destination and charged from the same messaging credit balance, and all four are simulated in test mode.

Opt-outs

POST/v1/messaging/opt-outs

Numbers on this list are removed from a send before it is priced, so you are never charged for them. Additions are mirrored to the network's own do-not-contact list.

FieldTypeDescription
actionenumlist (default), add or remove.
business_idstringOptional on API-key calls — taken from the key.
msisdnsstring[]Numbers to add or remove. msisdn accepts a single number.
sourcestringWhere the opt-out came from, e.g. dashboard, stop_reply, support.
bash
curl -X POST https://api.webrabbitmedia.com/v1/messaging/opt-outs \
  -H "Authorization: Bearer wr_live_..." \
  -H "Content-Type: application/json" \
  -d '{"action":"add","msisdns":["0240000000"],"source":"stop_reply"}'

A send whose whole recipient list has opted out fails with all_recipients_opted_out. Otherwise the send response reports skipped_opt_out alongside the recipients that were charged.

Number lookup

POST/v1/messaging/lookup

Ask the network whether a line is live and which operator holds it, before paying to message a large list. A result is reused free of charge for 30 days; failed checks are refunded automatically.

FieldTypeDescription
actionenumlookup (default) or history.
msisdnsrequiredstring[]Up to 1,000 numbers per request.
refreshbooleanIgnore the 30-day cache and re-check every number.
json
{
  "ok": true,
  "charged": 0.30,
  "cached": 0,
  "results": [
    {
      "msisdn": "0240000000",
      "live": true,
      "operator": "MTN Ghana",
      "country_iso": "GH",
      "ported": false,
      "cost": 0.30
    }
  ],
  "credit_left": 41.70
}

WhatsApp

POST/v1/messaging/whatsapp

WhatsApp requires a template approved by Meta. Pull your approved templates, then send one as a campaign. Delivery reports arrive on the same signed message.delivered / message.failed webhooks as SMS.

FieldTypeDescription
actionenumtemplates, sync_templates, template, create_template, send, otp, campaigns or status.
templateobjectFor create_template: name, body_text, category_id, language, header_text, footer_text, variables, button fields and an optional media header. Submitted to WhatsApp for approval.
template_idstringApproved template reference. Required for send and otp.
recipientsstring[]Recipient numbers. group_ids adds saved contact groups.
samplestringComma-separated values for the template variables, in order.
schedule_atstringISO timestamp. The network holds the campaign until then.
phone / codestringFor action=otp: the recipient and the code to deliver.
iTemplates must be approved first
Only templates whose status is approved can be sent. Use sync_templates to pull the current list and approval state from the network.

Phone verification

POST/v1/messaging/verify

Three methods, all with the same two-step shape. network lets the operator generate, send and check the code. flash places a missed call whose caller-ID digits are the code. whatsapp delivers the code on WhatsApp. For codes you want us to generate and send over SMS, use the OTP endpoint instead.

FieldTypeDescription
actionenumsend (default), check or list.
methodenumnetwork, flash or whatsapp.
phonerequiredstringThe number being verified.
callerstringRequired for flash: the number the missed call comes from.
template_idstringRequired for whatsapp.
verification_id / codestringFor action=check.

Codes expire after 10 minutes and allow five attempts. In test mode nothing is sent and 123456 is always accepted.

Contacts

POST/v1/messaging/contacts

Your own address book. Contacts belong to your business alone — they are never written to, or read back from, a shared network address book, so no other business can see or import them.

FieldTypeDescription
actionrequiredenumlist, create, import, update or delete.
phonestringLocal (0240000000) or international format.
first_name / last_name / emailstringOptional contact details.
tagstringFree-text label used to segment your audience.
group_idstringAdd the contact to a saved group.
contactsobject[]For import: a list of { phone, first_name, last_name, email, tag }.
contact_idstringRequired for update and delete.

Reference data

GET/v1/messaging/reference

The network's own country, time-zone and currency ids. Pass ?kind=country, timezone or currency, or omit it for every list. Time-zone ids are what timezone_id expects on a scheduled send.

bash
curl "https://api.webrabbitmedia.com/v1/messaging/reference?kind=timezone" \
  -H "Authorization: Bearer $WEBRABBIT_MESSAGING_KEY"