Our software supports webhooks for leads via filters, reports, and automations. A webhook sends data from your account to a URL on your own server (or another service) when a lead matches a filter. We also support this in Zapier, which may be easier to set up and understand. Plus it may enable you to do things you never considered before. See API - Sending Data Using Zapier and Automations.
Before You Start
- The API & WordPress module must be active on your account. The Send Data action does not run without it.
- You need a URL that can receive a POST request.
- Each record sent counts as an API transaction. See API - Transaction Charges.
How to Set Up a Webhook
- Set up a Filter that identifies the leads that should trigger a webhook action.
- Set up a Report that contains the information you want to send.
- Set up an Automation that uses the Filter from above.
- On the Automation, use the Send Data action and enter the webhook URL we are supposed to send data to.
- Also enter the Report on the Send Data action so we know what to send.
What Your Server Receives
Data is sent as an HTTP POST in application/x-www-form-urlencoded format with name = value pairs. The names are the column names of your report and the values are formatted the same way the report shows them.
POST /your/webhook/path HTTP/1.1 Content-Type: application/x-www-form-urlencoded ID=520247&Customer=Jordan+Rivera&Total=%24425.13
- One POST is sent for each row of the report. A report with one row per lead sends one POST per lead. A report with one row per rental or per payment sends several POSTs for the same lead.
- Every POST also includes an ID field with the lead ID.
Reading the Data in PHP
<?php // Each report column arrives as a normal POST field. $lead_id = $_POST['ID']; $event_name = $_POST['Event_Name']; // Save or process the data here, then answer with a 200 status. http_response_code(200); echo 'ok';
PHP replaces spaces in field names with underscores, so the report column "Event Name" is read as Event_Name.
Delivery and Retries
- Your server has 15 seconds to answer.
- Answer with a 2xx status code (such as 200) to confirm you received the data. Any other answer, including a redirect, counts as a failure.
- A failed send is tried again after 1 hour, then after 8 hours, then after 24 hours. After that it is dropped.
- Only the first attempt counts as an API transaction. Retries are free.
- Automations run on a schedule, so expect a short delay between the lead matching the filter and the webhook arriving.