How to Setup a Webhook to Post Leads into Another System
If you're looking to post leads into your CRM or another system then our Webhook is a great option, especially in situations where a CRM is not supported by Zapier. In this article, we'll show you how to configure the webhook.
Note: The recommended approach for integrating with a CRM is with our Zapier integration. You can learn more about the LeadCapture.io Zapier integration here: https://help.leadcapture.io/article/168-zapier-integration
Steps to Setup the Webhook
There are a few steps to setup the webhook to post leads into your system.
1. Webhook Configuration
2. Mapping fields
3. Testing and viewing post results
We'll break down each of the above steps below:
Step #1: Configuring Your Webhook
The first step is to configure your webhook. You will need to grab a few things from your CRM. You can usually find this information in your CRM's API documentation or by contacting the support team directly:
- Webhook post URL
- Acceptable data format: most CRMs support JSON, XML, and Multi Part Form Data (LeadCapture.io supports all three)
- An example for how the data should be formatted when posting to the webhook endpoint
- A list of internal field names so you can map all fields in your form to fields in your CRM.
After you get this information from your CRM provider, the next step is to go into your form to begin configuring your webhook.
- Open your LeadForm
- Go to Lead Delivery
- Scroll down to the webhook section and expand
Next you will need to add some information to each of the fields:
- Webhook Post URL: Add the webhook endpoint post URL that is provided by your CRM
- (Not required) Webhook Lead ID field name: This is an advanced field, you can probably skip this step
- (Not required) Webhook Page URL field name: This is an advanced field, you can probably skip this step
- (Not required) Is Auth Enabled? If you need to provide a user name and password and posting the lead to your CRM then toggle this switch to the 'On' position and configure the authentication. Typically most CRMs do not require this. If your CRM does require it then it will be noted within their documentation.
Typically you'll just need to enter the webhook post URL. After you configure the fields above, expand the Custom Data Formatting tab.
- Data Formatting Type: Select the formatting type that your CRM supports. Most CRMs support JSON, XML, and Multi Part Form Data (LeadCapture.io supports all three)
Formatting with JSON
If you select JSON (this is most common) then you'll need to tell LeadCapture.io how to format the data when it's posted to the CRM. Your CRM should provide you with an example for how they want to receive the JSON payload. You can base the formatting on around the example that the CRM provides.
For example: Let's say that you have three fields that you'd like to push into the system. First Name, Email and Phone.
When the wehbook posts to the CRM through, the formatting in JSON might look like this:
{“first_name”: “Name”, “email”: “test@test.com”, “phone”: “+1111111111"}
In our Webhook, we use the variable {{__fields__}} to replace the three fields above. This will dynamically insert whatever fields you're looking to pull into the system.
For example, your JSON formatting might end up looking something like this:
{"root": {"root": [ {{__fields__}} ]}}
And you can click 'Generate sample output data' to see how it will look:
Formatting with XML
If you select XML, then you'll need to set your data wrapper to post the data to the CRM in the proper format. Typically the correct formatting to enter into the field is:
<answers> {{__fields__}}></answers>
Formatting with Form Data
If you select Form Data, then no further formatting is required.
Finally, make sure you click 'Save' in the upper right hand corner of the screen.
---
If you need to push your leads into more than one system, then you have the ability to create multiple Webhooks.
Step #2: Mapping Your Fields
After your Webhook is configured the next step is to map the fields in your LeadForm to the fields in your CRM. Each step that you'd like to post into your CRM will need to have a Webhook Field Name that exactly matches the internal field names of your CRM. If the field is not mapped or if it's not entered, then the post will fail to send.
Now let's cover the process for mapping your field names. We'll cover the following:
- Mapping form steps
- Mapping response steps
1. Mapping form steps
I always like to start with the email address. Typically, as a first test I'll just map some basic contact fields such as name, email, and phone number to the CRM and I'll send a test lead through to see if the data posts.
So let's use email address since all CRMs typically require an email to create the record. To map the email, go to the step of your form that contains the Email field then click on the edit icon:
After the field opens, scroll down to the 'Webhook Settings' and expand the tab and enter the Webhook field name.
In this case, we entered 'email' but please make sure that you use whatever the internal name is for your CRM. Also ensure that the Webhook Field Value Type is set to the proper type. If it's an email field then it's typically a 'String'
Click Save.
Then repeat for all other field type steps (phone number, name, dropdowns, and so on)
2. Mapping response steps
If you need to map a response step, for example a multiple choice question such as 'Are you employed? 'Yes or No' then please follow the steps below:
- Go to the response step that you're looking to map to your CRM
- Scroll down to Advanced Options
- Expand 'Webhook Settings'
- Enter your 'webhook field name' - this should exactly match whatever the internal name is for the field in your CRM.
Repeat for any response that you'd like to map into your CRM.
Step #3: Testing Your Webhook Integration
After you've configured your webhook and mapped your fields and responses, the next step is to send a test lead through. Here are some steps to follow when testing:
- Only send tests through from a live form. We do not post leads from Preview mode. So if you attempt to test from the preview then you will not see the lead post
- Always ensure that at the very least you have mapped your email address
- When testing you can see if a lead posted successfully from the Lead Details page. Go to lead details and click into the lead. You'll see a post status along with the payload that was sent through. This is really useful for troubleshooting, especially when testing.
If you are running into any issues or if you need help with setup, please reach out to support@leadcapture.io