Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- app.get('/subscribe-twitter-webhooks', (req, res) => {
- // twitter authentication
- var twitter_oauth = {
- consumer_key: 'CONSUMER_KEY',
- consumer_secret: 'CONSUMER_SECRET',
- token: 'ACCESS_TOKEN',
- token_secret: 'TOKEN_SECRET'
- };
- var WEBHOOK_URL = 'https://api.mydomain.com/twitter/webhooks';
- // request options
- var request_options = {
- url: 'https://api.twitter.com/1.1/account_activity/webhooks.json',
- oauth: twitter_oauth,
- headers: {
- 'Content-type': 'application/x-www-form-urlencoded'
- },
- form: {
- url: WEBHOOK_URL
- }
- }
- // POST request to create webhook config
- request.post(request_options, function (error, response, body) {
- console.log('--er--', error)
- console.log('--body--', body)
- });
- });
Add Comment
Please, Sign In to add comment