Skip to content

Instantly share code, notes, and snippets.

@jimmylee
Last active September 12, 2015 00:11
Show Gist options
  • Save jimmylee/75f5fb931bc6665c9dfe to your computer and use it in GitHub Desktop.
Save jimmylee/75f5fb931bc6665c9dfe to your computer and use it in GitHub Desktop.
Hook.io Tweet
module['exports'] = function tweet(hook) {
var Twitter = require('twitter');
var client = new Twitter({
consumer_key: hook.env.twitter_consumer_key,
consumer_secret: hook.env.twitter_consumer_secret,
access_token_key: hook.env.twitter_token,
access_token_secret: hook.env.twitter_token_secret
});
client.post('statuses/update', {
status: hook.params.say
}, function(error, data, response){
hook.res.end({
data: {
error: JSON.stringify(error),
tweet: hook.params.say,
url: 'https://twitter.com/eatsclouds',
type: 'tweet'
}
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment