- Its possible to send a webhook or API call from LH into the Ontraport API.
- They have quite a large set of functions.
- In this example we will be creating a new contact with data about them.
- The official documentation is located here: http://api.ontraport.com/doc/#create-a-contact
Step 1: Get your API key
Step 2: Get your App ID
These credentials can be requested in your Administration settings.
To setup the webhook ( or api ) node in LeadsHook
Step 3: Now add a webhook node ( or api node ) onto your canvas
We need to set it up like so:
Title: can be any description for your webhook/api node
Method: must be POST to create a new contact
Request URL: https://api.ontraport.com/1/Contacts
Note: If you want to update a contact instead, you may use the request URL below: https://api.ontraport.com/1/Contacts/saveorupdate
This url will try to update if the contact is already existing in Ontraport, if not then it will create a a new contact instead.
Data:
In this example we are using JSON format.
The left hand side of the Data ( the keys ) are listed on the Ontraport API spec.
You can see I have added “firstname”, “lastname”, and “email”. But you can add as many as you need. Just lookup the key names on the Ontraport API spec ( http://api.ontraport.com/doc/#create-a-contact )
On the right hand side of the JSON Data ( the values ) are the LeadsHook custom fields you captured in your Decision tree. {first_name}, {last_name}, and {email} in this example.
Both keys & values must be surrounded by double quotes.
And each pair has a colon between them.
Finally each line has a comma at the end. Except for the last line.
The Headers:
Api-Key on the left and its value on the right
Api-Appid on the left and its value on the right
Content-type on the left and application/json on the right
IMPORTANT: As for the custom fields that you want to pass to Ontraport Like, Gender or any other fields that are not included as default parameters which are listed below. They need to be created within your Ontraport account as custom fields and Ontraport will then assign an ID to them which you will need to send over Leadshook Custom Fields to Ontraport. Refer to the guide at the bottom of this page on how to get the field ID/Alias
You can refer the complete list of the default Fields that you can map in Ontraport here: http://api.ontraport.com/doc/#merge-or-create-a-contact
HOW TO GET THE Custom Field ID:
Step 1: Go here: https://api.ontraport.com/live/#!/Contacts/getMeta
Step 2: Enter your API key and API ID at the top of the page.
Step 3: Click Get /Contacts/Meta then click “Try it out” This will grab all info from all existing fields within your Ontraport account which includes the Field IDs.
And on the response body, you should see all the info of the fields including the field ID which is highlighted below.
Step 5: For this example, as you can see from the image above. The field “sex-gender” uses the field ID f1921. You can then use this ID to send over your gender custom field from Leadshook to Ontraport by using it on your webhook/API JSON payload. This will map it to your Ontraport Sex-Gender custom field and it will then transfer properly.