You can connect Sprinklr to import profile data into Treasure Data.

This Data Connector is in Beta. For more information, contact support@treasuredata.com.

Prerequisites

  • 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

Obtain the Token from Sprinklr

Determine the Environment for Your Account

Login to your Sprinklr account by https://www.sprinklr.com/.

On the Chrome browser, select F12 to enter developer mode.


Select Console and then type SPR_ENV.env. You see the environment for your account, which is prod2 in this example. In this article, this is value 1 of 7 required for configuration.

Create the Developer Account

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.

Create the Developer Application

Sign in to your developer account from 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 that you use the values as in the screenshot http://localhost:8123/sprinklr/callback (value 2 of 7 required for this configuration) to simplify your token acquire 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 select I 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.

Authorize the Application

Collect the following:

Value 

Type

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/callback

In 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. 

Obtain a Token

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=12233333

Change 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'

Collecting All the Information

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)

th1s1s4f4k3dk3y

client_id

Application key

Application secret (value 4)

th1s1s4f4k3ds3cr3t

client_secret

Application secret

Access token (value 6)

th1s1s4f4k3d4cc3sst0k3n

access_token

Access token 

Refresh token (value 7)

th1s1s4f4k3dr3fr3sht0k3n

refresh_token

Refresh token

Use the TD Console to Create Your Connection

Create a New Connection

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.



Transfer Your Sprinklr Data to Treasure Data

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.

Parameters:

  • Source: the data source in Sprinklr that you want to ingest (currently supports only Profile)

  • Number of profiles to fetch in each API call: number of profiles to retrieve through each API call to Sprinklr

  • 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.

  • Start Time: retrieve profiles created or modified from this specified start time

  • 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

  • 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"

  • 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"

  • 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"

  • Tags: a case-sensitive, space separator list of tags. The list contains profiles that you want to ingest. Correct sample input "tag1 tag2"

Preview

You can see a preview of your data before running the import by selecting Generate Preview.

Data shown in the data preview is approximated from your source. It is not the actual data that is imported.

  1. Select Next.
    Data preview is optional and you can safely skip to the next page of the dialog if you want.

  2. To preview your data, select Generate Preview. Optionally, select Next

  3. Verify that the data looks approximately like you expect it to.


  4. Select Next.

Choose the Target Database and Table

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. 

Scheduling 

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.

  • No labels