Unbounce Answers/Integrations/Webhook

Using a Webhook

Oli Gardner
posted this on October 21, 2010 05:55 PM

What’s a WebHook?

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.

Note:

  • We include the submitter's IP address with the data.json object
ParameterDescription
data.json

The submitted form data in JSON format. For example:

{
  "full_name": ["Steve Jobs"],
  "email_address": ["steve@apple.com"],
  "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"],
  "ip_address": "238.17.159.4"
}
data.xml

The submitted form data in XML format. For example:

<?xml version='1.0'?>
<form_data>
  <full_name>Steve Jobs</full_name>
  <email_address>steve@apple.com</email_address>
  <earnings>More than you can possibly imagine</earnings>
  <what_would_you_like_our_product_to_do?>
    <entry>Dice</entry>
    <entry>Julienne Fries</entry>
  </what_would_you_like_our_product_to_do?>
  <how_did_you_hear_about_us?>Can't Remember</how_did_you_hear_about_us?>
  <ip_address>238.17.159.4</ip_address>
</form_data>
page_id 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″.
page_name The name you gave your page, for example “My Guaranteed to Convert Landing Page”.
page_url The URL of the page that contains your form.
variant 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.

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:

http://mygreatcompany.com/some_script.php?customer_name=(name)

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.

 

Security

Our webhooks will be posted to your servers using known IP addresses (either 54.241.34.25 or 50.19.99.184).  You can optionally update your firewall rules to limit posts to your servers from these addresses.

 

Comments

User photo
Keshab Dey

Thanks for the guidance, found this useful while integrating.

March 21, 2011 04:24 AM
User photo
Ryan Kelly

Does anyone have any specific code samples for posting to SalesForce?

May 26, 2011 06:18 AM
User photo
Ryan Kelly
May 26, 2011 06:21 AM
User photo
Andrew Menzies

Hi can you use the "URL Parameter Replacement" to parse values from one Unbounce Form to another Unbounce Form?

September 20, 2011 10:54 PM
User photo
Brian Roseman

How about providing a sample script for posting over to ASP. NET?

December 22, 2011 11:47 AM
User photo
Michael Davis

I am looking for something along the same lines as James. I want to pass the email captured on the lead form into an email sign up box on the Thank You / Confirmation page. 

February 03, 2012 04:14 PM
User photo
Ryan Engley
Unbounce

Hi Michael, form values are now passed as query parameters to the confirmation dialog and can also be passed to another page.  You see see how to set this up in the Forms and Form Data section of our user guide.

July 23, 2012 04:49 PM
User photo
william konstand

Does this work with intuit crm system?

September 23, 2012 05:58 PM
User photo
Jacquelyn Ma
Unbounce

Hi William, unfortunately although we cannot speak on the Intuit system directly hence the need for using a WebHook to send leads from an Unbounce page to Intuit, I will say that if you can configure the WebHook POST script as described in the article above, this should allow leads to successfully send from an Unbounce page to Intuit.

For the most part, just like other CRM systems, we would recommend on taking note of the data format that is accepted into Intuit and configure the WebHook as such to enable this integration. Examples depending on this format, are provided above. 

September 24, 2012 03:05 PM
User photo
Brian Alexander

Is there a way to pass variant, page_url, and a custom field (such as a checkbox value) with the parameter replacement method?

I've tried using "(variant)", "(page_url)", and "(custom_checkbox)", but they aren't passed in the post URL.

November 14, 2012 04:13 PM
User photo
Brian Alexander

Oops -- correction, I DID get the custom field to pass. However, in the case of a checkbox, if nothing is checked (no value) then the value passed in the querystring is the token for that field, e.g. "&parameter=(my_checkbox)".

The variant and page_url would be a great win -- interestingly, ip_address does work while these others don't.

November 14, 2012 04:17 PM
User photo
Jeff Russell

Anyone have success with a Constant Contact hook?

March 14, 2013 12:03 PM
User photo
Troy Muir

Has anyone been able to integrate Unbounce with Get Response?

May 04, 2013 05:07 PM
User photo
Trevor Goss

Anyone have any guidance on how you would use this method with to send leads into marketo?

June 05, 2013 11:14 AM
User photo
Finge Holden

We are having some difficulties with the webhook and check-boxes. When there are multiple options to check only the first variable is passed through the webhook.... 

Any help appreciated :-)

 

 

June 20, 2013 05:45 AM
User photo
Steve Fabry

Hi there,

I do integration with ASP.NET.  I am reading using:

protected void Page_Load(object sender, EventArgs e)
{
Page.Response.ContentType = "application/x-www-form-urlencoded";
StreamReader reader = new StreamReader(Page.Request.InputStream);
String xmlData = reader.ReadToEnd();

}

 

Unfotunely, the POST contains something else, because it causes Internal Server Error on IIS.

 

Can anyone help me?

 

August 27, 2013 10:55 AM
User photo
Danil Lesovodskiy

Hi Steve, you should use:

String xmlData = Request.Form["data.xml"];

 

September 19, 2013 06:44 AM
User photo
David Mackey

Our POST method requires us to map the form fields to specific field names and to also pass authentication credentials to the POST url.

How can I edit the data mapping to achieve this?

October 04, 2013 11:56 PM
User photo
john ray

I tried this example but not working. 

The post url is http://domain_name/post_unbounce.php

I tried to print the values on the web page but no luck.

echo $page_id = $_POST['page_id'];
echo $page_url = $_POST['page_url'];
echo $variant = $_POST['variant'];

December 18, 2013 09:37 PM
User photo
Johnny Opao
Unbounce

Hi John - Can you double check your post url. The url you provided appears to be an incomplete/invalid link. 

I'm also going to open up a support ticket for you so we can troubleshoot this and any additional issues that may arise.

December 19, 2013 03:34 PM
User photo
nadia williams

Has anyone been able or know how I can use Listwire.com free autoresponder with this?

January 29, 2014 10:03 AM
User photo
Mohammed Faris

Hi,

Because there is no integration with GetResponse as of today, Is it possible to use the hooks with GetResponse in order to transfer the leads to GetResponse campaign?

An integration with GetResponse similar to Aweber would really be helpful.

Please let me know.

Cheers,

Mohammed

March 23, 2014 07:39 AM
User photo
Johnny Opao
Unbounce

Hey Mohammed - That should be possible if you write up a webhook script to handle that transfer. If your looking to save a bit of time on creating a webhook integration, you may want to check out Zapier. They provide a webhook integration between Unbounce and GetResponse:

https://zapier.com/zapbook/unbounce/getresponse/14087/save-unbounce...

As for a direct integration - We are in talks with GetResponse in building one out. There's no ETA yet but you'll be sure to hear from us when we do.

March 24, 2014 03:56 PM