This document covers some fundamental areas and provides sample code to help you create your own endpoint to receive a Lead Liaison webhook. In this guide we show you two parts:
- how to build a webhook call within Lead Liaison
- how to receive a webhook call (build an endpoint)
Building a Webhook Call within Lead Liaison
- Go to Settings > Webhooks
- Click Add New Webhook
- In the Add New Webhook screen:
- Add the name of the Webhook
- Tag/Description: Optional
- URL: This is the URL of your endpoint script. In this case, we'll use the test script: https://staging.leadliaison.com/test-scripts/webhook-sample.php
- Select the Request Type (options are GET and POST).
- GET request type means the Webhook accepts the parameters concatenated in the URL, i.e: https://staging.leadliaison.com/test-scripts/webhook-sample.php?firstName=%%FirstName%%&lastName=%%LastName%%
- POST request type means the Webhook accepts the parameters in the request body, so put your parameters in the "Template" field. The Template field accepts 2 formats:
- FORM/URL: firstName=%%FirstName%%&lastName=%%LastName%%
- JSON: it needs to be a valid JSON. i.e: {"first_name": "%%FirstName%%", "lastName" : "%%LastName%%"}
- If you set the template as the FORM/URL format then you have to select 'FORM/URL' as the Request Token Encoding.
- If you set the template as the JSON format then you have to select 'JSON' as the Request Token Encoding.
- You can specify how to receive the data from your Webhook. Lead Liaison supports JSON and XML.
Example
- Our test Webhook URL is: https://staging.leadliaison.com/test-scripts/webhook-sample.php
- This script returns the data you will specify in the Template field. i.e: first_name=%%FirstName%%&last_name=%%LastName%%&company=%%Company%%&email=%%Email%%
- Testing this Webhook will return the firstname, lastname, company and email of the Prospect used in the test.
Here's how the Webhook is configured:
Top Portion | Bottom Portion |
---|---|
How to Receive a Webhook (Build an Endpoint)
- To receive data in the form of FORM/URL:
- $data = $_POST;
- To receive data in the form of JSON:
- $data = file_get_contents("php://input");
- You can process this data as you wish. At the end of the script you must return the data in the same format as the Response Type 'JSON or XML'.
- To test the Webhook follow these testing resources.
Sample Scripts
Sample Script
See the sample endpoint script attached, written in PHP.