Skip to content

A node application which lets you specify vote watchers and returns and stores the results in realtime

Notifications You must be signed in to change notification settings

tmwagency/node-twitter-vote-mongo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Node Twitter Hashtag Vote Monitor

**N.B. THIS DEMO IS NOT COMPLETELY COMPLETE – IT WILL WORK, BUT NEEDS A BIT OF REWORK AS IT WAS BACKPORTED FROM A MORE COMPLEX APPLICATION **

This builds on the initial demos - the Node Basic Structure demo and the Node Twitter Wall demo.

This demo shows an example of how to hook into the Twitter streaming API to compare two hashtags and display the results as a dynamic webpage.

Building on the basic app's structure, it uses Desmond Morris' node-twitter library to connect to Twitter.

It also uses MongoDB to store the values of the specified question for each day the application is running.

Note, that you will need to add your own Twitter API keys for this demo to work when run – see the documentation for how to create one and where this needs to be added into the app.

Creating your API Key

To do this go to the Twitter developer site, Sign in, and from the menu in the top right corner click on the 'My applications' option.

Image to show the My applications option on the Twitter Devs site

Then click on create a new application in the top right of the screen, and fill out the 'Create an application' form. Once this is done, scroll to the bottom of the page to 'Your access token' and click on the 'Create my access token' button.

Image to show how to create Your Access tokens from the Twitter Dev site

The access token takes a few moments to be created, so give it a minute or so, refresh the page and you should see that Twitter has assigned your app an Access token.

There are then 4 values you need to make a note of on this page and add into the demo config.

  • Consumer key
  • Consumer secret
  • Access token
  • Access token secret

An example private config is located at config/exampleconfig-twitter.js. Open this file in your text editor of choice and look for the following block of code

local : {
	consumer_key: 'INSERT_CONSUMER_KEY_HERE',
	consumer_secret: 'INSERT_CONSUMER_SECRET_HERE',
	access_token_key: 'INSERT_ACCESS_TOKEN_KEY_HERE',
	access_token_secret: 'INSERT_ACCESS_TOKEN_SECRET_HERE'
}

Replace the variables in CAPS with the values from your own created app.

Save and rename the file as privconfig-twitter.js and run the node application in the usual way, running node index.js.

About

A node application which lets you specify vote watchers and returns and stores the results in realtime

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages