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
User photo
Margie Agin

HI- has anyone tried to post to a list in icontact?

 

May 09, 2014 08:04 AM
User photo
Quinn Omori
Unbounce

Hi Margie - I know iContact has an API that should let you use a webhook to integrate an Unbounce form fill and push it into your iContact account, but if you're not a coder (or don't have someone on hand who is), another option would be to use an iContact form and embed it in a custom HTML element.

You can use that in tandem with our External Conversion Tracking (http://support.unbounce.com/entries/334187-Setting-Up-External-Conv...) and you'll be able to get those form fills into iContact and still track your conversions as well.

May 09, 2014 11:50 AM
User photo
Robert Rushing

Anyone successfully posted to Velocify/Leads360?

July 14, 2014 03:58 PM
User photo
Quinn Omori
Unbounce

Hi Robert - I haven't done it myself, but I took a look at the Velocify documentation and it should be possible (I actually investigated it for someone a few months ago--though they never got back to me to let me know if they tried to set it up or not). 

You should be able to connect an Unbounce form via webhook to one of Velocify's Lead Post Integration Forms.

Velocify's set-up guide is here: http://lmhelp.velocify.com/hc/en-us/articles/201364934-How-To-Basics-Setup-a-website-to-posts-leads-into-Velocify

Our webhooks push data in a variety of formats, but that includes XML format, which Velocify says they accept.

In Velocify, you'll need to map your Unbounce form fields to the Lead Post Integration Form fields, so the important thing to note here is the way Unbounce formats field names when it pushes XML via webhook. All of your field names will be pushed as lower case, any punctuation will be removed, and spaces will be replaced by underscores. So, a field name of First Name in Unbounce becomes first_name when it's pushed via webhook.

Once the Velocify side is set-up, you'll just need to add the Velocify form URL that they provide to as your webhook URL and I think that should do the trick

July 14, 2014 04:08 PM
User photo
Carol Boniface

For anyone looking to track down the link in Ryan's Post from 5/26/11, which is now dead, here is is:

Way-back-machine cache for Colin's original article: https://web.archive.org/web/20110712153812/http://colinloretz.com/2...

Bonus: updated dead link from the article: PHP Script for Webhook to SalesForce: https://github.com/colinloretz/leadhooks

 

July 22, 2014 06:57 AM
User photo
David Beentjes

Hi,

Does anyone know a way to resend old leads to the webhook (those which have been send before)? Or is it best to export them to CSV, translate them to JSON myself and reuse them in my integration script?

Regards,

Sander

 

July 28, 2014 01:35 AM
User photo
Quinn Omori
Unbounce

Hi Sander - You're not able to fire the webhook manually after a lead has already been submitted, so you'll have to use the .csv export for any old leads. Any form fills going forward should push over automatically though.

July 28, 2014 09:09 AM
User photo
FRANCISCO RIOJAS

Should API Key for my URL POST be passed a Query Parameter too? or as part of the URL?

 

Thanks

August 03, 2014 01:19 PM
User photo
Johnny Opao
Unbounce

Hey Francisco - It depends on the service your posting you webhook to. In most cases it's passed in as a part of the URL within the querystring.

August 04, 2014 12:43 PM
User photo
FRANCISCO RIOJAS

I am trying to post into Zoho Creator, when i test the URL using runscope. I get no error, but no "success" confirmation either and the record data does not go through. Agrr!!!  Do I need to map the unbounce fields to my 3rd party forms? i.e. pageid, page variation , etc Is there a way to test server response on your end?

August 09, 2014 10:23 AM
User photo
Johnny Opao
Unbounce

Hey Francisco - Keep in mind that we send the data in XML+JSON packaged together. I haven't used Zoho Creator myself but be sure that's the type of data they can accept.

As for checking responses we only display two states: Failed or Successful. If we get a 200 response we consider it successful, otherwise it's considered failed. Unfortunately other than this we don't display much responses given back by your server.

You can see if a lead was successful by hitting 'view leads' and clicking on a individual lead submission to view it's integration details

http://screencast.com/t/eyOVXPqu

If your curious how the exact data looks like when posted via webhook, I recommend setting your webhook URL to a requestbin URL:

http://requestb.in/

That way to can prepare your receiving server to accept the appropriate data.

If Zoho creator is looking for standard field&value formatted data, then using our forms 'POST form data to a URL' would be a much more appropriate method:

http://support.unbounce.com/entries/341373-How-do-I-POST-my-form-re...

 

August 11, 2014 01:11 PM
User photo
roger lopez

Hi,

Has anyone anyone tried to do this using Salesfusion? Any help would be great! I can't figure out how the URL Salesfusion gives me should be formatted correctly to work with the Webhook.

Thanks,

Cat  

September 11, 2014 07:39 AM
User photo
Quinn Omori
Unbounce

Hi Cat,

If you've got something like this from Salesfusion:

https://www.msgapp.com/RESTForm.aspx? Customer=chyourcustomerID=1&ownerid=2&overwrite=0&DialogID=4&rurl=http://www.yourdomain.com&FirstName={FirstName}&LastName={LastName}&Email={Email}&Phone={Phone}&PostalCode={PostalCode}&submit=Submit+Query

You'll need to change the values in the squiggly brackets to match the field names in Unbounce.

By default, our field names are whatever your field label is, all lower case and with an underscore replacing any spaces (so, First Name becomes first_name and you'd need to replace {FirstName} with {first_name} in your Salesfusion RestURL). If you're unsure of what the Unbounce field names are, you can also view them inside the app by opening up your form in the Page Builder, clicking on the field and looking for the grey text below the field label:

2014-09-11_0937.png

If you have any questions about the RestURL or yours looks quite different than what I have above, I know Salesfusion has some documentation that they were able to provide a few other Unbounce customers that were looking to connect Unbounce and Salesfusion via webhook, so they should be able to provide you with the same (unfortunately, we weren't given a copy)

September 11, 2014 09:40 AM
User photo
Marcos Gil Fuertes

What about weird characters on field names? For example, "teléfono".

Thanks!

September 12, 2014 05:27 PM
User photo
Quinn Omori
Unbounce

Hi Marco - accented letters have their own characters, so we will push them to lowercase (if they aren't already), but the accents will stay. So, if your Unbounce field is labeled "teléfono" the form name will be "teléfono" as well.

September 14, 2014 03:34 PM
User photo
Matt Roberts

Hi

Is there a way of removing the built-in validation on Unbounce when using the form. We have our own validation that we call and then re-direct. However, it's messy and I hope there is a more logical way of doing it.

Our solution has been so:

1. Use the Unbounce submit form
2. Have one mandatory field that is hidden
3. As the user cannot enter data for this field, the Unbounce validation fails and so the inbuilt redirect does not occur
4. Our code hides the mandatory fields' validation pop up and in turn executes our own validation.  
5. This 'mandatory' field hidden pop up box is then displayed if any of our validations fail with custom messaging
6. If our validation is passed we then re-direct to another page. (and thus ignore the inbuilt Unbounce re-direct)

What are your thoughts? There must be a better way.

Cheers

 

September 19, 2014 03:26 AM
User photo
Johnny Opao
Unbounce

Hey Matt - There's no way to do what you're looking to do without adding custom code and pretty much breaking the functionality of our form. It may be possible to do so but we don't advise it nor can we provide support in doing so.

In cases like this it may be better just to build your own form using HTML. However this way we have no way of tracking the leads

September 19, 2014 10:51 AM
User photo
Matt Roberts

Hi Johnny, thanks for getting back to me.

Rather than give you our solution I'll rephrase and give you the problem. 

All we want to do is perform custom validation by calling our validation API via Json. If the response is success and the details pass our custom validation we would still like to use the inbuilt webhook and re-direct features of Unbounce as per normal

I think this may solve our problems: http://unbouncepages.com/formtest-1/ and wondered whether you knew is it was a sufficient solution.

 

September 22, 2014 04:11 AM
User photo
Johnny Opao
Unbounce

Hey Matt - I don't think that 'Custom Validation' page would be much help to what you're trying to do.

That solution allows you to add additional validation rules but doesn't (at least from what I can observe) allow you to make json/http calls in order to validate.

What your looking to do is still really custom. The only approach I can see this working is if you unbind the forms button somehow and only allow the submission through if the appropriate response is given back from your validation server/API. This may very well be possible, but I don't have any pointers as to how this can be done.

September 22, 2014 12:56 PM