Last active
September 12, 2015 00:11
-
-
Save jimmylee/75f5fb931bc6665c9dfe to your computer and use it in GitHub Desktop.
Hook.io Tweet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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