Getting started
New to SendFlow? The Get started guide walks through linking your number and sending your first message without code.
- Create an account and start your trial or choose a plan.
- In the dashboard, add a WhatsApp number and scan the QR code with that phone.
- Open the number's API key tab and copy the key.
Base URL:
https://sendflow.pk/api/v1
All requests and responses use JSON. Phone numbers are in international format without + (e.g. 923001234567). Local Pakistani numbers like 03001234567 are converted automatically.
Connect without coding
Many school management systems, ERPs, hospital and billing programs already have a message gateway setting where you paste a link. Paste this link instead and the same messages go out on WhatsApp from your own number:
https://sendflow.pk/api/v1/send?api_key=YOUR_API_KEY&to={mobile}&message={message}
- Works with GET or POST (form or JSON). Replace
{mobile}and{message}with the placeholders your software uses. - Common names are accepted too:
number,msisdn,phone,receiverfor the number andtext,msg,smsfor the message;key,apikey,tokenfor the key. - Several numbers can be sent at once, separated by commas (up to 100).
03001234567works as it is. - The answer is plain text:
OK 88412when queued, orERROR: reason. Add&format=jsonfor JSON. - Because the key is in the link, keep it private and lock the key to your server's IP address in the dashboard.
Authentication
Every WhatsApp number has its own API key. Send it as a bearer token:
Authorization: Bearer sf_your_api_key
Keep the key secret. If it leaks, create a new key in the dashboard; the old one stops working immediately.
Send a message
POST /messages
curl -X POST https://sendflow.pk/api/v1/messages \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"to":"923001234567","text":"Hi Ali, your order #1042 has been shipped."}'
| Field | Required | Description |
|---|---|---|
to | Yes | Recipient phone number |
text | Yes* | Message text. Supports WhatsApp formatting: *bold* _italic_ ~strike~. *Optional when sending a file. |
ref | No | Your own reference (e.g. order ID), returned in status webhooks |
send_at | No | ISO date-time to schedule the message, e.g. 2026-10-20T09:00:00+05:00 |
Response 201:
{ "id": 88412, "status": "queued", "to": "923001234567" }
Messages are queued and sent one by one using the number's delay settings, so delivery can take from a few seconds to a few minutes when many messages are waiting.
Send a file or image
Attach a file by public URL or as base64. Images and videos are shown inline; other files are sent as documents. Maximum 16 MB.
{
"to": "923001234567",
"text": "Your invoice is attached.",
"media_url": "https://example.com/invoices/29617.pdf",
"filename": "Invoice-29617.pdf"
}
{
"to": "923001234567",
"text": "Your receipt",
"media_base64": "JVBERi0xLjQK...",
"filename": "Receipt-5521.pdf",
"mimetype": "application/pdf"
}
Send in bulk
POST /messages/bulk with up to 1,000 messages per request. Each item uses the same fields as a single message.
{ "messages": [
{ "to": "923001234567", "text": "Hi Sara, our office is closed on Monday." },
{ "to": "923211234567", "text": "Hi Bilal, our office is closed on Monday." }
] }
The response lists the result for each message in the same order.
Message status
GET /messages/{id}
{ "id": 88412, "to": "923001234567", "status": "delivered", "error": "", "ref": "order-1042", "attempts": 1, "created_at": 1792256568583, "sent_at": 1792256580120 }
Statuses: queued → sending → sent → delivered → read, or failed with an error. Times are Unix milliseconds.
Check a number
POST /check with {"to":"923001234567"} returns {"phone":"923001234567","valid":true,"exists":true}. Useful before saving a customer's WhatsApp number.
Number & subscription info
GET /instance returns the connection status, today's numbers and your plan usage:
{ "id": "e99b566a2010", "name": "Store notifications", "status": "connected", "phone": "923001234567",
"receive_enabled": false, "webhook_url": "https://example.com/hook",
"subscription": { "plan": "Business", "active": true, "expires_at": 1795000000000, "messages_used": 2140, "messages_limit": 15000 } }
POST /instance/settings with {"receive_enabled": true, "webhook_url": "https://…"} turns customer replies on or off and sets the webhook from your own app.
Contacts & groups
Keep your lists in SendFlow (students and parents by class, patients, members, tenants, customers) and send to a whole group. Each contact has a phone, a name and any fields you like; fields fill {placeholders} per person.
POST /contacts — add or update up to 1,000 contacts per request (matched by phone number, so it is safe to send your full list every night):
curl -X POST https://sendflow.pk/api/v1/contacts -H "Authorization: Bearer YOUR_API_KEY" -H "Content-Type: application/json" -d '{"contacts":[
{"phone":"03001234567","name":"Ali Khan","groups":["Class 5-A","Bus route 3"],"fields":{"roll_no":"21","fee":"4500","parent":"Mr. Khan"}},
{"phone":"03211234567","name":"Sara Ahmed","groups":["Class 5-A"],"fields":{"roll_no":"22","fee":"4500"}}
]}'
{ "ok": true, "added": 2, "updated": 0, "errors": [] }
GET /groups lists your groups with contact counts. POST /contacts/delete with {"phones":["03001234567"]} removes contacts.
POST /groups/{group name or id}/send — one personalised message to everyone in the group:
curl -X POST "https://sendflow.pk/api/v1/groups/Class%205-A/send" -H "Authorization: Bearer YOUR_API_KEY" -H "Content-Type: application/json" -d '{"text":"Dear parent, the fee of Rs {fee} for {name} (roll no {roll_no}) is due on 10 November.","optout_footer":true}'
Response 201: { "campaign": 51, "queued": 38, "invalid": 0, "duplicates": 0, "optedOut": 1 }. Optional: send_at, media_base64 + filename (needs a plan with bulk sending).
Flows (chatbot, follow-ups & COD confirmation)
New to flows? See the flow builder guide with live examples and step-by-step setups.
Build flows in the dashboard under Flows & chatbot: drag boxes for messages, questions with numbered options, waits, checks and actions, and connect them. A flow starts on a keyword, on any message, when a contact is added to a group, or from your system with this call (the flow must be turned on):
curl -X POST "https://sendflow.pk/api/v1/flows/FLOW_ID/start" -H "Authorization: Bearer YOUR_API_KEY" -H "Content-Type: application/json" -d '{"to":"923001234567","vars":{"name":"Ali","order_id":"1001","total":"2,500"}}'
Response: { "ok": true, "run_id": 87 }. Every value in vars can be used in the flow's messages as {name}, {order_id}… ({name|there} uses “there” when it's empty). GET https://sendflow.pk/api/v1/flows lists your flows and their IDs.
A Webhook action box sends a POST to your URL with {"event":"flow.webhook","flow":{…},"phone":"…","vars":{…}}, including the customer's answer in vars.reply and vars.choice (1, 2…). Tick “wait for the answer” and any values your server returns as JSON (e.g. {"status":"Shipped"}) can be used in later boxes as {status}.
Google Sheets & Excel
No server? Send from a Google Sheet with Apps Script (Extensions → Apps Script). Column A = phone, B = message:
function sendWhatsApp() {
const key = 'YOUR_API_KEY';
const rows = SpreadsheetApp.getActiveSheet().getDataRange().getValues().slice(1);
rows.forEach(([phone, message]) => {
if (!phone || !message) return;
UrlFetchApp.fetch('https://sendflow.pk/api/v1/messages', { method: 'post', contentType: 'application/json',
headers: { Authorization: 'Bearer ' + key }, payload: JSON.stringify({ to: String(phone), text: message }) });
});
}
Without any code, upload the Excel or CSV in the dashboard under Contacts & groups or Bulk send.
Webhooks
Set a webhook URL on the number (dashboard or API). We send a POST with JSON for these events:
| Event | When |
|---|---|
message.status | A message is sent, delivered, read or fails |
message.incoming | A customer replies (only when replies are turned on for the number) |
instance.status | The number connects, disconnects or is logged out |
{ "event": "message.status", "instance": "e99b566a2010", "time": 1792256581000,
"data": { "id": 88412, "ref": "order-1042", "to": "923001234567", "status": "delivered" } }
Verify each request: the X-SendFlow-Signature header is the HMAC-SHA256 of the raw body using your API key.
$body = file_get_contents('php://input');
$ok = hash_equals(hash_hmac('sha256', $body, 'YOUR_API_KEY'), $_SERVER['HTTP_X_SENDFLOW_SIGNATURE'] ?? '');
Respond with any 2xx status. Failed deliveries are retried 3 times.
Errors
| Code | Meaning |
|---|---|
401 | Missing or wrong API key |
402 | Subscription expired. Renew in Billing. |
403 | Account suspended, IP not allowed, or your plan doesn't include the API / attachments |
422 | Invalid request (bad phone number, empty message, number opted out) or blocked by spam protection ("spam": true). See error. |
429 | The monthly messages of your plan are used, or too many requests were sent at once (wait the number of seconds in the Retry-After header and try again). |
Errors always return JSON: {"error": "…"}.
Spam protection & opt-outs
Every message is checked before it is queued. Messages that look like spam (prize, lottery, crypto, loan, gambling, adult, chain or phishing wording) are rejected with 422. Numbers that message many contacts who are not on WhatsApp are paused; the dashboard shows why, and you can resume the number yourself a few times after fixing the cause (then our team reviews it). Recipients who reply STOP are added to your opt-out list and further messages to them are rejected.
Best practices
- Message only people who gave you their number and expect to hear from you.
- Use a dedicated business number, active on WhatsApp for some time before heavy use.
- Keep the default delays and a daily limit. Increase volume gradually over weeks.
- Include your business name and make messages useful: order details, amounts, links.
- Give people a way to opt out and respect it.