You can write job results from Treasure Data directly to Snapchat. Use this data connector to create User Segments, upload data into existing segments, and remove users from a segment. The connector supports follow features:


Use the TD Console to Create Your Connection

Create a New Connection

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 the integration.

Go to Catalog and search and select Snapchat.

The following dialog opens.

Authenticating Your Connection

Select Click here to connect to a new account. You are redirected to Snapchat to login, if you haven't login yet, or to the consent page to grant access to Treasure Data.

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

Enter your Ad Account ID. See Appendix: What is my Ad Account ID.

Select Continue and name your new Snapchat connection. 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.

Note: Sometimes you need to define the column mapping in the query.

Configure the Connection by Specifying the Parameters

Go to the TD Console. Go to Data Workbench > Queries. Access the query that you plan to use to export data.

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:

  1. Use an existing connection
    Type the connection name in the search box to filter and select your connection.

    The dialog opens

  2. Create a new Snapchat Connection
    Select New Integration, select Snapchat from Type dropdown. You see the following:

    Select Save and Continue. You see:

Complete the steps described in Create a new connection, including the creation of an OAuth connection.

Enter the required credentials for your new SnapChat connection.

Set the following parameters.

Column Name for the Query

The Snapchat data connector understands and interprets only the following columns and data types. You must modify alias column names to match with the following specified columns:

Column name








if both segment_id and segment_name are specified, the segment_id will be used.




If the segment_name does not exist in Snapchat.

  • Create a new segment with the same name if Segment Operation is Add Users

  • Treated as invalid data if Segment Operation is Remove Users

  • Throw an error or ignored depends on the option: Skip Invalid Data for Clear Segment Data¬†








Set default as 9999 if 0 or not specified. Accept value from 1 to 9999




Must be either

  • email

  • phone

  • mobile_ad_id




Either SHA256 hashed or raw value of email, phone, mobile_ad_id

You must include either segment_id or segment_name column in the Query otherwise your jobs fail.

Example Queries to Populate Snapchat Data

From Treasure Data, run the following query with export results into a connection for Snapchat:

The following example query uploads all emails to the existing Segments specified by segment_id if Segment Operation is specified as Add Users.

 segment_id AS segment_id,
 'email' AS id_type,
 email AS id_value

The following example query checks for the segment Football fans or creates a new segment with a Retention of 30 days if Segment Operation is specified as Add Users.

 'Football fans' AS segment_name,
 30 AS retention_in_days,
 'phone' AS id_type,
 mobile_phone AS id_value

Optional: Use of Scheduled Jobs for Export

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


Q: Why is Reach in Snapchat Audiences list unchanged after I uploaded users?

Q: Why does the Reach in Snapchat Audiences list increase after I remove users?


Ad Account ID

To find your Ad Account ID, log in your Business account, navigate to the Ad Account as shown in the following image. From there, you can see your Ad Account ID.

Find the Segment ID

When working with Segments, you need either Segment name or Segment ID. Here's how to find the Segment ID from your browser: