
How a webhook works
A webhook reverses the usual direction. Normally, one programme uses an API to ask another whether there is anything new. If it asks too rarely, information arrives late. If it asks too often, a lot of unnecessary traffic is created. With a webhook, the source reports by itself, precisely when something has happened.
- Store the address
A target address is entered in the source programme, for example the address of an automation service or of your own server.
- Choose events
You define which events are reported, such as “Lead received” or “Invoice paid”.
- The event occurs
When the event happens, the source programme packs the most important data into a message and signs it with a secret key.
- Delivery
The message is sent by HTTP POST to the target address. The target confirms receipt with a status code.
- Reaction
The target programme checks the signature and triggers the desired action, for example a message to the team.
Webhook or API: the difference
Webhooks and APIs complement each other. The API is the way to query or create data in a targeted manner. The webhook is the way to be informed about changes. Many connections use both: the webhook reports “Quote accepted” with the number of the quote, and the target programme then fetches the full details through the API.
| API | Webhook | |
|---|---|---|
| Who starts? | The programme that queries | The programme in which the event happens |
| Timing | Whenever a query is made | Immediately when the event occurs |
| Typical task | Reading, creating, changing data | Informing about changes |
| Access | API key or token with the call | Secret key for the signature |
| If the target cannot be reached | The call fails, the caller tries again | The source repeats the delivery later |
Security: signature and retries
A webhook address can be reached from the internet. So that nobody can slip in forged messages, the source signs every message. An HMAC is common: a check value is calculated from the content of the message, a timestamp and a secret key known only to the source and the target. The target recalculates the same value. If both match and the timestamp is recent, the message is genuine and has not been altered afterwards.
- Always check the signature: Discard messages without a valid signature.
- Check the timestamp: Reject old messages so that nobody can replay an intercepted message later.
- Plan for duplicate delivery: After an error, the same message may arrive a second time. The target should recognise it by its identifier.
- Respond quickly: The target confirms at once and does time-consuming work afterwards.
- Only necessary data: The message contains as little personal data as possible; the target fetches details through the API when needed.
If the target is temporarily unreachable, good systems repeat the delivery at increasing intervals. If a webhook fails permanently, it is paused so that no error goes unnoticed.
Setting up and testing a webhook
Setting one up usually takes only a few minutes. What matters is testing the connection before the first real event and keeping an eye on it afterwards. The following order has proved its worth.
- Create a receiving address in the target programme or automation service and copy it.
- Create a new webhook in the source programme, paste the address and select only the events that are really needed.
- Store the secret key shown securely in the target programme so that it can check the signature.
- Send a test message and check whether it arrives and is processed correctly.
- Look at the source programme’s log regularly to see whether deliveries fail.
If the receiving address changes, for instance because you switch automation service, the webhook in the source programme has to be updated. Otherwise the messages go nowhere and are abandoned after a few attempts. A webhook that is no longer needed should be deleted, not just ignored, so that no data is sent to an orphaned address. If you run several connections, keep a note of which webhook serves what purpose and who set it up.
Typical webhooks in an SME
- A new lead appears in the team chat so that someone calls back within minutes.
- An accepted quote creates an order in the planning programme.
- A paid invoice is reported to a management evaluation sheet.
- A deleted contact is also removed from the newsletter programme, so that the deletion is complete under data protection law.
If you do not program yourself, you usually connect webhooks through an automation service. There, the webhook address is generated, entered in the source programme and linked to an action in the target programme. For connections where a person grants access, OAuth also comes into play.
A practical example
Example: an electrical business in Thun passes on payments
The fictitious Elektro Muster AG in Thun invoices through its CRM and keeps its liquidity planning in a separate spreadsheet for the management. Until now, the bookkeeper entered every incoming payment twice.
Now a webhook for the event “Invoice paid” has been set up in the CRM. It points to an automation service that checks the signature and writes the invoice number, amount and date as a new row in the spreadsheet. When the target address cannot be reached one weekend because of maintenance, the CRM delivers the messages later. Afterwards, no payment is missing from the spreadsheet.
Fictitious example for illustration.
How VoxCRM helps
yesIn VoxCRM, you set up webhooks for 31 events, from “Contact created” through “Quote accepted” to “Invoice paid”. Every message is signed, so your system can check that it really comes from VoxCRM and was not altered on the way. If a delivery fails, VoxCRM tries again; a webhook that cannot be reached permanently is paused. Further details under integrations and API.
