Time for action – sending a tweet
Perform the following steps to send a Tweet:
Find a working copy of
social.js
(a copy can be found at https://gist.github.com/myleftboot/5093893) and copy it into theResources
folder of the app.Add a function to
app.js
that will send the Tweet. Notice that most of the Tweet functionality is in thesocial.js
file that is referenced usingrequire
at the start of the function. Nice! Replace the<<YOUR CONSUMER SECRET>>
and<<YOUR CONSUMER KEY>>
entries with the values from your Twitter app:function tweetUpdate(_args) { var social = require('social'); var twitter = social.create({ consumerSecret : '<<YOUR CONSUMER SECRET>>', consumerKey : '<<YOUR CONSUMER KEY>>' }); twitter.share({ message : "More random blocks", success : function() { alert('Tweeted!'); }, error : function(e) { alert('ERROR'+e); } }); }
Tip
It's important...