cancel
Showing results for 
Search instead for 
Did you mean: 
intapiuser
Community Team Member
Community Team Member
Introduction
The present post explains how to connect to twitter using their API to download the list of followers of a twitter account. The solution is based on a script in nodejs that uses this npm module and mongodb.
This solution is based on the assumption that you have the consumer key, consumer secret, access token key, and access token secret of a twitter account. The script uses the steps 1 and 4 stated on the instructions of the module, and since steps 2 and 3 are responsible for requesting the token key and secret that we assume you already have, they are irrelevant.
Precondition
You have nodejs installed - note that every installation of Sisense contains an instance of nodejs in C:\Program Files\Sisense\PrismWeb\vnext\iisnodeModule 
Steps
1. download the install node-twitter-api module from github from this url and unzip it in C:\Program Files\Sisense\PrismWeb\vnext\iisnodeModule\node_modules. Make sure to change the directory name to "node-twitter-api" after you unzip it.
2. see the nodejs script attached for a working example. Place it on the same folder where nodejs is installed and make sure to complete the parameters at the top according to your case. See screenshot below for reference:
3. to execute the script, in the command line pointing to the folder where nodejs is installed, type
node node_twitter.js
4. in this example, after completing the authentication process the script downloads the list of followers and stores it in the same instance of mongodb that Sisense uses. It creates a new database called "test_insert" (you can change the name on line 51). See this page for more details on the get request.
5. follow the steps of connecting Sisense to mongodb here.
6. use the Elasticube to query one of the tables - I've used the table 'vt_users'
Note that this script will download the first 20 items of the result. To implement navigation of the result, see this resource from twitter developers forum.
 
Version history
Last update:
‎02-07-2024 12:40 PM
Updated by:
Contributors
Community Toolbox

Recommended quick links to assist you in optimizing your community experience:

Developers Group:

Product Feedback Forum:

Need additional support?:

Submit a Support Request

The Legal Stuff

Have a question about the Sisense Community?

Email [email protected]

Share this page: