tw-activity
A library for the Twitter Account Activity API. https://developer.twitter.com/en/docs/accounts-and-users/subscribe-account-activity/overview
How to use
Use in your shell
# install npm install -g tw-activity tw-activity --help
Use in your code
# install package
npm install tw-activity --save
// index.js const createWebhook } = const url = "https://your.domain/webhook" const oauth = // your consumer key... // may got `"[]"`
Reject on error status code
You can use rejectOnErrorStatus
to catch errors when you
receive the error status code (4xx or 5xx).
Default is false.
// <- if got status code 4xx or 5xx. // <- you will catch the error.
For more example. you can see the /bin/tw-activity
Use in your server side code
You can also generate response of your Webhook server.
const responseToken = crc { const crc_token = requestquery; if crc_token const response_token = responsestatus200; else console; response; }
API document
CLI usage
tw-activity [command]
Commands:
tw-activity --help Show help [aliases: -h, help]
tw-activity create-wh <url> Create webhook config
tw-activity delete-wh <id> Delete webhook config
tw-activity get-wh Get webhook config
tw-activity add-sub <id> Add subscription
tw-activity delete-sub <id> Delete subscription
tw-activity get-sub <id> Get subscriptions
tw-activity trigger <id> Tritter CRC request
Options:
--version Show version number [boolean]
--help Show help [boolean]
--config Twitter config file [default: "./config.json"]
--verbose Be verbose [boolean] [default: false]
Twitter config
Pass the twitter config json file.
--config [path]
{
"TWITTER_CONSUMER_KEY": "",
"TWITTER_CONSUMER_SECRET": "",
"TWITTER_ACCESS_TOKEN": "",
"TWITTER_ACCESS_TOKEN_SECRET": ""
}