{"_id":"@degen/twitter-autohook","_rev":"2-9047a10825681d6d4d655fb9b6f25626","name":"@degen/twitter-autohook","dist-tags":{"latest":"2.0.1"},"versions":{"2.0.0":{"name":"@degen/twitter-autohook","version":"2.0.0","description":"Automatically setup and serve webhooks for the Twitter Account Activity API","repository":{"type":"git","url":"https://github.com/degen-workgroup/autohook"},"main":"index.js","bin":{"autohook":"cli.js"},"author":"Twitter","license":"MIT","keywords":["twitter","twitter-api","webhooks"],"dependencies":{"commander":"^2.20.0","dotenv":"^16.0.0","fastify":"^3.27.4","fastify-raw-body":"^3.2.0","needle":"^2.3.3","ngrok":"^3.2.1","nock":"^12.0.2"},"devDependencies":{"eslint":"^7.6.0","standard-version":"^9.3.2"},"scripts":{"start":"node examples/standalone-server.js","release":"standard-version"},"_id":"@degen/twitter-autohook@2.0.0","_integrity":"sha512-ROFg9ucBnz7sjk3ulRSGSDss1jyw6ym4/AJ8kOXULLzZla0CKS9P8QzJs16+71L+K/p6isXvJFieDiPR8YDfdw==","_resolved":"D:\\Projects\\bankless\\autohook\\degen-twitter-autohook-2.0.0.tgz","_from":"file:degen-twitter-autohook-2.0.0.tgz","_nodeVersion":"16.13.0","_npmVersion":"8.3.1","dist":{"integrity":"sha512-ROFg9ucBnz7sjk3ulRSGSDss1jyw6ym4/AJ8kOXULLzZla0CKS9P8QzJs16+71L+K/p6isXvJFieDiPR8YDfdw==","shasum":"ba6ef8cf1c6683f30743452af2f741a6b2e3a42c","tarball":"https://registry.npmjs.org/@degen/twitter-autohook/-/twitter-autohook-2.0.0.tgz","fileCount":33,"unpackedSize":156768,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiKpJhACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqHhBAAnHuUVgsEA3uh9vi/FkIOaqiEAiv45jVVlf5bI8I0qiZ/IGRW\r\nBqFf9B8WQGX3mpCaKUE9NnawaUqHG41Y8uqfn1njbGtN0hAb+wUrTSLLzPeu\r\nx/vGRCmFFUpSkjGte+LveRxWJgx30g2oFdz39XsArpiSC8Dcw9aCfp8BQZlY\r\nncFVyKG80p5NAJGcOWvztO9Sa9D4TdbS/kPJMhZ5EAmKdPn1KqRZudkvYFPh\r\nXB2a5HXySy8hdJ65Rq7OT0ZY2mXy82+5k8GOr13ZpaD0NSwxwSo5KGk1VE91\r\nIu3e1K/FOwLrEoeZa+v3vagKs32bIU530stfqG92D29C1Bfb8b1XTidiTUTY\r\na+hAkwbAoA0Rf/7LjbmJP37nrMk79zNX1L8RuHgO78FHr1j52OZkkFyLAZhP\r\nMU4PVPqViu9OJosbpHC27jaEmVbg8puCkNRktI7XKEMeKu3lV3WS6RnzD/CX\r\nOdcmQvwYBffPIXXaXWnch+cXj3cqAIvGwkg2QH5bLxDoseDJup+M03CK5Kmv\r\n+IP+rEMaY6Uz04zW2c7j0KexnglXj6m80WU5ve7ACxGU6eHp7QtRW/s1uWjX\r\nGRyGoVSbC8LhJH0wCSrPbBLi2hPb1hpDiqCjepgq5hAOoEk6O5a64tJAlFf8\r\nTIxu5xBzzEe5jiZgQrFGgICslClMkgUYQ6k=\r\n=7aof\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDxFBMCAxozqdtpv6gsGPRXAdeWMCrS3rc9EE072VSdNwIgClw9nIN5UeRvkBMFbZyFMyE1lFJLC+6tY7iyVGv/KwY="}]},"_npmUser":{"name":"amaredeus","email":"patinobrian@gmail.com"},"directories":{},"maintainers":[{"name":"amaredeus","email":"patinobrian@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/twitter-autohook_2.0.0_1646957153644_0.5352724132402276"},"_hasShrinkwrap":false},"2.0.1":{"name":"@degen/twitter-autohook","version":"2.0.1","description":"Automatically setup and serve webhooks for the Twitter Account Activity API","repository":{"type":"git","url":"https://github.com/degen-workgroup/autohook"},"main":"index.js","bin":{"autohook":"cli.js"},"author":"Twitter","license":"MIT","keywords":["twitter","twitter-api","webhooks"],"dependencies":{"commander":"^2.20.0","dotenv":"^16.0.0","fastify":"^3.27.4","fastify-raw-body":"^3.2.0","needle":"^2.3.3","ngrok":"^3.2.1","nock":"^12.0.2"},"devDependencies":{"eslint":"^7.6.0","standard-version":"^9.3.2"},"scripts":{"start":"node examples/standalone-server.js","release":"standard-version"},"_id":"@degen/twitter-autohook@2.0.1","_integrity":"sha512-0HuNAr2oQ3UWNyiz0gYmIhn4Www3s3Y9vuIfX+YePMbYuTCPplDGojVMpC5y5A0VeGiWvyon7dUXAcLHZzdQgA==","_resolved":"D:\\Projects\\bankless\\autohook\\degen-twitter-autohook-2.0.1.tgz","_from":"file:degen-twitter-autohook-2.0.1.tgz","_nodeVersion":"16.13.0","_npmVersion":"8.3.1","dist":{"integrity":"sha512-0HuNAr2oQ3UWNyiz0gYmIhn4Www3s3Y9vuIfX+YePMbYuTCPplDGojVMpC5y5A0VeGiWvyon7dUXAcLHZzdQgA==","shasum":"95b8d012ddf0cd9e7f26e02bc5a0022bea0f5997","tarball":"https://registry.npmjs.org/@degen/twitter-autohook/-/twitter-autohook-2.0.1.tgz","fileCount":32,"unpackedSize":156285,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiK4wJACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqozBAAhOUjtSo3eIaTSM6PcD72MPVR9Xa9NTLrFVGEirkWlIWxx254\r\n1XS5r/rMJlWYmFRGLLZdRcAQ5WAUvBc1zwumgZNMMFBgZXqzdFKcD6OSGYot\r\nlTePHXr87EpniPJVYPJ+SsmtFq+G5fx809mP0oAgDBb22ffrOswwIUBQt+dZ\r\n/zoktlhIHHpmP3o4za9ch0jQxi9jzZHJFRZ3UqVH5i4M/WY8l8i5i+z0brzf\r\nQTgbzde4N1e5iMXZkrBNayTYgX/Er61FwFKfY2DCHkBtzqoeyZWKerCSTNzO\r\nnjQl1oKVPPwp3yZqAFYe/3Zq98AQkYdtNQXxisxpBQ/lZfH9w1XE7krgBI9f\r\nJxnBd606O+VzzBR4hwNS7uVA5MtJR7c7xHWjf9sjs7RglGZiZZN0wuCZTIOG\r\njXWKnj5XLTE1M/aZBHrfd9285FAKI/Z7DVcg3r5iOrIbAZZoRqKqDzBflLIg\r\n3Tz12mhp/MV3gtdrFSqG3Pb+YUE9SsB25p+6TUXwvkG0r51ITEOSUzBYw+V2\r\nqA/UXSy0xRtkYgFSr7S4Z+tu35B6e3kBtsH3KkLASe9WLLt/otAh/1j8ztMk\r\ntRyoo4fDrW8CqY6RHUAjzvqfeHIvc42oEAG8YF6T2sM60Kj5p30R4hYlxbXl\r\n76w78/M6XEfTOY714UFwYg1YUN/nd2qQ7HQ=\r\n=171Y\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDYZnDXrlHPKK9H+qwl7woo3L6q++am7nK9WGQN0n27oAiEAs00kTS+/eMksLaoM235yyWmQw7gBHTDk/M2iQJOpQJw="}]},"_npmUser":{"name":"amaredeus","email":"patinobrian@gmail.com"},"directories":{},"maintainers":[{"name":"amaredeus","email":"patinobrian@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/twitter-autohook_2.0.1_1647021064856_0.5892694807979999"},"_hasShrinkwrap":false}},"time":{"created":"2022-03-11T00:05:53.580Z","2.0.0":"2022-03-11T00:05:53.783Z","modified":"2022-04-05T03:39:23.958Z","2.0.1":"2022-03-11T17:51:05.153Z"},"maintainers":[{"name":"amaredeus","email":"patinobrian@gmail.com"}],"description":"Automatically setup and serve webhooks for the Twitter Account Activity API","keywords":["twitter","twitter-api","webhooks"],"repository":{"type":"git","url":"https://github.com/degen-workgroup/autohook"},"author":"Twitter","license":"MIT","readme":"# Autohook 🎣 + Fastify \n\nThis is a fork of [Autohook](https://github.com/twitterdev/autohook) that uses [Fastify](https://www.fastify.io/) instead of needle.\n\n![Demo](https://github.com/twitterdev/autohook/raw/master/demo.gif)\n\n* 🚀 Spawns a server for you\n* ⚙️ Registers a webhook (it removes existing webhooks if you want, and you can add more than one webhook if your Premium subscription supports it)\n* ✅ Performs the CRC validation when needed\n* 📝 Subscribes to your current user's context (you can always subscribe more users if you need)\n* 🎧 Exposes a listener so you can pick up Account Activity events and process the ones you care about\n\n## Usage\n\nYou can use Autohook as a module or as a command-line tool.\n\n### Node.js module\n\n```js\nconst { Autohook } = require('twitter-autohook');\n\n(async ƛ => {\n  const webhook = new Autohook();\n  \n  // Removes existing webhooks\n  await webhook.removeWebhooks();\n  \n  // Listens to incoming activity\n  webhook.on('event', event => console.log('Something happened:', event));\n  \n  // Starts a server and adds a new webhook\n  await webhook.start();\n  \n  // Subscribes to a user's activity\n  await webhook.subscribe({oauth_token, oauth_token_secret});\n})();\n```\n\n### Command line\n\nStarting Autohook from the command line is useful when you need to test your connection and subscriptions.\n\nWhen started from the command line, Autohook simply provisions a webhook, subscribes your user (unless you specify `--do-not-subscribe-me`), and echoes incoming events to `stdout`.\n\n```bash\n# Starts a server, removes any existing webhook, adds a new webhook, and subscribes to the authenticating user's activity.\n$ autohook -rs\n\n# All the options\n$ autohook --help\n```\n\n## OAuth\n\nAutohook works only when you pass your OAuth credentials. You won't have to figure out OAuth by yourself – Autohook will work that out for you.\n\nYou can pass your OAuth credentials in a bunch of ways.\n\n## Dotenv (~/.env.twitter)\n\nCreate a file named `~/.env.twitter` (sits in your home dir) with the following variables:\n\n```bash\nTWITTER_CONSUMER_KEY= # https://developer.twitter.com/en/apps ➡️ Your app ID ➡️ Details ➡️ API key\nTWITTER_CONSUMER_SECRET= # https://developer.twitter.com/en/apps ➡️ Your app ID ➡️ Details ➡️ API secret key\nTWITTER_ACCESS_TOKEN= # https://developer.twitter.com/en/apps ➡️ Your app ID ➡️ Details ➡️ Access token\nTWITTER_ACCESS_TOKEN_SECRET= # https://developer.twitter.com/en/apps ➡️ Your app ID ➡️ Details ➡️ Access token secret\nTWITTER_WEBHOOK_ENV= # https://developer.twitter.com/en/account/environments ➡️ One of 'Dev environment label' or 'Prod environment label'\nNGROK_AUTH_TOKEN= # https://ngrok.com/ - (optional) Create a free account to get your auth token for stable tunnels\n```\n\nAutohook will pick up these details automatically, so you won't have to specify anything in code or via CLI.\n\n## Env variables\n\nUseful when you're deploying to remote servers, and can be used in conjunction with your dotenv file.\n\n```bash\n\n# To your current environment\nexport TWITTER_CONSUMER_KEY= # https://developer.twitter.com/en/apps ➡️ Your app ID ➡️ Details ➡️ API key\nexport TWITTER_CONSUMER_SECRET= # https://developer.twitter.com/en/apps ➡️ Your app ID ➡️ Details ➡️ API secret key\nexport TWITTER_ACCESS_TOKEN= # https://developer.twitter.com/en/apps ➡️ Your app ID ➡️ Details ➡️ Access token\nexport TWITTER_ACCESS_TOKEN_SECRET= # https://developer.twitter.com/en/apps ➡️ Your app ID ➡️ Details ➡️ Access token secret\nexport TWITTER_WEBHOOK_ENV= # https://developer.twitter.com/en/account/environments ➡️ One of 'Dev environment label' or 'Prod environment label'\nexport NGROK_AUTH_TOKEN= # https://ngrok.com/ - (optional) Create a free account to get your auth token for stable tunnels\n\n# To other services, e.g. Heroku\nheroku config:set TWITTER_CONSUMER_KEY=value TWITTER_CONSUMER_SECRET=value TWITTER_ACCESS_TOKEN=value TWITTER_ACCESS_TOKEN_SECRET=value TWITTER_WEBHOOK_ENV=value NGROK_AUTH_TOKEN=value\n```\n## Directly\n\nNot recommended, because you should always [secure your credentials](https://developer.twitter.com/en/docs/basics/authentication/guides/securing-keys-and-tokens.html).\n\n### Node.js\n\n```js\nnew Autohook({\n  token: 'value',\n  token_secret: 'value',\n  consumer_key: 'value',\n  consumer_secret: 'value',\n  ngrok_secret: 'value', // optional\n  env: 'env',\n  port: 1337\n});\n```\n\n### CLI\n\n```bash\n$ autohook \\\n  --token $TWITTER_ACCESS_TOKEN \\\n  --secret $TWITTER_ACCESS_TOKEN_SECRET \\\n  --consumer-key $TWITTER_CONSUMER_KEY \\\n  --consumer-secret $TWITTER_CONSUMER_SECRET \\\n  --env $TWITTER_WEBHOOK_ENV \\\n  --ngrok-secret $NGROK_AUTH_TOKEN # optional\n```\n\n## Install\n\n```bash\n# npm\n$ npm i -g twitter-autohook\n\n# Yarn\n$ yarn global add twitter-autohook\n```\n","readmeFilename":""}