Skip to content
Last updated

Customer.io Export Integration

The Customer.io Export Connector lets you push Treasure Data CDP query results into Customer.io to keep profiles and segments in sync after each workflow run. Use it when you need to activate CDP-unified customer data — such as high-value segments or behavioral attributes — in your Customer.io campaigns without a manual export step. The connector supports profile upsert and remove operations via the Tracking V2 API, and can add or remove customers from segments with automatic segment creation.

  • Profile Operations - Create, update, or remove customer profiles via Tracking V2 API.
  • Segment Management - Add or remove customers from segments with automatic segment creation.
  • Multiple Identifiers - Support for id, cio_id, and email as customer identifiers.
  • Automatic Region Resolution - Dynamic endpoint discovery via Customer.io's Track Region API.
  • Batch Processing - Efficient bulk operations with configurable error handling.

Prerequisites

  • Basic knowledge of Treasure AI
  • Customer.io account with API access
  • Valid Customer.io App API Key, Site ID, and API Key
  • Authorized Treasure AI account access

Requirements, Limitations, and Behavior

  • At least one identifier (cio_id, id, or email) must be present in each record
  • Using email as identifier requires enabling email identification in Customer.io workspace settings
  • The cio_relationships field is automatically excluded from attribute mapping
  • Segments are automatically created if they don't exist when using segment operations
  • Customer.io implements rate limiting; the connector handles retries with exponential backoff

Static IP Address of Treasure Data Integration

If your security policy requires IP whitelisting, you must add Treasure Data's IP addresses to your allowlist to ensure a successful connection.

Please find the complete list of static IP addresses, organized by region, at the following document

Use the Treasure Console to Create Your Connection

Create a New Connection

In Treasure AI, you must create and configure the data connection, to be used during export, prior to running your query. As part of the data connection, you provide authentication to access Customer.io.

  1. Open Treasure Console.

  2. Navigate to Integrations Hub > Catalog. Hub Catalog

  3. Search for and select Customer.io. Select Create Authentication. Authentication

  4. The following dialog opens. Edit the parameters. Select Continue.

ParametersDescription
App API KeyYour Customer.io App API Key (required). Used for segment management operations. Generate this from your Customer.io account's API credentials section.
Site IDYour Customer.io Site ID (required). Used as username for Tracking API authentication. Found in your Customer.io workspace settings.
API KeyYour Customer.io API Key (required). Used as password for Tracking API authentication. Generate this from your Customer.io account's API credentials section.
  1. Enter a name for your connection.
  2. Choose to share the authentication with others or not.
  3. Select Done.

Configure Export Results in Your Data Connection

In this step, you create or reuse a query. In the query, you configure the data connection.

Configure the Connection by Specifying the Parameters

  1. Open the Treasure Console.
  2. Navigate to Data Workbench > Queries.
  3. Select the query that you plan to use to export data.
  4. Select Export Results located at top of your query editor. The Choose Integration dialog opens.

You have two options when selecting a connection to use to export the results, using an existing connection or creating a new one.

Use an Existing Connection

  1. Type the connection name in the search box to filter.
  2. Select your connection.
  3. The Export Results dialog opens.
  4. Set the following parameters and select Done.

Export Result Config

ParametersDescription
Data TypeThe target data type: PROFILES (profile operations) or SEGMENTS (segment membership operations)
Operation Mode (Profiles)Profile operation mode: UPSERT (create/update) or REMOVE (delete). Only used when Data Type is PROFILES
Operation Mode (Segments)Segment operation mode: ADD (add to segment) or REMOVE (remove from segment). Only used when Data Type is SEGMENTS
Segment NameTarget segment name (required when Data Type is SEGMENTS). Segment will be created if it doesn't exist
ID TypeType of identifier: id, cio_id, or email. Note: Using email requires enabling email identification in Customer.io workspace settings
Skip Invalid RecordSkip records that fail validation instead of aborting the job
Skip Error BatchContinue processing on API batch errors instead of failing the job

Create a New Customer.io Connection

  1. Select New Integration and select Customer.io from Type dropdown.
  2. The Create Integration dialog opens.
  3. Select the Catalog link to go to the Catalog page.
  4. Complete the steps described previously in "Create a new connection".
  5. Enter the required credentials for your new Customer.io connection.

Column Names for the Query

The Customer.io export connector understands and interprets the following columns and data types. You must modify alias column names to match with the following specified columns.

At least one identifier (cio_id, id, or email) must be present in your data.

The following table describes the columns available for Customer.io export integration:

Column nameTypeRequiredDescription
cio_idstringconditionalCustomer.io internal ID (highest priority identifier). Used when available for most reliable matching.
idstringconditionalExternal customer ID (medium priority). Used when cio_id not available.
emailstringconditionalCustomer email address (lowest priority). Used when neither cio_id nor id available. Requires enabling email identification in Customer.io workspace settings.
Any other columnvariousoptionalCustom attributes mapped directly to Customer.io customer attributes. The cio_relationships field is automatically excluded.

Identifier Logic: The connector validates the presence of the identifier field specified by the id_type configuration parameter. Records must contain the required identifier field to be processed successfully.

Sample Queries

Profile Operations

-- Profile upsert with 'id' identifier
SELECT
  customer_id AS id,
  email_address AS email,
  first_name,
  last_name,
  signup_date,
  total_orders,
  lifetime_value
FROM customer_profiles
WHERE TD_TIME_RANGE(time, TD_DATE_TRUNC('day', TD_SCHEDULER_TIME() - 86400, 'UTC'), NULL)

Segment Operations

-- Add customers to segment
SELECT
  customer_id AS id,
  email_address AS email,
  first_name,
  last_name
FROM high_value_segment
WHERE TD_TIME_RANGE(time, TD_DATE_TRUNC('day', TD_SCHEDULER_TIME() - 86400, 'UTC'), NULL)

Using Different ID Types

-- Using Customer.io internal ID (cio_id)
SELECT
  cio_customer_id AS cio_id,
  first_name,
  last_name,
  plan_type
FROM customer_profiles

-- Using email as identifier
SELECT
  email,
  first_name,
  last_name,
  subscription_status
FROM customer_profiles

(Optional) Schedule Query Export Jobs

You can use Scheduled Jobs with Result Export to periodically write the output result to a target destination that you specify.

Treasure Data's scheduler feature supports periodic query execution to achieve high availability.

When two specifications provide conflicting schedule specifications, the specification requesting to execute more often is followed while the other schedule specification is ignored.

For example, if the cron schedule is '0 0 1 * 1', then the 'day of month' specification and 'day of week' are discordant because the former specification requires it to run every first day of each month at midnight (00:00), while the latter specification requires it to run every Monday at midnight (00:00). The latter specification is followed.

Scheduling your Job Using Treasure Console

  1. Navigate to Data Workbench > Queries

  2. Create a new query or select an existing query.

  3. Next to Schedule, select None.

  4. In the drop-down, select one of the following schedule options:

    Drop-down ValueDescription
    Custom cron...Review Custom cron... details.
    @daily (midnight)Run once a day at midnight (00:00 am) in the specified time zone.
    @hourly (:00)Run every hour at 00 minutes.
    NoneNo schedule.

Custom cron... Details

Cron ValueDescription
0 * * * *Run once an hour.
0 0 * * *Run once a day at midnight.
0 0 1 * *Run once a month at midnight on the morning of the first day of the month.
""Create a job that has no scheduled run time.
 *    *    *    *    *
 -    -    -    -    -
 |    |    |    |    |
 |    |    |    |    +----- day of week (0 - 6) (Sunday=0)
 |    |    |    +---------- month (1 - 12)
 |    |    +--------------- day of month (1 - 31)
 |    +-------------------- hour (0 - 23)
 +------------------------- min (0 - 59)

The following named entries can be used:

  • Day of Week: sun, mon, tue, wed, thu, fri, sat.
  • Month: jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec.

A single space is required between each field. The values for each field can be composed of:

Field Value Example Example Description
A single value, within the limits displayed above for each field.
A wildcard '*' to indicate no restriction based on the field.'0 0 1 * *'Configures the schedule to run at midnight (00:00) on the first day of each month.
A range '2-5', indicating the range of accepted values for the field.'0 0 1-10 * *'Configures the schedule to run at midnight (00:00) on the first 10 days of each month.
A list of comma-separated values '2,3,4,5', indicating the list of accepted values for the field.'0 0 1,11,21 * *'Configures the schedule to run at midnight (00:00) every 1st, 11th, and 21st day of each month.
A periodicity indicator '*/5' to express how often based on the field's valid range of values a schedule is allowed to run.'30 */2 1 * *'Configures the schedule to run on the 1st of every month, every 2 hours starting at 00:30. '0 0 */5 * *' configures the schedule to run at midnight (00:00) every 5 days starting on the 5th of each month.
A comma-separated list of any of the above except the '*' wildcard is also supported '2,*/5,8-10'.'0 0 5,*/10,25 * *'Configures the schedule to run at midnight (00:00) every 5th, 10th, 20th, and 25th day of each month.
  1. (Optional) You can delay the start time of a query by enabling the Delay execution.