Connecting to Twitter
The Sisense Twitter connector is a standalone connector that allows you to import data from Twitter’s API into the ElastiCube Manager. After you have downloaded and installed the connector, you can connect through a connection string you provide Sisense in the ElastiCube Manager. The connection string is used to authenticate users who connect to Twitter’s API. To obtain a connection string, you will need to create a Twitter app.
Once you have connected to Twitter, you can import a variety of tables from the Twitter API.
This page describes how to install the Twitter connector, how to connect to Twitter with a connection string, and what tables you can import into the ElastiCube Manager:
Sisense provides the Twitter connector as a standalone connector that you can download and add to your list of default Sisense connectors.
To install the Twitter connector:
- Download the Twitter installation file.
- Open the installation file and click Install.
- After the installation process is complete, click Close.
The Twitter connector is displayed in the ElastiCube Manager under Add Data > Web Services.
Accessing Ads Data from Twitter
Before requesting data from Twitter, you must apply for access to your data from Twitter by submitting this request form. As part of your request, you must provide your APP ID. Click here for instructions on how to find your APP ID.
After you have created a Twitter app, you can manage it here. This is useful if you need to set permissions so you can access the relevant data.
Creating an App
To access Twitter’s REST API from Sisense, you must provide valid Oauth Twitter credentials. These credentials are provided by Twitter when you create an application. Each connection string contains a authentication parameters that the data source uses to verify your identity and what information you can export to Sisense.
The Twitter connection string looks like this:
The following parameters are mandatory when connecting with a customized connection string:
- OAuthClientId: Set this to the consumer key in your app settings.
- OAuthClientSecret: Set this to the consumer secret in your app settings.
- CallbackURL: Set this to the callback URL you specified in your app settings.
- InitiateOAuth: Set this to GETANDREFRESH. You can use InitiateOAuth to avoid repeating the OAuth exchange and manually setting the OAuthAccessToken and OAuthAccessTokenSecret.
You can follow the steps below to obtain the OAuth client credentials:
- Log in to https://dev.twitter.com/apps.
- Click Create New App.
- Enter the name, description, and website to be displayed to users when they connect.
- Define the callback URL setting. If you are making a Web app, set the callback URL to the URL you would like users to be returned to after they have granted your application privileges. If you are making a desktop application, set the callback URL to http://localhost/.
Once you have created the app, you will be redirected to a page with information about your app.
If you intend to communicate with Twitter only as the currently authenticated user, then you can obtain the OAuthAccessToken and OAuthAccessTokenSecret directly from this page on Twitter. The OAuthAccessToken and OAuthAccessTokenSecret are listed under the OAuth Settings in the Your Access Token section. You can then connect by setting these connection string properties and do not need to continue to the other steps.
Otherwise, if you need to generate access tokens for other user accounts besides the one you used to create the app on Twitter, use the consumer key and consumer secret in the following steps.
Adding Twitter Tables to your ElastiCube
Sisense uses connection strings to connect to Twitter and import data into the ElastiCube Manager. The default connection string for Twitter is:
After you connect using the default connection string, Sisense redirects you to Twitter’s Login page where you log in and your account is authenticated. Once the account is authenticated, the relevant tables can be added to your ElastiCube.
If you want to customize your connection string, you can by creating a Twitter app and passing additional connection string parameters. For more information, see Creating an App at the end of this page.
To add Twitter data:
- In ElastiCube Manager, click Add Data and then, Twitter. The Connect to Twitter window is displayed.
- In Datasource Connection String, enter the connection string: jdbc:twitter:InitiateOAuth=GETANDREFRESH;
- Click Connect to Server. You are redirected to the Twitter Login page.
- Log in with your credentials. Twitter is displayed in the Select Database list in the ElastiCube Manager.
- Click OK. Sisense connects to Twitter and displays a list of tables available for you to import.
- Select the relevant tables and click Add. The tables are displayed in the ElastiCube Manager.
The Sisense Twitter connector allows you to import the following tables into the ElastiCube Manager.
|DirectMessagesReceived||Query and delete direct messages received by the authenticated user.|
|DirectMessagesSent||Send direct messages and query messages sent by the authenticated user.|
|Favorites||Create, delete, and query a list of favorite tweets of the authenticated user and allow the user to favorite new tweets or remove existing favorites.|
|Following||Create, delete, and query a list of users that the current Twitter account is following, otherwise known as friends.|
|Tweets||Create, delete, and query status updates and tweets from the authenticated user.|
|AccountSettings||Query account settings about the currently authenticated user.|
|AdAccounts||Retrieve all of the advertising-enabled accounts the authenticating user has access to.|
|AdAvailableAudiences||Query available audiences for this account.|
|AdCampaigns||Retrieve details for some or all campaigns associated with the current account.|
|AdFundingInstruments||Retrieve some or all funding instruments associated with the account specified in the path.|
|AdInsights||Provide qualitative information about various Twitter audiences.|
|AdLineItems||Retrieve some or all funding instruments associated with the account specified in the path.|
|AdPromotedTweets||Retrieve all of the advertising-enabled tweets the authenticating user has access to.|
|AdStats||Query information about all available metrics for a certain entity.|
|Followers||Query a list of users following the current Twitter account.|
|ListMembers||Query the members of a specified list.|
|Lists||Query Twitter list information based on a set of criteria.|
|ListSubscribers||Query the subscribers to a specified list.|
|Mentions||Query a list of retweets of the authenticated user.|
|Retweets||Query a list of retweets of the authenticated user.|
|Trends||Query the daily trending topics from Twitter.|
|Users||Query a list of users based on the SearchTerms, Id, or Screen_Name.|
|22.214.171.124||March 20, 2017||AdStats table did not return results as expected|
|126.96.36.199||February 8, 2017||Ads Marketing table added|