How to Receive Typeform Webhooks: A Complete Guide
Typeform webhooks allow you to get real-time notifications for new form submissions, enabling you to automate workflows, sync data with your CRM, and build dynamic applications. This guide will walk you through everything you need to know to receive and process Typeform webhooks effectively.
What Are Typeform Webhooks?
A Typeform webhook is an automated message sent from Typeform to a URL you specify when a new response is submitted to your form. Instead of you having to poll the Typeform API for new responses, Typeform actively sends you the data as it happens.
This is incredibly useful for triggering actions in other systems, such as adding a new lead to your CRM, sending a confirmation email, or updating a database.
Setting Up Your Typeform Webhook
Step 1: Create a Webhook Receiver Endpoint
First, you need a publicly accessible URL that can receive POST requests with a JSON payload. This endpoint is where Typeform will send the webhook data. Your endpoint should:
- Be able to handle POST requests.
- Respond with a 2xx status code (e.g., 200 OK) to acknowledge receipt.
- Be secure (HTTPS is highly recommended).
Step 2: Add the Webhook to Your Typeform
- Go to your Typeform workspace and open the form you want to add the webhook to.
- Click on the "Connect" tab.
- Find and click on "Webhooks".
- Click "Add a webhook" and paste your endpoint URL.
- If you want to secure your webhook, you can generate a secret key here. Copy it and save it as an environment variable in your application.
- Save the webhook and turn it on.
Securing Your Typeform Webhooks
Why Signature Verification is Essential
Verifying the webhook signature is crucial. It confirms that the request was sent by Typeform and not by a malicious third party. This prevents fake submissions and protects your application from attacks.
How Typeform Signatures Work
When you set a secret for your webhook, Typeform includes a Typeform-Signature header in each request. This header contains a HMAC-SHA256 hash of the request payload, signed with your secret key.
Your application should calculate the same hash using the received payload and your secret key, and then compare it to the signature from the header.
Testing Your Webhook Integration
Using the Typeform "Send a test request" feature
In the Typeform webhook settings, you can send a test request to your endpoint. This is a great way to verify that your endpoint is reachable and can handle the basic payload structure.
Local Development and Testing
For local development, your server is not publicly accessible. You can use a tool like ngrok to create a secure tunnel to your local machine. This gives you a public URL that you can use in your Typeform webhook settings.
Ngrok will give you a public URL (e.g., `https://random-string.ngrok.io`) that you can use as your webhook URL in Typeform.
Best Practices for Production
Respond Quickly
Typeform expects a response within 30 seconds. If your processing logic takes longer, Typeform will consider the delivery as failed. Acknowledge the request immediately by returning a 200 OK status, and then process the data asynchronously using a background job or a queue.
Handle Retries
If your endpoint fails to respond with a 2xx status, Typeform will retry sending the webhook. Your application should be prepared to handle potential duplicate events. You can do this by checking the `event_id` from the payload to see if you have already processed that event.
Monitor and Log
Keep logs of incoming webhooks and any errors that occur during processing. This is invaluable for debugging issues. Set up monitoring to alert you if your webhook endpoint is failing consistently.
Debug Typeform Webhooks with Hooklistener
Hooklistener simplifies debugging Typeform webhooks by allowing you to capture, inspect, and replay events. It's the perfect tool for ensuring your integration is robust and reliable.
Start Debugging Typeform Webhooks →