Skip to main content

Twitter

The Qlik Twitter connector uses the Twitter API to extract Twitter data, such as all Tweets that include a hashtag or a search term, and load that data into your Qlik Sense app.

Supported offerings

  • Qlik Sense Business
  • Qlik Sense Enterprise SaaS
  • Qlik Sense Enterprise on Windows
  • Qlik Sense Desktop

Ways to access your data

To access your Twitter data, you will need to authenticate the connector with your Twitter account credentials. After you create a connection and select Twitter as your data source, you will be redirected to a Twitter login page to retrieve your authentication token.

Creating a data source connection

Loading data from tables

After you authenticate the connector with your account credentials, you can use the following tables to select and load data. Some tables are only available in the Data load editor, and are not available in the Add data interface. They are indicated below by the Available in column.

Tables that can be loaded
Table Available in Description
DirectMessages Data manager and Data load editor Returns direct messages sent and received within the past 30 days by the authenticated user, sorted in reverse chronological order.
Favorites Data load editor Returns the liked Tweets for a specified user. If you do not enter a user name, the table will show the liked Tweets for the authenticated user.
Followers Data load editor Returns a list of users who are followers of the specified user ID.
Following Data manager and Data load editor Returns a list of users the specified user ID is following.
HomeTimeline Data manager and Data load editor Returns a collection of the most recent Tweets and Retweets posted by the authenticating user and the users they follow.
LocationsWithTrends Data manager and Data load editor Returns the locations that Twitter has trending topic information for.
Mentions Data manager and Data load editor Returns up to 800 Twitter mentions for the authenticated user. You can specify a Since ID and a Max ID to reduce the mentions shown.
RateLimit Data load editor Returns the current rate limits for the different API end points.
RetweetsOfMe Data load editor Returns the most recent tweets from the authenticated user that have been retweeted.
Search Data manager and Data load editor Returns the Tweets based on a search term and other parameters.
SearchAdvanced Data load editor Returns the Tweets based on a search term and other parameters. This table shows more columns than the simple Search table.
TweetLookup Data load editor Returns the details for up to 100 Tweet objects. Tweet IDs are entered as comma-separated values: tweetid1,tweetid2,...
UserSearch Data manager and Data load editor

Returns information about a public Twitter account based on a search query.

UserTimeline Data manager and Data load editor Returns the most recent Tweets posted by the specified user name.

To select and load data from a table, enter the required table parameters and click Preview data. Required parameters are marked with an asterisk (*). The table fields are displayed under the Data preview tab. You can select fields individually by selecting the box beside each field name. Select Insert script after you have made your selection.

Creating a connection and selecting data

Search API Query Operators

The table below lists the official Twitter query operators.

Officially supported query operators
Operator Finds tweets...
watching now containing both “watching” and “now”. This is the default operator.
“happy hour” containing the exact phrase “happy hour”.
love OR hate containing either “love” or “hate” (or both).
beer -root containing “beer” but not “root”.
#haiku containing the hashtag “haiku”.
from:interior sent from Twitter account "interior".
list:NASA/astronauts-in-space-now sent from an account on the NASA list; account name: "astronauts-in-space-now"
to:NASA

sent to person Twitter account "NASA".

@NASA mentioning Twitter account "NASA".
politics filter:safe containing "politics" and Tweets marked as potentially sensitive removed.
puppy filter:media containing "puppy" and an image or a video.
puppy filter:native_video containing “puppy” and an uploaded video, Amplify video, Periscope, or Vine.
puppy filter:periscope containing “puppy” and a Periscope video URL.
puppy filter:vine containing “puppy” and a Vine.
puppy filter:images containing “puppy” and links identified as photos, including third parties such as Instagram.
puppy filter:twimg containing “puppy” and a pic.twitter.com link representing one or more photos.
hilarious filter:links containing “hilarious” and linking to URL.
puppy url:amazon containing “puppy” and a URL with the word “amazon” anywhere within it.
superhero since:2015-12-21 containing “superhero” and sent since date “2015-12-21” (year-month-day).
puppy until:2015-12-21 containing “puppy” and sent before the date “2015-12-21”.
movie -scary :) containing “movie”, but not “scary”, and with a positive attitude.
flight :( containing “flight” and with a negative attitude.
traffic ? containing “traffic” and asking a question.

To learn more about the Twitter Query Operators, refer to the search API documentation.

Information note

You can add RT or -RT to include or exclude retweets. For example, "Qlik RT" will search for retweets only and "Qlik -RT" will exclude retweets.

Using Twitter Action URLs (Web Intents)

You can respond to tweets or follow users from your Qlik Sense app by usingTwitter Web Intents. You can add Web Intent URLs in your Qlik Sense app, which launch Twitter on the appropriate page when they are clicked. The following table shows the URL, with the token to replace, for the popular actions:

Web intent URLs
Action URL
Reply to a tweet https://twitter.com/intent/tweet?in_reply_to=[TWEET_ID]
Retweet a tweet https://twitter.com/intent/retweet?tweet_id=[TWEET_ID]
Favorite a tweet https://twitter.com/intent/favorite?tweet_id=[TWEET_ID]
Short user profile, with option to Follow https://twitter.com/intent/user?screen_name=[SCREEN_NAME]

To learn more about use Twitter Web Intents, refer to the Twitter web contents documentation.

Working with the Twitter Search API quota limits

The Twitter Search API imposes a set of API limits for each access token for a given Qlik Web Connectors connection.

Each Twitter table will affect the rate limit differently. Details on how the table will contribute to the total API rate limit is displayed when you select the table.

To learn more about the Twitter API rate limits, refer to the Twitter API documentation.

Tip noteSelect the Ignore Rate Limit Errors option to avoid failing the table. If you reach the API rate limits and you have this option selected, the connector will return all of the data that has been received up to that point.

Reference - Twitter Developer documentation

You can refer to the Twitter Developer documentation to learn more about the requirements and restriction imposed by the Twitter API.

Troubleshooting

You receive an error message that you have reached the API rate limit

Possible cause

You have exceeded the API limits that are imposed on the Qlik Web Connectors by the Twitter Search API.

Proposed action

To reduce the impact of reaching the API rate limits, develop your app with the following in mind:

  • Extract only the data you need.
  • Reload one Twitter-based application at a time.
  • Ensure that loops in your script that make API calls will not result in infinite loops.
  • Select the Ignore Rate Limit Errors option to retrieve all data that is received before exceeding the rate limit.

You receive error code 130 - Twitter is over capacity

Possible cause

Twitter is temporarily over capacity.

Proposed action

Wait a short while and then try again.

You receive an error message when trying to preview data with direct message tables

Possible cause

The Twitter account that you are connected to does not have direct message permissions enabled. You can verify your permissions from your Twitter account.

Do the following:

  1. From your Twitter account, go to Settings and PrivacyApps.
  2. Find the Qlik Web Connectors and verify your permissions.

Proposed action

From your Twitter account settings, click Revoke access. Then, from the Data load editor, click Edit on your Twitter connection to update the connection. Click Update and then reauthenticate your connector with a new Twitter authentication token.

You receive an error message when trying to verify your account

You try to verify a connection to your Twitter account but you receive an error message saying that you are unauthorized to verify the connection or that the PIN you used is incorrect.

Possible cause

You did not use the right password when trying to authenticate the connection to your Twitter account.

Proposed action

Send an authorization request again by clicking on Authenticate. Copy the provided PIN and retry the verification process.