Skip to content

mak # Customer.io

Customer.io is a customer engagement platform that enables businesses to send automated messages across email, push, SMS, and more.

ingestr supports Customer.io as a source.

URI format

The URI format for Customer.io is as follows:

plaintext
customerio://?api_key=<api-key>&region=<region>

URI parameters:

  • api_key: The API key for authentication with the Customer.io API.
  • region: The region of your Customer.io account. Must be either us (default) or eu.

The URI is used to connect to the Customer.io API for extracting data.

Setting up a Customer.io Integration

To get your API key:

  1. Log in to your Customer.io account
  2. Go to Account Settings > API Credentials
  3. Create a new App API Key with read permissions

Once you have your API key, here's a sample command that will copy the data from Customer.io into a DuckDB database:

sh
ingestr ingest \
  --source-uri 'customerio://?api_key=your_api_key&region=us' \
  --source-table 'broadcasts' \
  --dest-uri duckdb:///customerio.duckdb \
  --dest-table 'customerio.broadcasts'

The result of this command will be a table in the customerio.duckdb database.

Tables

Customer.io source allows ingesting the following sources into separate tables:

TablePKInc KeyInc StrategyDetails
activitiesidreplaceRetrieves account activity log.
broadcastsidupdatedmergeRetrieves broadcast campaigns.
broadcast_actionsidupdatedmergeRetrieves actions for broadcasts.
broadcast_action_metrics:periodbroadcast_id, action_id, period, step_indexreplaceRetrieves metrics for broadcast actions. Period: hours, days, weeks, months.
broadcast_messagesidmergeRetrieves messages sent by broadcasts.
broadcast_metrics:periodbroadcast_id, period, step_indexreplaceRetrieves metrics for all broadcasts. Period: hours, days, weeks, months.
campaignsidupdatedmergeRetrieves triggered campaigns.
campaign_actionsidupdatedmergeRetrieves actions for campaigns.
campaign_action_metrics:periodcampaign_id, action_id, period, step_indexreplaceRetrieves metrics for campaign actions. Period: hours, days, weeks, months.
campaign_messagesidmergeRetrieves messages/deliveries sent from campaigns.
campaign_metrics:periodcampaign_id, period, step_indexreplaceRetrieves metrics for all campaigns. Period: hours, days, weeks, months.
collectionsidupdated_atmergeRetrieves data collections.
customerscio_idreplaceRetrieves all customers/people in the workspace.
customer_activitiesidreplaceRetrieves activities performed by each customer.
customer_attributescustomer_idreplaceRetrieves attributes for each customer.
customer_messagesidmergeRetrieves messages sent to each customer.
customer_relationshipscustomer_id, object_type_id, object_idreplaceRetrieves object relationships for each customer.
exportsidupdated_atmergeRetrieves export jobs.
info_ip_addressesipreplaceRetrieves IP addresses used by Customer.io.
messagesidmergeRetrieves sent messages.
newslettersidupdatedmergeRetrieves newsletters.
newsletter_metrics:periodnewsletter_id, period, step_indexreplaceRetrieves metrics for all newsletters. Period: hours, days, weeks, months.
newsletter_test_groupsidreplaceRetrieves test groups for newsletters.
object_typesidreplaceRetrieves object types in the workspace.
objectsobject_type_id, object_idreplaceRetrieves all objects for each object type.
reporting_webhooksidreplaceRetrieves reporting webhooks.
segmentsidupdated_atmergeRetrieves customer segments.
sender_identitiesidreplaceRetrieves sender identities.
subscription_topicsidreplaceRetrieves subscription topics.
transactional_messagesidreplaceRetrieves transactional message templates.
workspacesidreplaceRetrieves workspaces in your account.

Use these as --source-table parameter in the ingestr ingest command.

Examples

Metrics Tables

Metrics tables require a period suffix. Use the format table_name:period where period can be hours, days, weeks, or months.

sh
# Get daily broadcast metrics
ingestr ingest \
  --source-uri 'customerio://?api_key=your_api_key&region=us' \
  --source-table 'broadcast_metrics:days' \
  --dest-uri duckdb:///customerio.duckdb \
  --dest-table 'customerio.broadcast_metrics'

# Get hourly campaign metrics
ingestr ingest \
  --source-uri 'customerio://?api_key=your_api_key&region=us' \
  --source-table 'campaign_metrics:hours' \
  --dest-uri duckdb:///customerio.duckdb \
  --dest-table 'customerio.campaign_metrics'

People and Objects

sh
# Get all customers with their identifiers
ingestr ingest \
  --source-uri 'customerio://?api_key=your_api_key&region=us' \
  --source-table 'customers' \
  --dest-uri duckdb:///customerio.duckdb \
  --dest-table 'customerio.customers'

# Get detailed customer attributes
ingestr ingest \
  --source-uri 'customerio://?api_key=your_api_key&region=us' \
  --source-table 'customer_attributes' \
  --dest-uri duckdb:///customerio.duckdb \
  --dest-table 'customerio.customer_attributes'

Incremental Loading

Customer.io supports incremental loading for tables that have an updated or updated_at field. When using the --interval-start and --interval-end flags, ingestr will only fetch records that have been updated within the specified time range.

sh
ingestr ingest \
  --source-uri 'customerio://?api_key=your_api_key&region=us' \
  --source-table 'broadcasts' \
  --dest-uri duckdb:///customerio.duckdb \
  --dest-table 'customerio.broadcasts' \
  --interval-start '2024-01-01' \
  --interval-end '2024-01-31'