Prosphere

NotesGuides

Send Contact Form Submissions to a CRM With a Webhook

How a webhook passes a contact form submission to a CRM or other tool: the POST request, the response code, retries, duplicates and signature checks.

In this post

A webhook is an HTTP request that one system sends to another when something happens, so the receiver does not have to ask. For a contact form, the event is a new submission, and the receiver is a CRM or a small script that writes it to a table. The mechanism is simple, but the details decide whether a lead is stored once, stored twice or not stored at all. This post explains the request, what the receiver must return, why the same submission can arrive twice, and how to check that a request really came from the sender.

To show good practice, this post uses Stripe's webhook documentation as a reference. Stripe sends payment and billing events, not form leads, so the event names differ. The rules about receiving HTTP requests apply in the same way.

What a webhook is, in one paragraph

A webhook is a URL on your side that another service calls with a POST request when an event occurs. The sender pushes the event to you. You register the URL with the sender, and the sender keeps trying to deliver events to it. Stripe describes the receiving side as an endpoint that handles POST requests with a JSON payload. The receiving code is yours to write, and the sender's job ends when it has delivered the event or stopped retrying.

What a form lead looks like as a JSON POST

A form lead sent by webhook is a JSON document with the fields the visitor filled in, plus a few the form tool adds, such as the page the form was on and a time stamp. The exact shape depends on the tool. What matters for your receiver is that the body is JSON, that the request is a POST, and that every submission carries an identifier you can store.

That identifier is the basis for everything that follows. Without a stable ID per submission, the receiver cannot tell a new lead from a repeat of an old one.

What the receiving endpoint must do and return

Stripe's guidance for an endpoint is specific. It should handle POST requests with a JSON payload, verify that the request is genuine, and return a successful status code quickly, before any slow work. Stripe says the endpoint "quickly returns a successful status code (2xx) before any complex logic that might cause a timeout."

In practice, the handler should do three things in order. It checks the request. It stores the event, or places it on a queue. Then it returns a 2xx response. Writing to a CRM, sending a notification or calling a third-party API should happen after that response, not inside the request. If those calls are slow, the sender sees a timeout, counts the delivery as failed and tries again.

Stripe also recommends processing events through an asynchronous queue. Its reason is that bursts of deliveries can overwhelm a receiver that works on each one synchronously. A contact form on a small site rarely produces a burst, but the same design protects against a slow CRM API on a quiet day.

Why the same lead can arrive twice

A receiver should expect duplicates. Stripe states that "webhook endpoints might occasionally receive the same event more than once," and recommends guarding against this by logging the event IDs you have processed and not processing an event that is already logged.

Duplicates come from the retry behaviour. If the receiver answered slowly, or returned an error, the sender sends the event again. The first attempt may still have succeeded on the receiver's side, so the second attempt creates a second record. Storing the processed ID before the work, or checking it inside the same transaction as the write, prevents this.

Order is a related issue. Stripe says it "doesn't guarantee the delivery of events in the order that they're generated." A receiver that assumes the events arrive in sequence can overwrite newer data with older data. Use the event's own identifier to decide whether you have seen it, and do not rely on the time stamp alone.

Verifying that a request is genuine

Anyone who knows your URL can send a POST to it. For a CRM that creates records, that is a real risk, so the receiver must check that the request came from the sender. Stripe signs each request with a signature in the Stripe-Signature header, and the receiver verifies it using a secret shared with the sender.

Two details of Stripe's approach are useful as a model. The signature covers the raw request body, so any framework that changes the body before your code reads it will break verification. And the signed timestamp allows a receiver to reject old requests. Stripe's libraries use a default tolerance of five minutes, and the documentation warns that a tolerance of zero disables the recency check entirely.

Your form tool may use a different scheme or none at all. Check its documentation before you assume a request is genuine, and if it offers no signature, find out what else it offers. Stripe itself pairs signature checks with an allowlist of its published IP addresses.

Retries and what a slow receiver causes

When delivery fails, a well-built sender retries. Stripe attempts delivery "for up to three days with an exponential back off" in live mode, and retries sandbox events a few times over a few hours. For your receiver, this means an outage of a few hours does not lose a lead, as long as the sender keeps retrying and your endpoint accepts the event when it returns.

Retries also mean that a receiver that answers slowly causes duplicates. A timeout counts as a failure, the sender tries again, and the receiver may finish both attempts. The fix is the same as before: answer quickly, store the event ID and process each ID once.

Stripe also notes that resending an event by hand does not cancel automatic retries. If you replay events from the sender's dashboard to repair a gap, check your duplicate guard first.

A test checklist before connecting your CRM

Before a live form sends to the CRM, test the receiver with a set of cases that can fail.

  • Send a valid submission and confirm exactly one record appears.
  • Send the same submission twice and confirm only one record remains.
  • Stop the CRM connection, send a submission and confirm the receiver returns an error, then restart and confirm the sender's retry lands the record.
  • Send a request with a wrong or missing signature and confirm it is rejected.
  • Send a request with an old timestamp, if the sender supplies one, and confirm it is rejected.
  • Time the response with a slow CRM call in place and confirm the receiver still returns quickly.

Each case should have a visible result, such as a count of records or a logged rejection. A test that only shows "it did not crash" proves little.

Webhook, email notification or CSV: which fits when

A webhook fits when the lead must reach another system without a person copying it, and when the receiver can store and deduplicate records. An email notification fits when a person reads each lead and no system needs the data in structured form. A CSV export fits when the data is reviewed in batches and a person imports it on a schedule.

The three can be combined. A notification tells a person a lead arrived, while the webhook writes the record. The choice depends on who acts on the lead and how quickly, not on which method is most advanced. For how a shared inbox fits between these options, see one inbox for many websites, and for the basics of the form itself, see how it works. If you have a setup question for your own forms, you can contact us.

Sources

Join the waitlist

Join the Prosphere waitlist for a form backend and shared inbox for many websites, or write to info@prosphere.app. One message when it opens.

Waitlist