Help Center

Webhook Connection code examples

The Webhook connection allows you to pass BlueConic data to webhooks of external marketing automation platforms and import data returned. The Webhook connection also allows you to define incoming webhooks to BlueConic so external marketing automation platforms can pass data into BlueConic. This page shows examples of outgoing and incoming webhook code requests.

Configuration examples

Here are a few configuration examples to get you started. Click a service to see its settings.

Quickbase

Connect BlueConic to your platform of choice via Quickbase.

Request Method POST
Request URL The webhook URL generated by Quickbase. Something like: https://myApp.quickbase.com/db/bmehtz
Request Headers
Field Name Field Value
Content-Type application/json
Request Body
{
    "email_address": "{{email}}",
    "visits": "{{visits}}"
}
You can send as many profile properties as you want in this JSON format, and configure Quickbase (formerly Cloudpipes) to pick them up.

The Quickbase (Cloudpipes) configuration will look something like this:How to use the BlueConic Webhook Connectionn with Cloudpipes

FullContact

Enrich your contact information using FullContact.

Request Method GET
Request URL https://api.fullcontact.com/v2/person.json?email={{{email.0}}}
Request Headers
Field Name Field Value
X-FullContact-APIKey your API key
Response Mapping
Response Field Profile Property
fullName Name
$.organizations[?(@.current)].name Company
$.organizations[?(@.current)].title Job Title
IFTTT

Connect BlueConic to your platform of choice via IFTTT! Create a webhooks applet in IFTTT as follows:

  1. Select New applet from your user menu.
  2. Click +this.
  3. Search for the service Webhooks and click it.
  4. Click the trigger Receive a web request.
  5. Enter an event name, e.g. "bc_email_changed" and click Create trigger.
  6. Click +that.
  7. Search for the service Email and click it.
  8. Click Send me an email.
  9. Click Create action.
  10. Click Finish.
  11. Click the Webhooks logo in the top left of the applet.
  12. Click Settings.
  13. Copy the URL that looks like https://maker.ifttt.com/use/aJ2FeMm214Lj1wLsTT2-Mrs5hQT3_m1TFT-52DjJOr7 - you will need this to configure the Webhook connection in BlueConic.

In BlueConic, create a Webhook connection with these settings:

Request Method POST
Request URL The webhook URL generated by IFTTT. Something like: https://maker.ifttt.com/use/aJ2FeMm214Lj1wLsTT2-Mrs5hQT3_m1TFT-52DjJOr7
Request Headers
Field Name Field Value
Content-Type application/json
Request Body
{
    "value1": "{{email}}",
    "value2": "{{visits}}",
    "value3": "",
}
The IFTTT "Send me an email" webhook only allows for 3 values to be defined in the request body.
Slack

Have BlueConic chat you up using the Slack API.

Request Method POST
Request URL https://hooks.slack.com/services/XXXXXXXXX/XXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXXX
Request Body
{
    "text": "{{#surname}}{{firstname.0}} {{surname.0}}{{/surname}} visited the product overview!\n"
}
Request Headers
Field Name Field Value
Content-Type application/json
Zapier

Make BlueConic trigger a Zapier webhook Zap! Click Make a new Zap, select type Webhooks and select Catch Hook.

Request Method POST
Request URL In Zapier, click Set up webhook and copy the generated custom webhook URL to the clipboard. Something like: https://hooks.zapier.com/hooks/catch/1234567/f8f22dgg/
Request Headers
Field Name Field Value
Content-Type application/json
Request Body
{
    "email_address": "{{email}}",
    "number_of_visits": "{{visits}}"
}
You can send as many profile properties as you want in this JSON format, and configure the Zapier webhook Zap to pick them up.

Examples of outgoing webhook requests

The webhook connection can trigger a request and send BlueConic data to external applications.
Here is a list of all possible data that can be sent including examples.

Profile properties

{
"id" : {{id}},
"Name" : {{name}},
"Last_name" : {{surname}},
"Email" : {{email}},
"Phone_number" : {{phone.0}} //The first value for the property (nth value),
"Phone_number_2" : {{phone.1}} //The second value for the property (nth value)
}

 

Lifecycle information

{
//Array of lifecycle objects the profile is in
"All_lifecycles" : {{lifecycles}},
//Array of all lifecycle names the profile is in
"All_lifecycle_names" : {{lifecycle_names}},
//Array of all lifecycle ids the profile is in
"All_lifecycle_ids" : {{lifecycle_ids}},
//Array of all stage names the profile is in
"All_lifecycle_stage_names" : {{stage_names}},
//Array of all stage id's the profile is in
"All_lifecycle_stage_ids" : {{stage_ids}},
//Array of all names of the lifecycles and stages the profile is in
"All_lifecycle_names_stages" : {{lifecycle_stage_names}}
}

 

Segment information

{
//Array of all segments the profile is in
"All_segment_names" : {{segments}},
//Array of all segment ids the profile is in
"All_segment_ids" : {{segments_ids}}
}

 

Timeline events

Both front-end and timeline events can be sent to the external application. A prefix is used when including. events in the request body to reduce potential conflicts between event names andies.

Example event:

{
"id" : 124,
"order_value" : 1234,
"order_date" : "1-1-2000"
"products" : [{
"id" : 374856,
"name" : "socks"
},
{
"id" : 1241245,
"name" : "shoes"
}],
"stores" : [{
"id" : 1982749124,
"address" : "someaddress"
},
{
"id" : 0917241lks,
"address" : "streety1"
}]
}

Example request body:

{
//Complete event object including sub-events
"Order_event" : {{event}},
//Order id property
"Order_id" : {{event.id}},
//Array of product objects within the order
"Products" : {{event.products}},
//The first product within the order event (nth value)
"First_product" : {{event.products.0}},
//The name of the first product within the order event (nth value)
"First_product_name" : {{event.products.0.name}},
//The address of the second store within the order event (nth value)
"Second_store_address" : {{eventevent.stores.1.address}}
}

 

Helper blocks

Sometimes the external application likes to receive data in a different format, like stringified JSON, hashed data, or something else. To accommodate for this, data can be encapsulated with helper blocks to transform the data to the desired format.

{
//Normal profile id
"id" : {{id}},
//Array of segment names as stringified JSON
"Segments_as_JSON" : {{#JSON}}{{segments}}{{/JSON}},
//Date of birth property as datetime string
"DoB_as_datetime" : {{#DATETIME}}{{date_of_birth}}{{/DATETIME}},
//Email property base64 encoded
"Email_as_Base64" : {{#BASE64}}{{email}}{{/BASE64}},
//Email property URI encoded
"Email_as_URI" : {{#URIENCODE}}{{email}}{{/URIENCODE}},
//Email property Sha256 hashed
"Email_sha" : {{#SHA256}}{{email}}{{/SHA256}},
//Email property MD5 hashed
"Email_md5" : {{#MD5}}{{email}}{{/MD5}},
}

The helper blocks also work with the newly supported timeline events.

{
//Normal profile id
"id" : {{id}},
//Complete order event as stringified JSON
"Order_as_JSON" : {{#JSON}}{{e.Order}}{{/JSON}},
//Order date as datetime string
"Order_date" : {{#DATETIME}}{{e.Order.order_date}}{{/DATETIME}}
}

Example mustache functions

The following table lists various mustache template tokens that can be used within the Webhook Connection request body template to specify profile attributes to include in the request as well as to perform various actions on the data before the request is sent to the external system.

Variable Description Usage Output Example
id Profile ID {{id}} f1174ca5-84e8-46b9-afba-66b568dba698
<profile property id> The value(s) of a profile property {{email}} [
"john.smith@blueconic.com",
"john.smith@att.net"
]
<profile property id>.<index> The nth value of a profile property {{email.0}}

For a property with multiple email addresses, it returns the first value:

john.smith@blueconic.com

event id The Timeline Event ID for webhooks triggered by events {{event.id}} 12345
event date The Timeline Event date for webhooks triggered by events {{event.eventDate}} Wed Dec 06 2023 19:56:11 GMT+0000 (Coordinated Universal Time)
event property The Timeline Event property for webhooks triggered by events {{event.myProperty}} value from event property
segments Segment names that the profile is part of {{segments}} [
"All Visitors",
"Known Visitors",
"Engagement: High",
"Visitors with a high momentum",
"Visitors with a high intensity",
...
]
segments_id Segment IDs that the profile is part of {{segment_ids}} [
"05e7d74f-bb91-458e-8fec-b8098383dbe2",
"449b940e-a579-44f1-9820-5939b333f3bb",
"67321855-06aa-41a9-a32e-cc28d3a13f3d",
"3596f3e9-dbfe-4407-8f72-1622b1c7c2d8",
"3ae93c9f-d4c0-4711-98d7-e582297207b0",
...
]
lifecycles Returns an array of lifecycle objects the profile is in {{lifecycles}} [
{
lifecycleId: "85cb01ff-6f48-4a09-9bd1-429ef54de85b",
lifecycleName: "Lifecycle name 1",
stageId: "90a01c3b-07e5-4426-b90b-27bde5de8889",
stageName: "Stage 1"
},
{
lifecycleId: "84704b40-b8ff-463f-85a5-5e7b2e658420",
lifecycleName: "Lifecycle name 2",
stageId: "2cd3f857-b6fe-4880-ad97-f0591476f503",
stageName: "Stage 2"
}
]
lifecycle_names Returns an array of all the names of the lifecycles the profile is in {{lifecycle_names}} [
"Lifecycle name 1",
"Lifecycle name 2"
]
lifecycle_ids Returns an array of all the IDs of the lifecycles the profile is in {{lifecycle_ids}} [
"85cb01ff-6f48-4a09-9bd1-429ef54de85b",
"84704b40-b8ff-463f-85a5-5e7b2e658420"
]
stage_names Returns an array of all the names of stages the profile is in {{stage_names}} [
"Stage 1",
"Stage 2"
]
stage_ids Returns an array of all the IDs of stages the profile is in {{stage_ids}} [
"90a01c3b-07e5-4426-b90b-27bde5de8889",
"2cd3f857-b6fe-4880-ad97-f0591476f503"
]
lifecycle_stage_names Returns an array of all the names of lifecycles and stages the profile is in {{lifecycle_stage_names}} [
"Lifecycle name 1: Stage 1",
"Lifecycle name 2: Stage 2"
]
JSON Function to convert values to JSON string {{#JSON}}{{segments}}{{/JSON}} "[\"All V isitors\", \"Known Visitors\", \"Engagement: High\", \"Visitors with a high momentum\", \"Visitors with a high intensity\"]"
DATETIME Function to convert timestamp to ISO DateTime string {{#DATETIME}}{{visitdate}}{{/DATETIME}} 2022-07-21T22:04:13.217Z
BASE64 Function to convert a value to a base64 encoded string {{#BASE64}}{{email.0}}{{/BASE64}} ZXJpYy5naWxyZWF0aEBibHVlY29uaWMuY29t
URIENCODE Function to convert a value to a URI encoded string {{#URIENCODE}}{{email.0}}{{/URIENCODE}} john.smith%40blueconic.com
SHA256 Function to convert a value to a SHA256 hashed string {{#SHA256}}{{email.0}}{{/SHA256}} 23d27c6435e080171cbcc19f830a1e5f35fd78258d64c0005e9034e33b07add7
MD5 Function to convert a value to a MD5 hashed string {{#MD5}}{{email.0}}{{/MD5}} acef13b224fb37365160a9dcd0a098f6

JOIN

#separator

Function to concatenate array data without trailing separator, will use the array between the first brackets {{#JOIN}}{{#lifecycles}}{{lifecycleName}}{{#separator}} / {{/separator}}{{/lifecycles}}{{/JOIN}} Lifecycle name 1 / Lifecycle name 2
conditional Print a value {{#email}}{{email}}{{/email}}

john.smith@blueconic.com

When the profile has a value for email

conditional inverse Print a value when there is no value for another property {{^global_id}}{{id}}{{/global_id}}

f1174ca5-84e8-46b9-afba-66b568dba698

When the profile does not contain a value for global_id

 

Was this article helpful?
0 out of 0 found this helpful