Permalink
Cannot retrieve contributors at this time
Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign up
Fetching contributors…
| var nconf = require('nconf') | |
| var request = require('request') | |
| // load config | |
| nconf.file({ file: 'config.json' }).env() | |
| // twitter authentication | |
| var twitter_oauth = { | |
| consumer_key: nconf.get('TWITTER_CONSUMER_KEY'), | |
| consumer_secret: nconf.get('TWITTER_CONSUMER_SECRET'), | |
| token: nconf.get('TWITTER_ACCESS_TOKEN'), | |
| token_secret: nconf.get('TWITTER_ACCESS_TOKEN_SECRET') | |
| } | |
| var WEBHOOK_URL = 'https://your-webhook-url' | |
| // 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(body) | |
| }) |