Working with Webhooks
Webhooks are a powerful way to integrate your applications and services with Webflow, allowing you to receive real-time updates whenever specific events occur on your site. By setting up webhooks, you can automate workflows, trigger external processes, and synchronize data across different platforms without any manual intervention.
For instance, when a user submits a form on your Webflow site, a webhook can immediately notify your application, enabling you to take action instantly. This could involve sending an automated email response to the user, updating a lead record in your CRM system like HubSpot or Salesforce, or even triggering a custom workflow in an external service like Zapier.
Webhook Requests
When an event occurs, Webflow will send a POST
request to a specified URL.
The webhook body will be a JSON resource object that relates to the event. The request headers will include:
- A
Content-Type
header set toapplication/json
- A
x-webflow-timestamp
with the time the webhook was sent - A
x-webflow-signature
header containing the request signature. Read on for information about validating request signatures.
Below is an example of webhook event data.
JSON Example
Properties
Creating a Webhook
In this tutorial, we’ll walk through creating a webhook to listen for new submissions to a contact form on a site. Whenever someone submits this form, Webflow will send a notification to the specified destination. Additionally, we’ll cover how to verify that the webhook requests you’re receiving are genuinely from Webflow, ensuring secure and reliable communication with your application.
Looking for a Simpler Setup?
If you’d prefer a way to set up webhooks without using the API, you can easily configure them through the Webflow dashboard. Please note, that webhooks created through the dashboard will not include the request headers needed to validate request signatures.
Prerequisites
- A site token or bearer token from a Webflow Data Client App with the
forms:read
scope. If you plan on verifying requests, you must authenticate via an App. - A Webflow test site. You can use the Biznus template to quickly set up a site equipped with a contact form.
- A service to accept an HTTPS request. While we’ll be using https://webhook.site in this tutorial, you’re free to choose any platform.
Webhook Retries
Your service should return a 200
response to show that the webhook was successfully captured. If the response status is anything else, the webhook will be retried up to three more times at which point the request will be considered failed and will no longer be retried.
Failure Conditions
Webflow considers the following scenarios as failure conditions:
- Non-200 HTTP status code response: If we receive any response other than a valid HTTP 200 response, it is regarded as a failure.
- Redirects: If the webhook encounters redirects while attempting to deliver the payload, it will be treated as a failure.
- SSL Certificate Issues: If we cannot successfully negotiate or validate your server’s SSL certificate, it will be marked as a failure.
- Timeouts: Webflow expects a swift response during webhook delivery. If there are prolonged delays in receiving a response from your server, it will be considered a failure.
Deactivation of Webhooks
If Webflow repeatedly encounters failure conditions while attempting to deliver a webhook payload, we will take the following action:
- Deactivation: We will deactivate your webhook to prevent further delivery attempts.
- Notification: You will be notified of the webhook deactivation via email.
To reactivate your webhook or if you have any questions regarding a deactivated webhook, please don’t hesitate to reach out to our support team.
Limits
Understanding the limits imposed by Webflow can help you design and manage your webhooks more efficiently:
Event types
This is the full list of webhook events available in Webflow. For complete documentation of webhook events with payloads, please see the webhook events documentation.
Validating Request Signatures
Webflow provides a method for your App to verify that requests are genuinely coming from the Webflow API by using signatures included in the request headers.
x-webflow-timestamp
: The time the webhook was sent, represented in Unix epoch time format.x-webflow-signature
The request signature, formatted as a SHA-256 hash.
Only OAuth Apps carry these signatures.
Webhooks originating from a site dashboard or via a Site’s API Key won’t have request signatures. To benefit from this security feature, create your webhooks through an OAuth application.
To ensure the authenticity of a webhook request from Webflow, validate the request signature using the provided headers and your OAuth application’s client secret.
Steps to Validate the Request Signature
- Generate the HMAC Hash:
- Retrieve the timestamp from the
x-webflow-timestamp
header. - Concatenate the timestamp and the request body with a colon (
:
) separator. The format should be: - Use your OAuth application’s client secret and the SHA-256 hashing algorithm to generate the HMAC hash. The client secret serves as the key for the HMAC process.
- Retrieve the timestamp from the
- Compare the Generated Hash with the Provided Signature:
Compare the generated HMAC hash with thex-webflow-signature
header from the request. A match confirms the request’s legitimacy; otherwise, it should be considered potentially tampered with or fraudulent. - Verify the Timestamp:
Check thex-webflow-timestamp
header to ensure the request is recent. A request older than 5 minutes may indicate a replay attack. Calculate the request’s age as follows:If the difference exceeds 5 minutes (300,000 milliseconds), consider the request potentially compromised.
See below for examples that accept an incoming HTTPS request and validate the signature: