Categories

Versions

Using the Twitter Connector

The Twitter Connector allows you to easily access Twitter data directly from Altair AI Studio. The connector can search for phrases, tweets, or user profile information. This document will walk you through how to:

The Twitter Connector uses an authentication mechanism called OAuth 2.0. Instead of giving your username and password, you generate an access token that can be used by Altair AI Studio to connect to your Twitter account. This token cannot be used by any other applications and helps keep your Twitter credentials secure.

Connect to your Twitter account

  1. In Altair AI Studio, right-click on the repository you want to store your Twitter Connection in and choose New Connection Icon Create Connection.

    img/twitter/01-create-new-connection.png

    You can also click on Connections > Create Connection New Connection Icon and select the Repository from the dropdown of the following dialog.

  2. Give a name to the new connection, and set Connection Type to Twitter icon Twitter:

    img/twitter/02-create-twitter-connection.png

  3. Click on Create IconCreate and switch to the Setup tab in the Edit connection dialog.

  4. To the right of the Access Token field, click the Id Icon button to request an access token.

  5. Click on Request access token Website Icon to open the Twitter website in your browser. If you are not already logged into your Twitter account, you will have to do so now. You can manually copy the URL by clicking on Show URL instead.

    img/twitter/03-authenticate-rapidminer-for-twitter.png

  6. Allow access to your Twitter account by clicking on Authorize app:

    img/twitter/04-confirm-authentication-for-twitter.png

  7. Copy the access token shown on the next page:

    img/twitter/05-copy-authentication-code.png

  8. Return to Altair AI Studio, enter the access token, and click Complete IconComplete:

    img/twitter/06-paste-authentication-code.png

  9. While not required, we recommend testing your new Twitter Connection by clicking the Connection Test Icon Test Connection button at the bottom of the Edit connection window:

    img/twitter/07-test-connection.png

    If the test fails, check whether you copied the complete access token.

  10. Close the Edit connection dialog by clicking on Save IconSave.

You have successfully connected Altair AI Studio to your Twitter account! The next sections will show you how to use this Connector to search for different types of information from Twitter.

Search for tweets containing a phrase

With the Search Twitter operator you can find all tweets containing a specified phrase, along with those tweets` metadata.

  1. Drag a Search Twitter operator into the Process Panel. Select your Twitter Connection for the connection entry parameter from the Connections folder of the repository you stored it in by clicking on the repository chooser icon button next to it:

    img/twitter/08a-via-repo-entry.png

    Alternatively, you can drag the Twitter Connection from the repository into the Process Panel and connect the resulting operator with the Search Twitter operator.

    img/twitter/08b-via-retrieve-connection.png

  2. Fill in the query field. The query is the phrase you will search Twitter for.

    img/twitter/08-search-twitter-operator-query.png

  3. Run Run Process the process and view the results:

    img/twitter/09-search-twitter-operator-results.png

    As you can see, the results include the user who posted the tweet, the full text of the tweet, and much more!

Get tweets from a user

With the Get Twitter User Statuses operator you can view all tweets from a specified user.

  1. Click on the Get Twitter User Statuses operator, select your Twitter Connection entry in the operator parameters, and specify the username you are interested in. Note you do not need to include the "@"" symbol that usually prefixes Twitter usernames. Alternatively, change the query type to id and input the user ID number.

    img/twitter/10-get-twitter-user-statuses-query.png

  2. Run Run Process the process and view the results:

    img/twitter/11-get-twitter-user-statuses-results.png

Get account details of a Twitter user

The Get Twitter User Details operator can be used to find profile information for a specified username.

  1. Click on the Get Twitter User Details operator, select your Twitter Connection entry in the operator parameters, and specify the user by username or ID number:

    img/twitter/12-get-twitter-user-details-query.png

  2. Run Run Process the process and view the results:

    img/twitter/13-get-twitter-user-details-results.png

    The table contains information such as account creation data and number of followers. To find out more about the user's followers, see the next section.

Get a list of friends or followers

The Get Twitter Relations operator can be used to obtain a list of all friends or followers of a user.

  1. Click on the Get Twitter Relations operator, select your Twitter Connection entry in the operator parameters and specify the user by username or ID number:

    img/twitter/14-get-twitter-relations-query.png

  2. Run Run Process the process and view the results:

    img/twitter/15-get-twitter-relations-results.png

The first column contains the user you specified and the second column shows the ID numbers of their followers. With your knowledge of the Get Twitter User Details operator from earlier, you could use these ID numbers to get account details for the list of followers, too!