You can write job results from Treasure Data directly to Airship Audience Lists. In Airship, you can then use the List to target specific users.
- Basic Knowledge of Treasure Data.
- Basic knowledge of Airship / Airship Audience Lists
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 link:
https://api-docs.treasuredata.com/en/overview/ip-addresses-integrations-result-workers/
You can use the CLI to configure your connection.
td query --database your_database --result configuration queryThe following table identifies the configuration keys with descriptions.
| Config Key | Type | Required | Description |
|---|---|---|---|
| type | string | yes | Airship |
| base_url | string | yes | - Airship North America cloud site: https://go.urbanairship.com - Airship Europe cloud site: https://go.airship.eu |
access_token | string | - | Airship Bearer access token Note: access_token or app_key, app_secret is required |
app_key | string | - | See App Keys & Secrets |
app_key_custom_events | string | No | Required if data_type is custom_events |
app_secret | string | - | App Secret or Master secret |
| data_type | string | No | Supported values: - static_list (default) - non_json_attributes - json_attributes - custom_events |
| non_json_target | string | Yes if data_type=non_json_attributes | Supported values: - named_users - channels |
| json_target | string | Yes if data_type=json_attributes | Supported values: - named_users - channels |
| non_json_action | string | Yes if data_type=json_attributes | Supported values: - batch_csv - set - remove |
| json_action | string | Yes if data_type=json_attributes | Supported values: - set - remove |
list_name | string | Yes if data_type=static_list | Audience List name |
list_description | string | No | Audience List description |
attribute_name | string | Yes if data_type=json_attributes | Attribute name to be updated |
skip_invalid_records | boolean | No | If set to true (default), this will skip invalid records and continue uploading valid ones. If set to false, this will terminate the job when an invalid record is encountered. |
skip_invalid_nonjson_att | boolean | No | If set to true (default), this will skip invalid records and continue uploading valid ones. If set to false, this will terminate the job when an invalid record is encountered. |
skip_invalid_json_att | boolean | No | If set to true (default), this will skip invalid records and continue uploading valid ones. If set to false, this will terminate the job when an invalid record is encountered. |
| skip_invalid_custom_events | boolean | No | If set to true (default), this will skip invalid records and continue uploading valid ones. If set to false, this will terminate the job when an invalid record is encountered. |
json_composer_custom_events | boolean | No | If set to true, this will compose json request from properties fields. If set to false (default), this will use json value from properties field. |
retry_limit | int | No | Maximum retry times for each API call (Default: 5) |
initial_retry_wait_msecs | long | No | Wait time for the first retry (Default: 60000 milliseconds) |
max_retry_wait_msecs | long | No | Maximum time between retries (Default: 30000 milliseconds) |
connection_timeout_secs | long | No | The amount of time before the connection times out when doing API calls (Default: 300 seconds) |
write_timeout_secs | long | No | The amount of time waiting for writing data into the request (Default: 300 seconds) |
read_timeout_secs | long | No | The amount of time waiting for reading data from the response (Default: 300 seconds) |
Example Query that Exports Results to an Airship Audience List
td query --database my_db \
--result '{"type": "airship","app_key": "xxx","app_secret": "yyy","list_name: amazon_channels,"list_description": "amazone collected channels for marketing"}' \
'SELECT identifier_type, identifier from my_table'Example Query that Exports Results to an Airship Named Users Non Json Attributes
td query --database my_db --query 'SELECT named_user, first_name, last_name, fav_color FROM my_table' --type presto \
--result '{"type":"airship","base_url":"https://go.urbanairship.com", "auth_method":"access_token","access_token":"xxx", "data_type":"non_json_attributes","non_json_target":"named_users","non_json_action":"set", "skip_invalid_nonjson_att":true}';Example: Query and export results to an Airship Named UsersJson Attributes
td query --database my_db --query 'SELECT named_user, instance_id, first_name, last_name, fav_color FROM my_table' --type presto \
--result '{"type":"airship", "base_url":"https://go.urbanairship.com", "auth_method":"access_token", "access_token":"xxx","data_type":"json_attributes", "json_target":"named_users", "json_action":"set","skip_invalid_json_att":true}';Example: Query and export results to an Airship Custom Events
td query -d database -w -q query.txt --type presto \
--result '{"type":"airship","base_url":"https://go.urbanairship.com","auth_method":"access_token", "access_token":"xxx","app_key_custom_events":"xxx", "data_type":"custom_events", "skip_invalid_custom_events":true}';