A WebHook is just a push notification from our server to yours. The Form Submit WebHook lets you setup a push notification to your server every time someone submits a form on one of your Unbounce pages.
What can you do with a WebHook?
WebHooks make it easier to integrate two systems. The most common use for our Form Submit WebHook is to feed leads into your CRM. But there are lots of other things you could do as well, such as sending yourself an email or plotting addresses on Google Earth.
What do you need?
The very nature of a WebHook assumes that you have some ability to write code (or bribe a friend or colleague who does). You need to have a server that can accept a POST request (like what you’d get from a form submission), and be able to write a script that does something in response.
Step 1 – Configure the WebHook
To connect your lead-gen form to your server, visit the “Lead-Gen Form Results” area on your landing page overview screen (below the A/B Test Centre) and click the Configure WebHook link. If you just want to test it out, you can use a PostBin URL (from www.postbin.org) as a place to temporarily send your form data and examine the data format.
Step 2 – Write code to accept your form data
Every time someone makes a new form submission on your page, Unbounce will send the following data to your selected URL.
We include the submitter's IP address with the data.json object
The submitted form data in JSON format. For example:
"full_name": ["Steve Jobs"],
"earnings": ["More than you can possibly imagine"],
"what_would_you_like_our_product_to_do?": ["Dice", "Julienne Fries"],
"how_did_you_hear_about_us?": ["Can't Remember"],
The submitted form data in XML format. For example:
<earnings>More than you can possibly imagine</earnings>
The identifier Unbounce uses to uniquely identify your page. Eventually you’ll be able to use this with our API to manipulate and get information about your page. This is a 36-character UUID, for example, “a2838d98-4cf4-11df-a3fd-00163e372d58″.
The name you gave your page, for example “My Guaranteed to Convert Landing Page”.
The URL of the page that contains your form.
This identifies the page variant that the visitor saw when they visited your page, and will be a lower-case letter. The first variant is “a”, the next, “b”, and so on. If you have more than 26 variants the sequence will continue with “aa”, “ab”, etc.
* Be sure to return a 200 response to ensure our webhook sees the post as successful.
URL Parameter Replacement
There's also a handy feature you can use to do some simple customization of the URL you're posting to. You can pass data from your form into parameters in the URL the webhook posts to. This is useful for doing simple mapping of form field names to field names expected by the target script.
Let's say you had a form with a "name" field in it, and you wanted to pass this along as a "customer_name" field. You could specify your webhook's "URL for POST" as follows:
When a form is submitted, we'll replace the "(name)" token with the value of the name field from the form. You can add as many parameters as you like, just be aware that some servers have a limit for how long the query string can be.
Sample PHP Script
Following is a simple PHP script that demonstrates how to accept a POST request from the webhook, and email the results.
Our webhooks will be posted to your servers using known IP addresses (either 184.108.40.206 or 220.127.116.11). You can optionally update your firewall rules to limit posts to your servers from these addresses.