How can we help?

Stream Event data to Tealium’s Customer Data Hub in real time

Tealium Setup

  1. Log into your Tealium Customer Data Hub server-side account.

Add a new Data Source

  1. Navigate to Sources > Data Sources located on the left menu bar.
  2. Click on the “Add Data Source” button. 
  3. Under the “Developer Languages” category, select the “HTTP API”.
  4. Input a name for your new data source (e.g., “Cordial”) and click “Continue”.
  5. Click “Continue” once more to proceed to choose a Tealium Event Specification.
  6. You may select Event Specifications for your Cordial events or you may click the “Skip” button and create new custom event specs later.

Get Base Code

  1. As the last step, you should be presented with the base code where you may click “Download as PDF” located in the top-right corner. 

Data Source Screenshot.png

Cordial Setup

  1. Log into your Cordial admin account.
  2. Navigate to Integrations > Webhooks located on the left menu bar.
  3. Click on the “New” button to add a new webhook.
  4. Enter a name (e.g. “Tealium HTTP API”) and click “Continue”.
  5. Click the “Edit” button and input the following as the webhook URL:

Trigger Events

  1. Select the events you would like to stream to Tealium, and then click “Save”.

Webhook Payload

  1. Click the “Edit” button, and build your request payload for Tealium’s HTTP API endpoint using SMARTY syntax.
  2. Copy and paste the example code below.  Make sure to change the values for tealium_account, tealium_profile, and tealium_datasource to match your Tealium account, profile, and data source key (refer to your base code PDF from the Tealium Setup instructions above):

{* A helper function to flatten a data object – DO NOT MODIFY *}

{function flatten data=[] next_key='' result=[]}{capture name="clearout"}{foreach $data as $key => $value}{if not empty($value)}{if is_array($value) and not isset($value[0])}{if $next_key}{$next_key = $next_key|cat:'.'}{/if}{$result = json_decode({flatten data=$value next_key=$next_key|cat:$key result=$result}, 1)}{else}{if $next_key}{$result[$next_key|cat:'.'|cat:$key] = $value}{else}{$result[$key] = $value}{/if}{/if}{/if}{/foreach}{/capture}{json_encode($result)}{/function}

{* Flatten the Cordial event data object *}
{$event = json_decode({flatten data=$event}, 1)}

{* 1. Tealium Parameters - Replace with your own settings *}
{* Required *}
{$payload['tealium_account'] = 'my-account'}
{$payload['tealium_profile'] = 'my-profile'}

{* Optional: HIGHLY Recommended *}
{$payload['tealium_datasource'] = 'abcdef'}
{$payload['tealium_event'] = 'cordial_'|cat:$event.action}

{* For Tealium debugging purposes *}

{* {$payload['tealium_trace_id'] = ''} *}

{* 2. Set up a mapping table - Cordial to Tealium *}
{$mapping = [
 'a' => 'cordial_event',
 'chnl' => 'cordial_channel',
 'chnl-type' => 'cordial_channel_type',
 'cID' => 'cordial_contact_id',
 'msID' => 'cordial_message_id',
 'mcID' => 'cordial_message_contact_id',
 'ts' => 'cordial_timestamp',
 'ats' => 'cordial_event_action_timestamp',
 'tzo' => 'cordial_timezone_offset',
 'sp.mTags' => 'cordial_message_tags',
 'sp.ed' => 'cordial_email_domain'

{* Start explicitly mapping over the data *}
{foreach $event as $key => $value}
 {if not empty($value) and isset($mapping[$key])}
   {$payload[$mapping[$key]] = $value}

{* 3. Optional: Append contact data here  *}
{$payload['customer_email'] = $}

{* Set the final payload for webhook *}



Note: This example code has been tested for the email channel only.  Please make adjustments as needed to work with other channels (e.g., SMS, Rest, Custom, etc.).

Customizing the Payload

The example SMARTY code provided in the previous step can be customized further to meet your Tealium taxonomy.


You can learn more about SMARTY syntax here:


Using Live Events in Tealium

  1. Navigate to EventStream > Live Events located on the left menu bar.
  2. Select your new data source and click the “Apply” button:
  3. You should now be able to see incoming events from Cordial’s webhook while you are testing from Cordial’s platform.  It will look something like this:
    You can click on the recorded event to see more detail:

Sending a Test in Cordial

  1. Once you have successfully edited and saved your webhook payload, you will be able to use the “Test” button.

    Click the “Test” button located on the left panel.
  2. You will be presented with a “Send Test” modal.  Search and select an event to test.

  3. Once you click on the event that you want to test, it will immediately trigger the webhook to Tealium.

    If triggered successfully, you should have received a 200 OK response like the one below:



If you have any issues. Please reach out to your Cordial CSM or Cordial Support at



Please sign in to leave a comment.