Skip to content

API Recipes: SMS, WhatsApp, OTP, and RCS

Search a walkthrough, then copy the cURL. Each recipe uses https://api.azmarq.com and the apikey header.

New to the API? Run Quickstart for the first SMS, then come back here for the other channels.

First SMS

Get ready: wallet credits, Approved sender ID, gateway type (for example TRANSACTIONAL). India: DLT PE ID + template ID. What DLT is. GSM English is 160 characters (153 concatenated); Unicode regional languages are 70 (67). Normal and Unicode characters.

  1. Create an API key in Developer → API Key. See Authentication.
  2. POST /v1/sms with an approved sender and type set to the gateway API code assigned to the account.
  3. Store data[0].messageId.
  4. Subscribe to SMS delivery reports.
POST
/v1/sms
curl --location --request POST 'https://api.azmarq.com/v1/sms' \
--header 'Content-Type: application/json' \
--header 'apikey: YOUR_API_KEY' \
--data-raw '{
  "sender": "AZMARQ",
  "to": "91XXXXXXXXXX",
  "text": "Hello World!",
  "type": "TRANSACTIONAL"
}'

Success looks like this. error is null when the API accepted the send — not when the handset delivered.

Response

{
  "id": "58d63c02-XXXX-XXXX-XXXX-XXXXbb39453",
  "data": [
    {
      "recipient": "91XXXXXXXXXX",
      "messageId": "58d63c02-XXXXX-XXXXX-XXXXX-XXXX9bb39453:1"
    }
  ],
  "totalCount": 1,
  "message": "Message Sent Successfully!",
  "error": null
}

If this fails: Errors. Full guide: SMS (Message App). Same walkthrough as Quickstart.

WhatsApp template

Get ready: connected WhatsApp number (from), Meta-Approved template (templateName), wallet credits. Pick the right category (authentication / utility / marketing). What a template is.

  1. Create the template and wait until it is Approved. Create templates.
  2. Send with type template and the approved templateName.
  3. Fill components if the body has {'{{1}}'} placeholders — same order as the template.
  4. Keep messageId for WhatsApp webhooks.
POST
/v1/whatsapp
curl --location --request POST 'https://api.azmarq.com/v1/whatsapp' \
--header 'Content-Type: application/json' \
--header 'apikey: YOUR_API_KEY' \
--data-raw '{
  "from": "+91XXXXXXXXXX",
  "campaignName": "api-test",
  "to": "+91XXXXXXXXXX",
  "templateName": "template_name",
  "type": "template"
}'

Session text / image / interactive messages only work inside the 24-hour window after the customer messages you. Outside that window, use a template. Session window.

If Meta rejected the template, fix category or wording and resubmit — do not send the rejected name.

OTP generate then verify

Get ready: an OTP config (configId) on the account, a destination to, and a way to show the PIN (often SMS or WhatsApp on the same account).

  1. POST /v1/verify with configId and to.
  2. Store data from the response as verifyId.
  3. Deliver the PIN however your config is set (the generate call creates the code).
  4. POST /v1/verify/validate with that verifyId and the PIN the user typed.
POST
/v1/verify
curl --location --request POST 'https://api.azmarq.com/v1/verify' \
--header 'Content-Type: application/json' \
--header 'apikey: YOUR_API_KEY' \
--data-raw '{
  "configId": "a73cd9xe-XXXX-XXXX-XXXX-7f731bcf4y64",
  "to": "91XXXXXXXXXX"
}'

Response

{
  "data": "33888968-XXXX-XXXX-XXXX-3010e0069668",
  "error": null,
  "message": "OTP Generated Successfully!"
}

Validate on Verify OTP. Do not log the live PIN. If generate fails, check configId and wallet — this is not the SMS sender field.

RCS plain text

Get ready: RCS bot (botId), Approved template (templateName), credits. Optional: capability check on RCS Numbers. RCS.

  1. Use an RCS-capable destination and a dashboard botId.
  2. POST /v1/rcs with an approved templateName.
  3. Match RCS webhooks using messageId.
POST
/v1/rcs
curl --location --request POST 'https://api.azmarq.com/v1/rcs' \
--header 'Content-Type: application/json' \
--header 'apikey: YOUR_API_KEY' \
--data-raw '{
  "botId": "YOUR_BOT_ID",
  "number": "91xxxxxxxxxx",
  "templateName": "welcome_card",
  "campaignName": "launch",
  "content": [],
  "meta": {}
}'

Cards and carousels: RCS guide and Send RCS. If the handset is not RCS-capable, add a Fallback rule (SMS or WhatsApp) on compose.

Match a delivery report

Get ready: a public HTTPS URL, and a database keyed by messageId.

  1. On every successful send, persist messageId with your own order or user id.
  2. Configure the channel webhook in the dashboard. Event map.
  3. When a DLR arrives, join on messageId — do not treat HTTP 200 on send as delivered.
  4. Ignore duplicate posts with the same id and status.

SMS DLR can be GET query or POST JSON depending on the configuration Method. WhatsApp uses message_status / message_received. RCS uses bot callbacks.

Next: Errors if the send is rejected, or Omni SDK to stop writing HTTP by hand.

Was this page helpful?