You can write job results directly to your Twitter Tailored Audience.


Prerequisites

Create a New Connection

Go to Treasure Data Connections. Search and select Twitter Tailored Audience.

The following dialog opens.

Select an existing OAuth connection for Twitter, or select the link under OAuth connection to create a new one.

Create a New OAuth Connection

Log into your Twitter account in the browser (if you haven’t logged in previously) and grant access:

Or grant access to the Treasure Data app when you are already logged in.

You will be redirected back to Treasure Data Connections. Repeat the first step (Create a new connection) and choose your new OAuth connection.

You can give a name to your newly created connection and save it for later use.


Configure Output Results

Check Output results at the top of your query editor and select your Twitter Tailored Audience connection as follows:


There are several parameters to edit:

Here is a sample configuration:

Write the Query to Populate a Tailored Audience List

We support the creation of a new Tailored Audience list.

On the Treasure Data console, run the following query with Output results into a connection of Twitter Tailored Audience (see Appendix A for more details of column naming):

SELECT email FROM (
  VALUES ('demo1@example.com'),
         ('demo2@example.com'),
         ('demo3@example.com')
)  tbl (email)

The preceding query will not match any real users as it’s solely for demo purposes only. Also, it requires no source table (for the ease of testing out this feature), but you still need to choose your database, so pick “sample_datasets” or any other arbitrary table.

The query should complete in a few seconds. Check the Twitter Audience Manager for your new list:

Twitter takes up to 24 hours to validate your newly created list. Therefore, the list will show the status as “Processing”.

Status changes to “Ready” (or an error if the list is not valid) within the next 6 to 8 hours.

Appendix

Tailored Audience Data

The Output result needs to follow the Twitter Tailored List data specifications here. We support single column, single type.

Data Normalization and Hashing

Our result output can normalize your values automatically to follow Twitter’s normalizing rules. See here.

All values, uploaded to Twitter for matching, need to be normalized with the normalizing rules of Twitter. The values will narrowly miss chances to match if they are not normalized. If you need to normalize values by yourselves, apply your own normalization before submitting the output.

The conversion below is actually applied per type in our result output for normalization.

After normalization, the data must be hashed using SHA256, without a salt.  Additionally, the final output hash must be in lower case.
For example,
 49e0be2aeccfb51a8dee4c945c8a70a9ac500cf6f5cb08112575f74db9b1470d and not 49E0BE2AECCFB51A8DEE4C945C8A70A9AC500CF6F5CB08112575F74DB9B1470D

Twitter Ads Account Information

Access to an Ads Account is the pre-requisite to create the Tailored Audience List. The account ID can be retrieved from the Account Settings Page