Concepts
Webhooks
How webhooks work with Stubber
A webhook is a way to trigger an action on a stub from an external system.
A webhook can only execute actions that are available in the stub’s current state. If the stub has already progressed beyond a state, actions that were available in that previous state can no longer be triggered by a webhook.
Use Cases for Webhooks
Creating Stubs from an External System
If you have a form on a website where users can submit requests or information, a webhook can automatically create a stub whenever a form submission occurs. This ensures that every user interaction is captured in real-time without manual intervention.Posting Updates on a Stub
Consider a scenario where your application interacts with a ticketing system (like JIRA or Zendesk). When an update occurs in the ticketing system—such as a change in ticket status—a webhook can post this update to the corresponding stub. This keeps your records synchronized and up to date with external systems.Notifying a Stub When a Payment is Made
In an e-commerce or subscription-based service, it's crucial to track payments. A webhook can be configured to notify your application whenever a payment is made through an external payment processor (like PayPal or Stripe). This notification can then trigger specific actions on the stub.Indicating Authorization Has Been Granted
When a user needs to authorize an action (for example, confirming their email address or granting permission for data access), a webhook can signal your application that authorization has been granted. This updates the stub to reflect the authorized status and enables subsequent actions that depend on this authorization.
See the Action Meta Webhook section for more information on how to enable webhooks on actions.
Conceptual Overview
The diagram below illustrates how webhooks work.
An external system makes a POST request to the webhook URL, including any data required by the process in the request body.
Practical Example
Below is an example showing how to enable a webhook on an action and trigger that action via Postman: