This Treasure Data integration empowers digital sales organizations with modern remote collaboration capabilities for exceptional teamwork and frictionless engagement:
- Find and build stronger relationships.
- Improve productivity and performance.
- Get a single view of customers.
The import integration allows you to import profile data into Treasure Data.
This feature is in BETA version. For more information, contact your Customer Success Representative.
- When running on schedule, the time window of the fetched data automatically shifts forward on each run.

The following is an example of when incremental loading is enabled. For example, suppose the initial configuration is January 1, with ten days in duration. In that case, the first run fetches data modified from January 1 to January 10, the second run fetches from January 11 to the current time, and so on.
- Basic knowledge of Treasure Data, including the TD Toolbelt.
- Authorized Treasure Data account access
- A Sprinklr user account
- A Sprinklr developer account
- Basic knowledge of curl or POSTMAN
At first, you need to determine the Environment for Your Account. Login to your Sprinklr account at https://www.sprinklr.com/. On the Chrome browser, select F12 to enter developer mode. 
Select Console and then type SPR_ENV.env. You can see the environment of your account prod2 in this example. In this article, this is value 1 of 7 required for configuration.

Go to https://developer.sprinklr.com/member/register and register a developer account by following the instructions in https://developer.sprinklr.com/docs/read/api_overview/Getting_Started.
You must activate your account through an email sent by Sprinklr.
Sign in to your developer account using the URL https://developer.sprinklr.com/login/.

Select My Account.

Select the Application tab.

Then select Create A New App.

On the Register An Application screen, fill in the required information.
In Register Callback URL, we recommend using the values in the screenshot. http://localhost:8123/sprinklr/callback (value 2 of 7 required for this configuration) to simplify your token acquisition process.

Scroll down. Select the option best suited for your environment. In this example, the environment is prod.Select Issue a new key for Prod2.
Then selectI agree to the terms of service.
Select REGISTER APPLICATION to complete the registration.

Note: If your environment is not included in the available options (for example, prod0, qa4 …), contact Sprinklr to create the application. You also can contact Sprinklr to increase the rate limit based on your needs.
Next, go to https://developer.sprinklr.com/apps/mykeys to see your key (value 3 of 7 required for this configuration) and secret (value 4 of 7). Note the values. You use the information in later steps.

Note: Wait for at least 30 minutes before continuing to configure. Sprinklr needs processing time to enable the application.
Collect the following:
| Value | Type |
|---|---|
| 1 | environment |
| 2 | redirect URI |
| 3 | application key |
| 4 | application secret |
Open your web browser and enter the following URL, replacing the text in brackets {} with the appropriate values. https://api2.sprinklr.com/{environment}/oauth/authorize?client_id={application_key}&response_type=code&redirect_uri={redirect_uri}
If your environment is prod, then delete the {environment} from the URL, as follows:
- Environment prod
https://api2.sprinklr.com/oauth/authorize?client_id={application_key}&response_type=code&redirect_uri={redirect_uri}- Other environments
https://api2.sprinklr.com/{environment}/oauth/authorize?client_id={application_key}&response_type=code&redirect_uri={redirect_uri}For example, if the environment is prod2, the redirect URI is http://localhost:8123/sprinklr/callback, and the application key is th1s1s4f4k3dk3y, then the URL is as follows:
https://api2.sprinklr.com/prod2/oauth/authorize?client_id=th1s1s4f4k3dk3y&response_type=code&redirect_uri=http://localhost:8123/sprinklr/callbackIn your browser, you are asked for your approval to access your Sprinklr account. Select Submit.


Select the space you that you want to grant access to and select Submit.

You must login again if you are not already logged into your Sprinklr account.
Use your Sprinklr account, not the developer account to log in.
You see a screen as follows:

Copy the value in code=xxxx. You use the information in later step.
Open POSTMAN and create a new request.

Enter https://api2.sprinklr.com/{environment}/oauth/token?client_id={client_id}&client_secret={client_secret}&redirect_uri={redirect_uri}&grant_type=authorization_code&code={code}, replacing the text in brackets {} with the appropriate values.
The code parameter is value 5 of 7 required for this configuration.
Remember: if your environment is prod, then delete the {environment} from the URL.
The example with a code value of 12233333, is as follows:
https://api2.sprinklr.com/prod2/oauth/token?client_id=th1s1s4f4k3dk3y&client_secret=th1s1s4f4k3ds3cr3t&redirect_uri=http://localhost:8123/sprinklr/callback&grant_type=authorization_code&code=12233333Change the method to POST.

Select the Headers tab. You see the key Content-Type with value application/x-www-form-urlencoded. Select Send.

You see a response similar to the following:
{
"access_token": "th1s1s4f4k3d4cc3sst0k3n",
"refresh_token": "th1s1s4f4k3dr3fr3sht0k3n",
"token_type": "Bearer",
"expires_in": 2591999
}Note the access_token (value 6 of 7 required for this configuration) and refresh_token (value 7 of 7).
Alternatively, if you know how to send a cURL, you can use the following command to obtain a token:
curl --location --request POST 'https://api2.sprinklr.com/{environment}/oauth/token?client_id={client_id}&client_secret={client_secret}&redirect_uri={redirect_uri}&grant_type=authorization_code&code={code}'
--header 'Content-Type: application/x-www-form-urlencoded'An example follows:
curl --location --request POST 'https://api2.sprinklr.com/prod2/oauth/token?client_id=th1s1s4f4k3dk3y&client_secret=th1s1s4f4k3ds3cr3t&redirect_uri=http://localhost:8123/sprinklr/callback&grant_type=authorization_code&code=12233333'
--header 'Content-Type: application/x-www-form-urlencoded'You have specified all the required information needed to create authentication for the Sprinklr connector. The following mapping table shows the collected values:
| Name | Value | Configuration property | Configuration name in the Sprinklr console |
|---|---|---|---|
| Environment (value 1) | prod2 | environment | Environment |
| Redirect URI (value 2) | http://localhost:8123/sprinklr/callback | redirect_uri | Redirect URI |
| Application Key (value 3) | your_applicaiton_key | client_id | Application key |
| Application secret (value 4) | your_application_secret | client_secret | Application secret |
| Access token (value 6) | your_access_token | access_token | Access token |
| Refresh token(value 7) | your_refresh_token | refresh_token | Refresh token |
When you configure a data connection, you provide authentication to access the integration. In Treasure Data, you configure the authentication and then specify the source information.
Go to Integrations Hub > Catalog and search and select Sprinklr.

The following dialog opens.

Edit the required credentials without the information you obtained in the previous step

Select Continue.
Name your new Sprinklr Connection. Select Done.

After creating the authenticated connection, you are automatically taken to the Authentications tab. Look for the connection you created and select New Source.
Complete the details and select Next.

Paramters Configuration
| Parameters | Description | Required |
|---|---|---|
| Client Id | Application's key - obtained when creating application on Sprinklr. | Yes |
| Client secret | Application's key - obtained when creating the application on Sprinklr | Yes |
| Access token | Access token - obtained when granting access to the application | Yes |
| Refresh token | Refresh token - obtained when granting access to the application | Yes |
| Redirect Uri | Redirect URL - declared when creating the application on Sprinklr | Yes |
| Environment | User's Sprinklr environment - could be retrieved by login to the Sprinklr web app | Yes |
| Target | Target object to ingest - enum(profile) | No |
Filter Column | Name of property to used to filter by start_time and end_time, enum(created_time,modified_time) (string, default: modified_time) | No |
| Sn types | Space-separate list of social network types associated with profiles to ingest, i.e FACEBOOK TWITTER LINKEDIN YOUTUBE ... (string, default: null) | No |
| Source | The data source in Sprinklr that you want to ingest (currently supports only Profile) | Yes |
| Number of profiles to fetch in each API call | The number of profiles to retrieve through each API call to Sprinklr | No |
| Filter time using | Choose the timestamp types of profiles that you want to filter or enable for incremental loading. Supported options are Created Time and Modified Time. If you want to ingest only the newly created profiles, then use Created Time. If you want to ingest the updated profiles, then use Modified Time. | No |
| Start Time | Retrieve profiles created or modified from this specified start time. | No |
| End Time | Retrieve profiles created or modified until this specified end time | |
| Incremental loading | When running on schedule, the time window of the fetched data automatically shifts forward on each run. For example, if the initial configuration is January 1, with ten days in duration, then the first run fetches data modified from January 1 to January 10, the second run fetches from January 11 to the current time, and so on | No |
| Social networks | A case-sensitive, space-separator list of social networks. The list contains profiles that you want to ingest. For example, if you want to ingest only Facebook and Twitter profiles, use "FACEBOOK TWITTER" | No |
| Profile list | A numeric, space separator list of profile list ids. The list contains the profiles that you want to ingest. Correct sample input "1 2 3 4" | No |
| Partner profile list | A numeric, space separator list of partner profile list ids. The list contains the profiles that you want to ingest. Correct sample input "1 2 3 4" | No |
| Tags | A case-sensitive, space separator list of tags. The list contains profiles that you want to ingest. Correct sample input "tag1 tag2" | No |
Data preview is optional, and you can safely click Next to go to the next page of the dialog if you would like.
Display a preview of your data before running the import by selecting Generate Preview.
The data shown in the data preview is approximated from your source. It is not the actual data that is imported.
Verify that the data looks approximately like you expect it to.

Select Next.
Choose an existing or create a new database and table where you want to transfer data to or create a new database and give your database a name. Complete similar steps for Create new table.
Select whether to append records to an existing table or replace your existing table.
If you want to set a different partition key seed rather than use the default key, you can specify one using the popup menu.

In the Schedule tab, you can specify a one-time transfer, or you can schedule an automated recurring transfer. If you select Once now, select Start Transfer. If you select Repeat… specify your schedule options, then select Schedule Transfer.


After your transfer has run, you can see the results of your transfer in Data Workbench > Databases.
You can also use CLI(Toolbelt) to import results from Sprinklr to Treasure Data.
You need to specify the information for export to your server as --result option of td query command. About td query command, you can see this article.
The format of the option is JSON and the general structure is as follows.
With profile target example
in:
type: sprinklr
client_id: client_id
client_secret: client_secret
access_token: access_token
refresh_token: refresh_token
redirect_uri: http://localhost:8123/
environment: prod2
target: profile
incremental: true
page_size: 5000
filter_column: modified_time
start_time: "2019-12-12T00:00:00.000Z"
end_time: "2019-12-31T00:00:00.000Z"
sn_types: "FACEBOOK TWITTER LINKEDIN YOUTUBE"
profile_list: "1 2 3 4"
partner_profile_list: "1 2 3 4"
tags: "#tag1 #tag2 #tag3 #tag4"With report target example
in:
type: sprinklr
client_id: client_id
client_secret: client_secret
access_token: access_token
refresh_token: refresh_token
redirect_uri: http://localhost:8123/
environment: prod2
target: report
incremental: true
report_page_size: 1000
start_time: "2019-12-12T00:00:00.000Z"
end_time: "2019-12-31T00:00:00.000Z"
payload: |
{ "requests": { "sample": { "timeFilter": { "sinceTime": 1, "untilTime": 2 }, "reportingEngine": "PLATFORM", "report": "POST_INSIGHTS", "timezone": "UTC", "details": { "accessible": true }, "groupBys": [ { "key": "LEVEL1", "field": "LEVEL1", "groupType": "FIELD", "details": {}, "sort": null, "page": null, "projections": null, "filters": null, "namedFilters": null, "childrenGroupBys": [ { "key": "LEVEL2_1", "field": "LEVEL2_1", "groupType": "DATE_HISTOGRAM", "details": { "interval": "1d" }, "childrenGroupBys": [ { "key": "LEVEL3_1", "field": "LEVEL3_1", "groupType": "FIELD", "details": { "accessible": true } }, { "key": "LEVEL3_2", "field": "LEVEL3_2", "groupType": "FIELD", "details": { "accessible": true }, "childrenGroupBys": null } ] }, { "key": "LEVEL2_2", "field": "LEVEL2_2", "groupType": "FIELD", "details": { "interval": "1d" }, "childrenGroupBys": [] } ] }, { "key": "LEVEL1_2", "field": "LEVEL1_2", "groupType": "FIELD", "details": {}, "sort": null, "page": null, "projections": null, "filters": null, "namedFilters": null } ], "filters": [ { "filterType": "IN", "field": "CLIENT_ID", "values": [ 1, "2" ], "details": { "accessible": true } }, { "filterType": "GT", "field": "ACCOUNT_ID", "values": [ 1 ], "details": { "accessible": true } } ], "projections": [ { "measurement": "TOTAL_ENGAGEMENT", "missing": null, "aggregateFunction": "SUM", "details": null, "filters": null, "key": "TOTAL_ENGAGEMENT_1" }, { "measurement": "PUBLISHED_MESSAGE_COUNT", "missing": null, "aggregateFunction": "SUM", "details": null, "filters": null, "key": "PUBLISHED_MESSAGE_COUNT_1" } ] } } }- API Overview: https://api2.sprinklr.com/prod0/
- OAuth 2.0: https://developer.sprinklr.com/docs/read/developr/framework/OAuth