Skip to main content

What is a Webhook?

A webhook is an automated message that one application sends to another when certain events occur. Webhooks let applications notify one another in real time when something changes in one system, and in Prismatic a webhook can trigger an instance's flow so the change is reflected in the other system.

Get startedSecure webhooks with HMAC

Verify that incoming webhook requests are legitimate with the HMAC Webhook Trigger or a custom trigger.

GuideSending data to webhook triggers

Send JSON, binary, or multipart data to a trigger URL and read the payload in your steps.

GuideSynchronous and asynchronous invocations

Get a flow's results back in the HTTP response, and set response status codes and headers.

GuideWhat is HMAC?

Learn how HMAC signing works, with Node.js examples for signing and sending payloads.

How webhooks work​

A webhook consists of two main parts:

  • The event that causes the webhook to fire. The event is usually a change to a record in an application. For example, you may have a contact.changed or report.created event.
  • The endpoint where information about the event is sent. The endpoint is a URL that you provide to the application that will receive the webhook.

Webhook request payloads​

When a webhook fires, the application where the event occurred will send a POST request to the endpoint you provided. Most applications will send a JSON payload in the request body that contains information about the event that occurred (though some, notably Salesforce, send XML payloads).

Some payloads contain the entire record that changed, while others contain only the record's ID and you are expected to fetch the record yourself.

Webhook security​

Webhooks are often secured using hash-based message authentication codes (HMAC) to ensure that the request is coming from the application that you expect. For details, see What is HMAC?.

Responses to webhooks​

Some applications expect a particular response to the webhook request to ensure that your application understood the request. Most applications expect an HTTP 200 response with a special message in the response body that is usually derived from the webhook's payload or request header. Other applications expect an HTTP 200 response.

Webhooks in Prismatic​

In Prismatic, the endpoint of a webhook is generally an instance's flow's trigger URL.

Your integration configures webhooks in the third-party app when the instance is deployed either using a webhookLifecycleHandlers function in a custom trigger, or by creating a "setup" flow that is triggered on instance deploy. Some built-in components will subscribe to webhooks automatically when the instance is deployed. If you configure webhooks on instance deploy, you should also remove webhooks on instance delete using a similar process.

If the third-party app expects a specific response to the webhook request, you can build a custom trigger that validates HMAC signatures and responds to the webhook request appropriately. Many built-in components already have triggers that handle this for you.

Ensuring webhook ordering with a FIFO queue​

Prismatic's integration runner is designed to process requests in parallel. If you invoke an integration with multiple requests in quick succession, the runner will scale and process all of the requests simultaneously.

If you have a flow that requires requests to be processed in a specific order, or a flow that requires you to process only one record at a time, you can leverage Flow Concurrency Management to create a "first in, first out" (FIFO) queue.