Skip to main content
All CollectionsEmbedded Documentation
Creating a seamless integration experience with webhooks
Creating a seamless integration experience with webhooks

In this guide, we go through the process of creating a seamless integration experience with webhooks

Manuel Bernal avatar
Written by Manuel Bernal
Updated over a week ago

Webhooks are a method for applications to communicate in real-time by sending automated messages when specific events occur. Here's how they work:

How webhooks function

  1. Event Triggering: A webhook is initiated by an event in a source application, such as a user action (e.g., submitting a form, making a purchase, or updating a record). When such an event occurs, the application fires a message with relevant data about the event, known as a payload.

  2. Sending Data: The source application sends this payload to a specified webhook URL—a unique endpoint in the receiving application. This URL acts like a phone number that the source application "calls" to deliver information about the event.

  3. HTTP Request: The data is sent over the web using an HTTP request, typically using a POST method. The receiving application processes this request and may respond with an HTTP status code (e.g., 200 OK for success or 404 Not Found if the URL is incorrect) to confirm the data was received.

  4. Real-Time Updates: Unlike traditional APIs that require constant polling to check for updates, webhooks push data instantly when an event occurs. This makes them more efficient, significantly reducing server load and transaction costs.

  5. Subscription Management: Users typically need to create a webhook subscription, specifying which events they want to receive notifications for and providing the corresponding webhook URL. This setup often involves making an API call to register the subscription.

Note

We suggest setting up individual webhooks for each user. This way, Albato will generate a unique webhook URL for each of your customers and send it back to your endpoint. In this scenario, you would need to store webhook URLs on your end so that you can reuse them whenever the same users run their Albato integrations.

There are two basic types of webhook implementation:

Auto-subscription (desirable type)

Here, we would need an API method in your SaaS to subscribe to your webhooks. Your subscription API should allow specifying the events we want to subscribe to for the user. It’s also essential to enable Albato to subscribe to all events required for integrations. The method should be straightforward and include subscription event parameters, subscription URL, and user ID.

If you choose to go down the auto-subscription route, you will also need to provide an unsubscribe method so that Albato can stop receiving events whenever any of your users disable the integration.

Here's how it works step by step:

  1. Albato subscribes to your SaaS events (webhooks).

  2. Albato specifies an HTTPS endpoint to receive events.

  3. Event XYZ in your SaaS is created.

  4. Your SaaS sends a webhook with the event payload to the Albato subscription endpoint.

Standard webhook requirements:

  1. JSON format

  2. Event type in the payload

  3. User ID (your client ID) in the payload

  4. Payload with all the fields that you want to use in your integrations

See below an example of a Shopify webhook payload for the "Customer created" event:

  • Albato subscribes to your webhook (Shopify example)

  • Your webhook response with the payload (Shopify example)

Manual subscription

If setting up a webhook subscription API isn’t feasible, you can let your users manually insert a webhook URL into your UI. To do that, they’ll need to copy the webhook URL from the Albato iFrame (within your app connection settings) and paste it into a webhook field on your platform.

Note

Please note that a manual subscription isn’t user-friendly as it would require a lot of back and forth from your customers to set up a webhook.

There's a way to streamline this experience for your users via the SSO connection method.

See an example response below:

Note

If your webhooks contain custom fields that are unique to each user, Albato can automatically fetch these fields through your API method for pulling webhook custom fields and inject them into user integrations behind the scenes—no manual input required. This also provides a much smoother UX for your customers.

Did this answer your question?