Company Blog Support
Frank Hagan
Updated

Contents

    Back to Top

    Campaign Builder Webhooks

     

    About Webhooks

    A webhook is a way for one application to share data with another application. ONTRAPORT can automate sending Webhooks in Campaigns and in legacy Sequences and Rules (where it is known as a "Ping URL"). ONTRAPORT can also receive a webhook from other applications, or even from itself.

    Webhooks can leverage third party integration platforms such as Zapier and allow you to push ONTRAPORT data into hundreds of other applications. Many applications provide an "endpoint" or webhook URL you can send data to directly, without the use of a third party integration platform. 

    Webhook Basics

    Every webhook needs a webhook URL to receive the data, and the data itself. Different applications will also require transaction details to be included such as an API key and an application ID. You will insert the webhook URL into one field, and then format the data in the Post Data section of the webhook. The use cases below will show you how this is done.

    In general, each piece of data you send in the Post Data section has three parts, a label so the receiving application knows what the data is, an equals sign, and the data itself. Sending a street address could look like this:

    address=2040 Alameda Padre Serra

    In this example the "address" label is what the receiving application has specified it needs to identify the street address data. To pass multiple items you separate them using an ampersand character - &. Adding the city to the post data would look like:

    address=2040 Alameda Padre Serra&city=Santa Barbara

    Enabling Webhooks in ONTRAPORT
    1. You will need to obtain an API Key and Application ID to send data to ONTRAPORT using a webhook. Navigate to Administration Integrations ONTRAPORT API Instructions and Key Manager and create the API Key and Application ID. Copy the keys to a text file for use later.

      Access the API Keys in ONTRAPORT in Administratrion - Integrations

    2. If you are sending a webhook from ONTRAPORT to another application, you may need to have an application ID number or API key from that application.
    3. To send a webhook in a Campaign select the Send a Webhook element from the Advanced tab.

      Add the Send a Webhook campaign element from the Advanced tab

    4. Alternate Methods: To send a webhook from a legacy global Rule, or from a Rule Step in a legacy Date or Step Sequence, choose Ping URL in the Action section

      the Ping a URL action

    Sending a Webhook to Another Application

    In this example we will show how to send ONTRAPORT information using merge fields to another application. The other application allows us to create a contact record by sending the first name and email address. The application requires us to use the label "First_Name" for the first name data, and "Email" as the label for the email data. 

    1. Edit or Create a Campaign
    2. Insert the advanced element, Send a Webhook



    3. In the Add the destination URL section of the Settings enter the other application's webhook endpoint URL. You will obtain this from the other application. 
    4. In the Add the Post data to send field you enter the information you want to send to the other application. You will use the label the other application needs to identify the data, an equals sign, and select the corresponding ONTRAPORT merge field from the drop down. 

      First_Name=[First Name]

    5. To add the next label, equals sign and merge field we use the ampersand symbol "&" to join the data statements. 

      First_Name=[First Name]&Email=[Email]

      Sending a generic webhook

    6. Click Done.

    Test the action of the Send a Webhook element by sending a test Contact through the Campaign and verifying that the data shows up in the other application.

    To use webhooks with Zapier, see our article on Integrating with Zapier.

    Using a Webhook to Add a Contact Record Note

    In this use case we want to add a Note to the Contact Record from within a Campaign in ONTRAPORT. This can be used in lieu of someone from your team manually opening the Contact Record and adding the note. 

    1. Obtain an Application ID and API Key in Administration Integrations ONTRAPORT API Instructions and Key Manager. Copy the values to a text file to be used later.
    2. Add the Send a Webhook campaign element to the Map.
    3. In the Settings Add the destination URL: box paste https://api.ontraport.com/1/Notes
    4. In the Add the Post data to send: box paste the text below:

      Api-Appid=1_111111_111111111&Api-Key=22222222222222&id=0&data=Note inserted by webhook using new API.&author=1&contact_id=[Contact ID]
    5. Replace the "1_111111_11111111" with your App ID number obtained in step 1. Replace the "222222222222222" with the API Key number from step 1.
    6. Replace the text "Note inserted by webhook using the new API." with the text you want to add as a Note.

      Using the Webhook element to add a Note to a Contact

    When the Contact lands on the Send a Webhook element ONTRAPORT will create a Note with the text "Note inserted by webhook using new API." in the Contact Record. 

     

    Articles in this section

    Created - Updated
    Have more questions? Submit a request

    Comments

    Powered by Zendesk