Developer guide
How to send WhatsApp messages using an API
You can send a WhatsApp message from any programming language with a single HTTP request — no SDK, no Meta Business verification, and no per-conversation fees. This guide shows the four steps end to end, then links to a copy-paste example for your exact stack.
curl -X POST https://api.spwp.app/api/v1/public/messages/text \
-H "X-API-Key: $SPWP_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "to": "9647503505440", "text": "Hello from SPWP" }'Four steps to your first message
The whole process takes about five minutes. Everything after step 2 is ordinary HTTP.
Create an account and pair a WhatsApp number
Sign up, then scan a QR code with the WhatsApp app on your phone — the same flow as WhatsApp Web. Your number is live in under a minute and starts a 3-day free trial automatically. No Meta Business verification, no template approval.
Generate an API key
Open the account you just paired and create an API key. The key is scoped to that one WhatsApp number, so the account is implicit in every request. Store it as a server-side environment variable — anyone holding it can send messages as you.
POST the message
Send a JSON body with a recipient and some text to /public/messages/text, authenticated with the X-API-Key header. The API answers 202 Accepted immediately and returns a message id you can track.
Receive replies and delivery receipts
Register a webhook URL to get inbound messages and status changes (sent, delivered, read, failed) pushed to your server as HMAC-signed events. Verify the signature before trusting the payload.
Pick your language or framework
Every guide below sends the same message — the difference is only the HTTP client. All of them are complete, runnable files rather than fragments.
- cURLShellSend a WhatsApp message from the terminal with a single HTTP request — the fastest way to confirm your API key works.View guide
- Node.jsJavaScriptSend WhatsApp messages from a Node.js server using the built-in fetch API — no SDK required.View guide
- TypeScriptTypeScriptA fully typed WhatsApp client in TypeScript, with the response envelope and error shape modelled.View guide
- PythonPythonSend WhatsApp messages from Python with the requests library, including webhook signature verification.View guide
- DjangoPythonWire WhatsApp notifications into a Django project — a service helper plus a CSRF-exempt webhook view.View guide
- PHPPHPSend WhatsApp messages from plain PHP with cURL — works on any shared host, no framework needed.View guide
- LaravelPHPSend WhatsApp messages from Laravel using the HTTP client, with a queued job and a signed webhook route.View guide
- WordPressPHPSend WhatsApp order notifications from WordPress or WooCommerce using wp_remote_post.View guide
- GoGoSend WhatsApp messages from Go using net/http — no third-party dependencies.View guide
- JavaJavaSend WhatsApp messages from Java 11+ with the built-in HttpClient, ready to drop into Spring Boot.View guide
- C# / .NETC#Send WhatsApp messages from C# and ASP.NET Core with HttpClient and System.Text.Json.View guide
- Ruby on RailsRubySend WhatsApp messages from Ruby or Rails with net/http and a signature-verified webhook controller.View guide
Common questions
Can I send WhatsApp messages without the official Business API?
Yes. SPWP connects through the WhatsApp Web protocol, the same channel the official WhatsApp Web client uses, so you send from a real number you already own. That removes Meta Business verification, template approval and per-conversation pricing. The trade-off is that messages come from your own number rather than a verified business profile.
What is the fastest way to test that it works?
Use the cURL guide. One command in your terminal with your API key proves the whole path — key, pairing and delivery — before you write any application code.
Do I need a separate API key per WhatsApp number?
Yes, and that is deliberate. Keys are scoped to a single WhatsApp account, so a leaked or revoked key affects exactly one number. You can hold as many numbers as your plan allows and round-robin between them for higher throughput.
How do I send messages to numbers in Iraq?
Use the full international number without a plus sign, spaces or dashes — for example 9647503505440. The country code is always required. SPWP normalises plain numbers into WhatsApp JIDs for you.
Send your first WhatsApp message today
Pair a number, copy an API key, and run one of the examples above. The first 3 days are free on every new number — no credit card.
3-day free trial — no card requiredPay in IQDOpenAPI 3.0