Developer guides
Webhook vs API: The Difference, With Examples
Webhook vs API: an API answers when you ask, a webhook calls you when something happens. When to use each, with WhatsApp and SMS examples.


Webhook vs API comes down to who starts the conversation. With an API, your code sends a request and gets an answer back. With a webhook, the other service sends a request to your code when something happens.
Both are HTTP. The difference is direction and timing.
Most APIs come with webhooks. The API is how you ask and act, and webhooks are how the service tells you what changed.
The difference at a glance
| API | Webhook | |
|---|---|---|
| Who sends the request | Your app | The other service |
| When | Whenever you choose | The moment an event happens |
| Direction | You pull data | The service pushes data to you |
| What you need | An API key and the endpoint | A public URL that accepts requests |
| Good for | Sending, creating, fetching on demand | Hearing about new messages, payments, status changes |
| If you need it often | You poll in a loop | You do nothing until it arrives |
The same job, both ways
Say a customer replies to your WhatsApp message and you want to know.
With only an API, you'd poll: ask for new messages every ten seconds. That's 8,640 requests a day per number, almost all of them returning nothing, and a reply can still sit for up to ten seconds before you see it.
With a webhook, you register a URL once. Each reply arrives as one request, within a second:
{
"event": "message.any",
"data": {
"payload": {
"from": "201000000002@c.us",
"fromMe": false,
"body": "Yes, 5 pm works",
"hasMedia": false
}
}
}Then you answer with the API, because sending is something you start:
curl -X POST https://app.hypersender.com/api/whatsapp/v2/{instance}/send-text \
-H "Authorization: Bearer $HYPERSENDER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"chatId": "201000000002@c.us", "text": "Great, see you at 5."}'That pairing is how most integrations work. Webhooks bring events in, API calls send actions out.
When to use an API
- You start the action: send a message, create an order or charge a card.
- You need data on demand. Showing a customer's history when someone opens a page.
- You need the current state. Checking whether an account is connected before a big send.
- Catching up. After downtime, fetch what you missed instead of waiting for retries.
When to use a webhook
- Something happens on their side. A message arrives, a payment succeeds, a delivery report comes in.
- Timing matters. Replying to a customer or releasing an order within seconds instead of on the next poll.
- Events are rare but important. Polling for something that happens twice a day wastes thousands of requests.
- You'd otherwise hit rate limits. One request per event uses far less of your quota than a polling loop.
What webhooks ask of you
Webhooks save requests but move some work to your side:
- A public HTTPS URL. The service has to reach it, so
localhostwon't do without a tunnel. - Checking the sender. Anyone can POST to a URL. Verify the shared secret or the signature before trusting the body.
- Fast answers. Return 200 within a few seconds and do slow work in a queue, or the service retries.
- Handling repeats. Retries mean the same event can arrive twice, so make your handler safe to run more than once.
- A delivery log. When something breaks, you need to see what was sent and what your server answered. Hypersender keeps Webhook Logs with a resend button for this.
What is a webhook covers how they work, step by step.
Testing each one
You test an API by calling it: cURL, Postman, or the SDK in your language. Testing a webhook is harder, because you're waiting for someone else to call you.
A free webhook tester gives you a URL that records every request, so you can trigger an event and read the real headers and body before you write the handler. It also passes Meta's WhatsApp verification check, so it works as a WhatsApp Cloud API callback URL.
WhatsApp and SMS with both
Hypersender gives you the two halves together. The REST API sends WhatsApp messages from your own number and SMS from your own Android phone. Webhooks deliver incoming messages, delivery and read receipts, and SMS replies to your server.
The WhatsApp webhook guide lists every event, and SDKs for Laravel, Node.js, Python and Go handle both sides.
Start a free trial, link your number by QR code, and send your first API call today. The first 14 days are free.





