Skip to content
Last updated

Clevertap Export Integration

This feature is in BETA version. For more information, contact your Customer Success Representative.

Overview

CleverTap is a premier customer engagement and retention platform that combines app analytics with marketing tools to help businesses drive user engagement and improve retention. It offers three key functionalities:

  • User Behavior Tracking and Analysis: Monitor user actions and analyze product usage patterns.
  • Segmentation and Targeted Campaigns: Segment users based on behavior and run personalized campaigns across various channels.
  • Campaign Analysis: Evaluate campaign effectiveness to optimize user engagement and business metrics.

The CleverTap integration connects Treasure Data with CleverTap, enabling seamless synchronization of user profiles, events, and audiences. This integration empowers businesses to leverage Treasure Data’s unified data and CleverTap’s engagement tools to enhance their CX, CRM, and retention marketing efforts.

Prerequisites

  • Basic Knowledge of Treasure Data
  • Basic knowledge of the CleverTap Engagement Platform

Limitations

  • The maximum file size for uploading a user audience custom list is 5GB.

Create a New Connection

Before running your query, you must create and configure the data connection on the TD Console. As part of the data connection, you provide authentication to access the integration. Complete the following steps.

  1. Open TD Console.
  2. Navigate to Integrations Hub > Catalog.
  3. Search for and select CleverTap.
  4. Select Create Authentication, and provide the credential information for the integration as described in the following table.
  5. Select **Continue,**enter a name for the Authentication, and select Done.

Authentication Fields

FieldDescription
CleverTap Account IDInput field for CleverTap Account ID. To get an Account ID, read API Quick Start Guide.
CleverTap PasscodeInput field for CleverTap Account Passcode or User’s Passcode. To get a Passcode, read API Quick Start Guide.
Rest Endpoint RegionSelect Box to select the API regions to determine the Rest of the End-points to use. To get the Account Regions (for Rest Endpoint), read Common API Components.

Configure a Query Result for Export

The TD Console supports multiple ways to export data. Please follow these steps to export data from the Data Workbench.

  1. Navigate to Data Workbench > Queries.
  2. Select New Query, and define your query.
  3. Select Export Results to configure the data exporting.
  4. Select an existing CleverTap authentication or create a new one described previously
  5. Select Done.

Connector Configuration Parameters

The following table describes the configuration parameters for the CleverTap export integration.

FieldDescription
Target Data EntityThe CleverTap export Target Data Entity. Supported Values:
  • User Profiles: Upload the data related to user profiles.
  • User Events: Upload the data related to user events.
  • User Audiences - Custom List: Upload custom list segment.
User Profiles OperationThe operation related to upload user profiles. Select the list of values below:
  • Upload User Profiles: Update user profile information such as gender, phone, etc.
  • Upload Device Tokens: Add an existing device token to a CleverTap user profile.
  • Demege User Profile: Demerge a user profile.
  • Update Email/Phone Subscription: Set a phone number or email status as subscribed or unsubscribed.
  • Disassociate A Phone Number: Disconnect a phone number from a user profile.

Array Property Operation

This option is required only if the User Profiles Operation is Upload User Profiles and the custom attribute value is json array. It will apply the CleverTap array operation: replace, append ($add), and remove ($remove).

Supported operations:

  • Replace
  • Append
  • Remove
Name for Custom List UploadThis option is required if the Target Data Entity is User Audiences - Custom List. This is the name of the segment in CleverTap.
Custom List Upload User EmailThis option required if the Target Data Entity is User Audiences - Custom List. The email must belong to CleverTap admin role.
Segment Operation ModeSupported values:
  • Create New Segment (One-Time): This will create a new segment on the CleverTap. If the segment already exists, the job will fail.
  • Update Existing Segment (Scheduled): This will update the existing segment on the CleverTap. The segment must exist in the CleverTap; otherwise, the job will fail. This option can be used for scheduled jobs.

Thread Count Number

The number of concurrent requests to the CleverTap server. Min: 1, Max: 10, Default: 5.

This parameter only apply for Target Data Entity: User Profiles and User Events.

Skip on Invalid Record?If checked, the job will skip the invalid record and continue to handle the next record. Otherwise, the job will stop.

Detailed Guide for Each Target Data Entity

For all target data entities, you need to build a data export query that includes a combination of default and custom fields that adhere to CleverTap API guidelines. For default fields, ensure that the column names match those listed in each feature guide's "Field/Column-Level Specifications" section. The connector automatically normalizes the column names to match CleverTap's required format, so you do not need to worry about case sensitivity.

For example, for the default field "objectId," the column name in your export query can be written in any case, such as "OBJECTID," "objectid," or "OBJECTid." The connector will standardize the column name to "objectId" to align with CleverTap's requirements.

Target Data Entity: User Profiles

For the User Profiles data entity, we support a few operation modes:

  • Upload User Profiles: Update user profile information such as gender, phone, etc.
  • **Upload Device Tokens:**Add an existing device token to a CleverTap user profile.
  • **Demege User Profile:**Demerge a user profile.
  • **Update Email/Phone Subscription:**Set a phone number or email status as subscribed or unsubscribed.
  • Disassociate A Phone Number: Disconnect a phone number from a user profile.

This document includes one detailed guide section for the Upload User Profiles mode and one section for the four remaining operation modes.

Upload User Profiles Details

I. Building the Export Query

To successfully upload/modify user profile data to CleverTap, you must construct an export query that adheres to specific data specifications. These specifications are divided into two levels.

Export Query Specifications

SpecificationDescription
Conditionally Required ColumnsAt least one of the following columns must be present: identity or objectid.
Null Value ColumnsColumns with null values will be ignored.
Column Naming Rules- Column names must not include the following characters: &$",%><!. - Column names must not exceed 120 characters.
Maximum Column Value LengthColumn values for both default and custom fields must not exceed 512 characters.
Duplicated ColumnsDuplicated columns are not allowed.
Field/Column-Level Specifications

Default Field Columns

FieldDescriptionRequiredData TypeAdditional Specifications
identityUser identity fieldYes, if objectid is not presentScalar types (string, integer, boolean)
objectidUser identity fieldYes, if identity is not presentScalar types (string, integer, boolean)
NameProfile nameNoString
EmailUser’s emailNoStringIt must match a valid email pattern.
PhoneUser's phone numberNoStringMust be formatted as E.164 phone number format, which is +[country code][national significant number]
GenderUser genderNoStringIt can only accept values from the following enum: ["M", "F"].
DOBUser date of birthNoUnix timestamp stringThere are three options for this field’s value to match CleverTap’s requirement for a Unix timestamp format of "$D_unix_time_value": 1) Integer type: If the column’s data is of integer type, it will be used as-is, assuming it’s already in Unix format, and the format "$D_unix_time_value" will be applied. 2) Timestamp cast: If the column’s data is cast as a timestamp, the connector will convert it to an integer Unix time format and then apply the format "$D_unix_time_value". For example:SELECT CAST(timestamp_column AS TIMESTAMP) AS dob. 3) ISO-8061 string format: If the column’s data is of string type in ISO-8061 format, it will be converted to Unix time (integer), then apply the format "$D_unix_time_value". Ensure the value ends with “Z” to be recognized as an ISO-8601 date-time string and note that it will consistently be recognized as UTC. For example:SELECT "2020-08-01T00:00:00Z" AS dob.

Field/Column-Level Names For Export Queries

Feild NameQuery ValuesFeild Usage
phonephoneusers phone
namenameuser name
emailemailuser email
MSG-whatsappMSG-whatsappWhatsapp user preference
MSG-smsMSG-smsSMS user preference
MSG-pushMSG-pushUser Push Preferences

Example Query:

SELECT
  IDENTITY,
  CAST(
 'objectid' AS VARCHAR
  ) AS objectId,
  name,
  email,
  'M',
  CAST(
 '+1234567890123456789' AS VARCHAR
  ) phone,
  '1995-05-15T00:00:00Z',
  CAST(
 email_pref AS BOOLEAN
  ) AS MSG_email,
  CAST(
 'true' AS BOOLEAN
  ) AS MSG_push,
  CAST(
 'true' AS BOOLEAN
  ) AS MSG_sms,
  CAST(
 'true' AS BOOLEAN
  ) AS MSG_whatsapp,
  CAST(
 json_parse('["Newsletters", "Promotions"]') AS arrayvarchar
  ) "Custom Value 1"
FROM
  clever_tap_upload_user_profiles LIMIT 1

Custom Field Columns

Column TypeDescriptionMappingAdditional Specifications
Non-default FieldsColumns not listed as default fields will be treated as custom fields.Mapped as key/value pairs in profileData objectColumn names and values are mapped as-is. Date-time columns must be cast as “timestamp” or formatted as ISO-8601 date-time strings. Array column property values must be strings and are limited to 100 items, with each value limited to 512 characters. Refer to the following sections for guidance on handling date-time or array of strings custom field.

Handling Date-Time

The integration can handle values cast as timestamps or in ISO-8601 date-time string format for date-time custom field columns. When using ISO-8601 date-time strings, ensure the value includes the letter “Z” at the end to allow the connector to detect and convert the date-time value into a Unix time value and apply the format “$D_unix_time_value” as required by CleverTap’s API contract.

Examples for Handling Date-Time Custom Field Columns

1. Casting as Timestamp

  • Create a column of type string in the source data table:
ALTER TABLE source_data_table ADD COLUMN date_time_field VARCHAR;
  • Insert date-time value strings into that column:
INSERT INTO source_data_table (id, date_time_field)VALUES(1, '2024-08-28'),(2, '2024-08-28 15:30:00'),(3, '2024-08-28T15:30:00');
  • Cast the column value as timestamp:
SELECT id, CAST(date_time_field AS timestamp) AS date_time_field FROM source_data_table;

2. Using ISO-8601 Date-Time String

  • Create a column of type string in the source data table:

    ALTER TABLE source_data_table ADD COLUMN date_time_field VARCHAR;
  • Insert date-time value strings into that column, ensuring they are formatted as ISO-8601 with a “T” separator and “Z” at the end:

INSERT INTO source_data_table (id, date_time_field)VALUES(1, '2024-08-28T00:00:00Z'),(2, '2024-05-28T15:30:00.123Z'),(3, '2024-02-28T15:30:00Z');
  • Use the column directly in the query:
SELECT id, date_time_field FROM source_data_table;

Handling an Array of String Custom Field Columns

For the integration to accurately interpret a column’s data and map it to an array of string user properties in CleverTap, the following options are available:

1. Direct Use of Array Column

  • Create a column of an array of strings in the source data table:
ALTER TABLE source_data_table ADD COLUMN array_column ARRAYVARCHAR;
  • Insert an array of string values into this column:
INSERT INTO source_data_table (id, array_column)VALUES(2, ARRAY['fig', 'grape', 'honeydew', 'kiwi', 'lemon']),(3, ARRAY['mango', 'nectarine', 'orange', 'pear', 'quince']),(4, ARRAY['raspberry', 'strawberry', 'tangerine', 'ugli fruit', 'vanilla bean']),(5, ARRAY['watermelon', 'ximenia', 'yellow apple', 'zucchini', 'apricot']);
  • Use the array of string columns directly in the query:
SELECT id, array_column FROM source_data_table;

2. Using String Columns Cast to JSON or JSON Array

  • Create a column of string data type in the source data table:
ALTER TABLE source_data_table ADD COLUMN array_string_column VARCHAR;
  • Insert array string values into this column:
INSERT
  INTO
 source_data_table(
   id,
   array_string_column
 )
  VALUES(
 1,
 '["apple", "banana", "cherry", "date", "elderberry"]'
  ),
  (
 2,
 '["fig", "grape", "honeydew", "kiwi", "lemon"]'
  ),
  (
 3,
 '["mango", "nectarine", "orange", "pear", "quince"]'
  ),
  (
 4,
 '["raspberry", "strawberry", "tangerine", "ugli fruit", "vanilla bean"]'
  ),
  (
 5,
 '["watermelon", "ximenia", "yellow apple", "zucchini", "apricot"]'
  )
;
  • Use the array of string columns by casting to JSON array or JSON in the dataset export query:

    • Cast as array:
SELECT id, CAST(json_parse(array_string_column) AS ARRAYVARCHAR) AS array_column FROM source_data_table;
  • Cast as JSON array:
SELECT id, CAST(json_parse(array_string_column) AS JSON) AS array_column FROM source_data_table;

II. Connector Configuration

Configuration OptionValueDescription
Target Data EntityUser ProfilesSet to “User Profiles” for this feature.
User Profiles OperationUpload User ProfilesSpecify that the operation is to upload user profiles.
Array Property Operationreplace/append/removeDetermines how array properties are handled: - replace: Override the existing array property with new values. - append: Add specified values to the existing array property. - remove: Remove specified values from the existing array property.

Details Guide for Other Operation Modes ofUser Profiles

The User Profiles operations allow you to perform various operations to manage and update user profile data. The following sections outline the four different operation modes available under this feature:

  1. Upload Device Tokens: Add or update device tokens associated with user profiles.
  2. Demerge User Profile: Separate merged user profiles.
  3. Update Email/Phone Subscription: Set email or phone subscription statuses for existing user profiles.
  4. Disassociate a Phone Number: Disconnects the phone number from existing user profiles.

Each operation mode has specific requirements and configurations that must be followed to ensure successful data uploads to CleverTap.

I. Building the Export Query

To perform the previously described operations, you must construct an export query that adheres to specific data specifications, which are divided into two levels.

Export Query Specifications

Operation ModeRequired ColumnsDescription
Upload Device TokensobjectIdidtypeThe query result must include objectId (CleverTap object ID), id (device token), and type (device platform type). Additional required fields: p256dh and auth for Chrome-based tokens.
Demerge User ProfileidentityThe query result must include the identity column containing user identities to be demerged.
Update Email/Phone SubscriptiontypevaluestatusThe query result must include type (contact type), value (contact value), and status (subscription status).
Disassociate a Phone NumbervalueThe query result must consist of the value column containing the phone number to be disassociated.
  • Null Value Columns: Any columns with null values will be ignored.
  • Ignored Columns: Any columns not required for the selected operation mode will be ignored.

2. Field-Level Details

Default Field Columns for Each Operation

Operation ModeFieldDescriptionRequiredData TypeAdditional Specifications
Upload Device TokensobjectIdThe CleverTap objectIdYesStringMust uniquely identify a user.
idDevice tokenYesStringIt must be a valid device token.
typeDevice platform typeYesStringSupported values are apnsgcmfcmwnsmpnschrome.
p256dhEncryption key used for Chrome web push notificationsConditionalStringRequired only if type is chrome.
authAuthentication secret for Chrome web push notificationsConditionalStringRequired only if type is chrome.
Demerge User ProfileidentityUser identities for profiles to demergeYesString
Update Email/Phone SubscriptiontypeContact typeYesStringCan only accept values from the enum: ["phone", "email", "WhatsApp"].
valueContact valueYesStringPhone number format as E.164 (+[country code][national significant number]) or email address.
statusContact subscription statusYesStringCan only accept values from the enum: ["Unsubscribe", "Resubscribe"].
Disassociate a Phone NumbervaluePhone number valueYesStringMust be formatted as E.164 phone number format, which is +[country code][national significant number].

II. Connector Configuration

For each operation mode, the connector must be configured with specific settings.

Configuration OptionValueDescription
Target Data EntityUser ProfilesSet to “User Profiles” for all operations.
User Profiles OperationUpload Device TokensChoose “Upload Device Tokens” to add or update device tokens.
Demerge User ProfileChoose “Demerge User Profile” to separate merged profiles.
Update Email/Phone SubscriptionChoose “Update Email/Phone Subscription” to set email or phone subscription statuses.
Disassociate a Phone NumberChoose “Disassociate a Phone Number” to disconnect a phone number from user profiles.
Array Property OperationIgnoredThis setting will be ignored for all operations.

Target Data Entity: User Events

I. Building the Export Query

Your export query must adhere to the following detailed data specifications to upload user event data to CleverTap successfully. This section outlines the requirements for both default and custom fields, as well as specific column naming rules and data constraints.

1. Export Query Specifications

SpecificationDescription
Required Columns- At least one of the following columns must be present: identity or objectid. - The evtName column is mandatory.
Null Value ColumnsColumns with null values will be ignored.
Column Naming Rules- Column names must not include the following characters: &$",%><!. - Column names must not exceed 120 characters.
Maximum Column Value LengthColumn values for both default and custom fields must not exceed 512 characters.
Duplicated ColumnsDuplicated columns are not allowed.

2. Field/Column-Level Specifications

Default Field Columns

Field/Column/AliasDescriptionRequiredData TypeAdditional Specifications
identityUser identity fieldYes, if objectid is not presentScalar types (string, integer, boolean)
objectidUser identity fieldYes, if identity is not presentScalar types (string, integer, boolean)
tsEvent timestampNoInteger/LongThere are three options for this field’s value to match CleverTap’s requirement for a Unix timestamp format: 1) Integer type: If the column’s data is of integer type, it will be used as-is, assuming it’s already in Unix format. 2) Timestamp cast: If the column’s data is cast as a timestamp, the connector will convert it to an integer Unix time format. For example: SELECT CAST(timestamp_field AS TIMESTAMP) AS ts. 3) ISO-8061 string format: If the column’s data is of string type in ISO-8061 format, it will be converted to Unix time (integer). Ensure the value ends with “Z” to be recognized as an ISO-8601 date-time string and note that it will consistently be recognized as UTC. For example: SELECT "2020-08-01T00:00:00Z" AS ts.
evtNameEvent nameYesString
Items[index].KeyNameList of products/items for “Charged Event”NoArray of ObjectsThe Items field is required to be an array of objects of the evtName object. The connector can help formulate this array of objects if you follow the specific column name pattern: - Column Pattern: The column names should follow the pattern: Items[x].field_name, for example:``Items[0].Category,Items[0].Book name, where x is an integer representing the array index. - Hardcoding and Formatting: The prefix Items is hardcoded and should not be changed. The field_name part of the column name should be used as-is, without any reformatting. - Array Indexing: Ensure the array index x is an integer, and the index value doesn’t need to start from 0. It is permissible to skip numbers in the array indices. Example: Column/Alias: Items[0].Book name, Items[0].Category, Items[0].Quantity will convert as "evtData": { "Items": [ { "Category": "books", "Book name": "The millionaire next door", "Quantity": 1 } ]}

Custom Field Columns

Column TypeDescriptionMappingAdditional Specifications
Non-default FieldsColumns not listed as default fields will be treated as custom fields.Mapped as key/value pairs in evtData objectColumn names and values are mapped as-is. Date-time columns must be cast as “timestamp” or formatted as ISO-8601 date-time strings. Refer to the "Handling Date-Time Custom Field Columns" section in the Upload User Profiles guide for more details.

II. Connector Configuration

Configuration OptionValueDescription
Target Data EntityUser EventsSet to “User Events” for this feature.

Target Data Entity: User Audiences - Custom List

This feature allows you to create a segment of users by uploading a list of user identities to CleverTap. The following details guide you through building the export query and configuring the connector.

I. Building the Export Query

To successfully create a segment by uploading a list of user identities to CleverTap, you must construct an export query that adheres to specific data specifications. These are divided into two levels.

1. Export Query Specifications

SpecificationDescription
Required ColumnsThe query result must include the type and identity columns.
Null Value ColumnsColumns with null values will be ignored.
Ignored ColumnsAny columns that are not one of the required columns will be ignored.

2. Field/Column-Level Specifications

Default Field Columns

FieldDescriptionRequiredData TypeAdditional Specifications
typeUser identity typeYesStringValues can only be g or i.
identityUser identity valuesYesString or Integer

II. Connector Configuration

Configuration OptionValueDescription
Target Data EntityUser Audiences - Custom ListSet to “User Audiences - Custom List” for this feature.
Name for Custom List Upload[Custom List Segment Name]Specify the segment name in the CleverTap dashboard UI.
Custom List Upload User Email[User Email]Enter the user email of the CleverTap user who performed the custom list segment upload. You need to input an Admin Role's email, otherwise the job will fail.
Segment Operation ModeCreate New Segment / Update Existing SegmentChoose “Create New Segment” for a one-time job that adds a new segment to CleverTap. Choose “Update Existing Segment” to modify an existing segment, which can be scheduled to run regularly.

(Optional) Export Integration Using the CLI

The TD Toolbelt can trigger the Query Result exporting from a CLI. It would be best to specify the parameters for the exporting job using the --result option of the td query command. For more information, refer to this article.

The format of the option is JSON, and the general structure is as follows.

User Profiles

{
  "type": "clever_tap",
  "account_id": "986-XXX-XXYY",
  "passcode": "XXYY",
  "region": "UNITED_STATES",
  "target_data_entity": "USER_PROFILES",
  "user_profiles_operation": "UPLOAD_USER_PROFILES",
  "array_operation": "REPLACE",
  "skip_invalid_record": true,
  "thread_count": 5
}

User Event

{
  "type": "clever_tap",
  "account_id": "986-XXX-XXYY",
  "passcode": "XXYY",
  "region": "UNITED_STATES",
  "target_data_entity": "USER_EVENTS",
  "skip_invalid_record": true,
  "thread_count": 5
}

Custom List

{
  "type": "clever_tap",
  "account_id": "986-XXX-XXYY",
  "passcode": "XXYY",
  "region": "UNITED_STATES",    "target_data_entity": "USER_AUDIENCES_CUSTOM_LIST",
  "name_for_custom_list_upload": "demo name",
  "email_for_custom_list_upload": "demo@example.com",
  "segment_operation_mode": "UPDATE",
  "skip_invalid_record": true
}

CLI Parameters

NameDescriptionValueDefault ValueRequired
td_authentication_idThis is the ID of the existing CleverTap authentication on the TD console.
account_idThe CleverTap's account IDStringnullYes, if td_authentication_id is not present
passcodeThe CleverTap's passcodeStringnullYes, if td_authentication_id is not present
regionThe CleverTap's instance regionSupported values: - INDIA - SINGAPORE - UNITED_STATES - INDONESIA - MIDDLE_EAST - EUROPEUNITED_STATESYes, if td_authentication_id is not present
target_data_entityExport target dataSupported values: - USER_PROFILES - USER_EVENTS - USER_AUDIENCES_CUSTOM_LISTUSER_PROFILESYES
user_profiles_operationThe export mode for user profilesSupported values: - UPLOAD_USER_PROFILES - UPLOAD_DEVICE_TOKENS - DEMERGE_USER_PROFILE - UPDATE_EMAIL_PHONE_SUBSCRIPTION - DISASSOCIATE_A_PHONE_NUMBERUPLOAD_USER_PROFILESYes, if the target_data_entity is USER_PROFILES
array_operationThe array operation for the json array column when Upload User ProfilesSupported values: - REPLACE - APPEND - REMOVEREPLACEYes, if the user_profiles_operation is UPLOAD_USER_PROFILES
name_for_custom_list_uploadThe name of the segmentStringYes, if target_data_entity is USER_AUDIENCES_CUSTOM_LIST
email_for_custom_list_uploadThe Email to receive the upload result. The email must belong to CleverTap's Admin role.StringYes, if target_data_entity is USER_AUDIENCES_CUSTOM_LIST
segment_operation_modeSegment operation mode. Create a new segment or update the existing segment.Supported values: - CREATE - UPDATEUPDATEYes, if target_data_entity is USER_AUDIENCES_CUSTOM_LIST
thread_countThe number of concurrent requests to the CleverTap server.Number5Yes if the target_data_entity are USER_PROFILES or USER_EVENTS
skip_invalid_recordThe flag to control the job continues running or stops when handling the invalid record.BooleanfalseNo

Example usage

  1. Upload User Profiles
td query \
  -d db_name \
  -w "select identity,
             objectid,
             name,
             email,
             gender,
             phone,
             dob,
             msg_email,
             msg_push,
             msg_sms,
             msg_whatsapp,
             CAST(json_parse('["Newsletters", "Promotions"]') AS JSON) AS 'Custom Value 1'
      from tbl_name" \
  --type presto \
  --result '{
    "type": "clever_tap",
    "td_authentication_id": 514830,
    "target_data_entity": "USER_PROFILES",
    "user_profiles_operation": "UPLOAD_USER_PROFILES",
    "array_operation": "REPLACE",
    "thread_count": 5,
    "skip_invalid_record": true
  }'
  1. Upload Device Tokens
td query \
  -d db_name \
  -w "select objectId,
             Id,
             Type,
             p256dh,
             auth
      from tbl_name" \
  --type presto \
  --result '{
    "type": "clever_tap",
    "td_authentication_id": 514830,
    "target_data_entity": "USER_PROFILES",
    "user_profiles_operation": "UPLOAD_DEVICE_TOKENS",
    "thread_count": 5,
    "skip_invalid_record": true
  }'
  1. De-Merge User Profile
td query \
  -d db_name \
  -w "select identity
      from tbl_name" \
  --type presto \
  --result '{
    "type": "clever_tap",
    "td_authentication_id": 514830,
    "target_data_entity": "USER_PROFILES",
    "user_profiles_operation": "DEMERGE_USER_PROFILE",
    "thread_count": 5,
    "skip_invalid_record": true
  }'
  1. Update Email/Phone Subscription
td query \
  -d db_name \
  -w "select type,
             value,
             status
      from tbl_name" \
  --type presto \
  --result '{
    "type": "clever_tap",
    "td_authentication_id": 514830,
    "target_data_entity": "USER_PROFILES",
    "user_profiles_operation": "UPDATE_EMAIL_PHONE_SUBSCRIPTION",
    "thread_count": 5,
    "skip_invalid_record": true
  }'
  1. Disassociate A Phone Number
td query \
  -d db_name \
  -w "select value
      from tbl_name" \
  --type presto \
  --result '{
    "type": "clever_tap",
    "td_authentication_id": 514830,
    "target_data_entity": "USER_PROFILES",
    "user_profiles_operation": "DISASSOCIATE_A_PHONE_NUMBER",
    "thread_count": 5,
    "skip_invalid_record": true
  }'
  1. Upload User Events
td query \
  -d db_name \
  -w "select identity,
             objectid,
             ts,
             evtname,
             product_name as 'Product name',
             category as 'Category',
             price as 'Price',
             currency as 'Currency',
             amount as 'Amount',
             payment_mode as 'Payment mode',
             delivery_by as 'Delivery By',
             items_0__category AS 'Items[0].Category',
             items_0__book_name as 'Items[0].Book name',
             items_0__quantity as 'Items[0].Quantity',
             items_1__category AS 'Items[1].Category',
             items_1__book_name as 'Items[1].Book name',
             items_1__quantity as 'Items[1].Quantity'
      from tbl_name" \
  --type presto \
  --result '{
    "type": "clever_tap",
    "td_authentication_id": 514830,
    "target_data_entity": "USER_EVENTS",
    "thread_count": 5,
    "skip_invalid_record": true
  }'
  1. Upload Custom List
td query \
  -d db_name \
  -w "select type,
             identity
      from tbl_name" \
  --type presto \
  --result '{
    "type": "clever_tap",
    "td_authentication_id": 514830,
    "target_data_entity": "USER_AUDIENCES_CUSTOM_LIST",
    "name_for_custom_list_upload": "Test",
    "email_for_custom_list_upload": "test@example.com",
    "segment_operation_mode": "UPDATE",
    "skip_invalid_record": true
  }'

Other Configurations

  • The Result Export can be scheduled to periodically upload data to a target destination.
  • All import and export integrations can be added to a TD Workflow. The td data operator can export a query result to a specified integration. For more information, see Reference for Treasure Data Operators.