Twitter APIs

Integrate Twitter APIs with Baseet

One of strengths is its ability to integrate with many applications and tools. As an example, many developers especially data scientists find difficulty in using Twitter APIs. So, it is superb if build nodes for these APIs and users use them directly without go into details.

To use Twitter APIs, you must have a developer account and create an application there, then you will able to generate your tokens in that app (keys and tokens tab); more information at Twitter Apps documentation.So we need a user authentication node that will be used with any Twitter API, we built this node on Baseet:

User Authentication Node

The input of the nodes are the Twitter app keys and user tokens, while the output are the authorization object to be used in other nodes, and the keys and tokens combined in keys_info to be used in any node as needed:

The following nodes are samples of Twitter APIs we implement in to validate the idea:

Tweet Lookup by ID Node

Take tweet id as input and retrieve its text. We use Tweepy which is a python library to access GET statuses/lookup API easily to look up for the tweet.

Tweet Hide Reply Node

Hide a reply given it's ID using Twitter hide reply API:

Is user a Bot? Node

Calculate the percentage of probability that user is a bot by retrieving his timeline information/followers and other features using botometer library and user RapidAPI key:

Block Twitter user Node

Block a user on Twitter given his screen_name (handler) using Twitter GET blocks/ids API:

Simple APP

Assume we want to build a simple app to use the previous nodes: search for a tweet given its id using Twitter search API, hide a specific tweet, check the percentage of the probability if user a bot, and block a user. For all of the nodes, we need firstly to authenticate via the generated tokens so can access the tweets.

Sample output of the simple app as follows:

That’s a simple app, that when building such nodes, other users can use them directly with their own tokens in order to build a whole application for Twitter as Baseet team did, by developing Baseet Hide Reply service which combines between using Twitter API nodes and machine learning nodes for comments classifications. In this way, users and data scientists especially can build Twitter apps with leverage AI in it using Baseet.