KNIME logo
Contact usDownload
Read time: 2 min

@KNIME Twitter Nodes

December 20, 2021
Data basics how-to
knime-twitter-connectors.jpg
Stacked TrianglesPanel BG

Harvest social media data in just a few clicks

The KNIME Twitter Connectors allow you to search for tweets on Twitter, retrieve information about users, post tweets via KNIME and much more.

1-knime-twitter-nodes.png
Figure 1. Retrieved tweets containing the hashtag #KNIME.

Setup

To use the Twitter nodes you first need a regular Twitter account and a Twitter Developer account. You can then create a Twitter App and configure the Twitter API Connector node following the steps described below:

  1. Go to: https://developer.twitter.com/en/apply-for-access.
  2. Select “Apply for a developer account”.
  3. Select the option that best describes you (Figure 2).
  4. Fill in all required information about your account identity
  5. Click 'Create New App'.
  6. Generate an API key and secret API key, an access token and secret access token (check this guide for more information).
  7. Use the API key, API secret, Access token and Access token secret to configure the Twitter API Connector node (Figure 3).
2-knime-twitter-nodes.png
Figure. 2. Application view for a Twitter developer account. We chose to explore the API as Hobbyists.

In Figure. 2, we selected Hobbyist and not Professional or Academic, because that was the scope of the example. Then you can choose any of the next three options: “Exploring the API”, “Making a bot”, and “Building tools for Twitter users”.

3-knime-twitter-nodes.png
Figure 3. Input your credentials to configure the Twitter API Connector node.

Search

The Twitter Search node allows you to search for tweets by specific queries. Use the same syntax for these queries as for web-based queries https://twitter.com/search-home. You can specify the maximum number of results as well as what kind of tweets will be returned as result: the most popular Tweets, the most relevant, or a mixture of both. Note that the actual number of results might vary. Loading the profile images can slow down the execution of the node considerably.

Timeline

The Twitter Timeline node downloads tweets as a timeline. They can either be tweets of the home timeline, mentions, retweets, or tweets from a specific user.

The home timeline contains the tweets shown on your Twitter 'Home' page, which are your own tweets as well as tweets of users you follow. The mentions timeline contains tweets in which you are mentioned. The retweets timeline contains retweets of your tweets. With the user timeline, you can get all recent tweets of a specific user.

Users

The Twitter Users node allows you to retrieve detailed information on Twitter users, such as their location, number of followers, and much more. The node requires a data table containing a column of Twitter user names as input and can be used in combination with the Twitter Search and Twitter Timeline nodes.

Post Tweet

With the Twitter Post Tweet node, you can post tweets directly from KNIME. The text is specified in the dialog and variables can be inserted anywhere in the text. The tweet will be posted on execution (Figure 4).

4-knime-twitter-nodes.png
Figure 4. Post a tweet directly from KNIME Analytics Platform.

Don't forget to follow KNIME on Twitter!