{"id":19450162,"url":"https://github.com/webexsamples/hookbuster","last_synced_at":"2025-04-25T03:32:03.499Z","repository":{"id":44536934,"uuid":"207297774","full_name":"WebexSamples/hookbuster","owner":"WebexSamples","description":"Node.js console app, that gets around webhooks by running websocket listeners","archived":false,"fork":false,"pushed_at":"2025-02-19T23:21:50.000Z","size":15926,"stargazers_count":19,"open_issues_count":2,"forks_count":13,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-04-03T15:43:10.387Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WebexSamples.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-09T11:54:23.000Z","updated_at":"2025-03-13T13:28:26.000Z","dependencies_parsed_at":"2024-05-07T19:47:11.337Z","dependency_job_id":"03644752-7c40-4bd3-8330-02a028e22f7d","html_url":"https://github.com/WebexSamples/hookbuster","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebexSamples%2Fhookbuster","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebexSamples%2Fhookbuster/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebexSamples%2Fhookbuster/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebexSamples%2Fhookbuster/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WebexSamples","download_url":"https://codeload.github.com/WebexSamples/hookbuster/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250748057,"owners_count":21480774,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T16:35:33.923Z","updated_at":"2025-04-25T03:32:03.482Z","avatar_url":"https://github.com/WebexSamples.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hookbuster\n\n## Description\n\nThis application demonstrates how to register for Webex Teams `message`, `membership` and `rooms` events via websocket using the Webex Javascript SDK.   Currently (as of September, 2019), the Webex JS SDK is the only way to receive Webex events via websocket.   This app is a simple node.js app that registers for events in Webex Teams via websocket, and forwards them to a localhost port for bots or apps that are listening on that port.   It is particularly useful for Webex Teams applications written in a language other than javascript that need to run behind a firewall, and cannot register for webhooks since they do not have a public IP address.\n\n## Requirements\n\n* **Webex Teams access token**: this will be used by the hookbuster to create websocket listeners. Ideally you would use the access token that is used by the application that hookbuster will forward the events to.\n* **open port on TARGET**: this is where the incoming HTTP requests will be forwarded to, so that the listening app can process them\n* **node.js**: will be used to run the app locally\n* **npm**: will be used to install dependencies\n\n## Install and run\n\n* clone the repo\n* ```npm install```\n* ```node app.js```\n\n## Usage  -- demonstration mode\n\nBy default the app will run in \"demonstration mode\" with a command line interface that solicits the access token, port, and which resources and events to register for:\n\n```\n  ,----------------------------------------------------------.\n  |                                                          |\n  |    _   _             _    _               _              |\n  |   | | | | ___   ___ | | _| |__  _   _ ___| |_ ___ _ __   |\n  |   | |_| |/ _ \\ / _ \\| |/ / '_ \\| | | / __| __/ _ \\ '__|  |\n  |   |  _  | (_) | (_) |   \u003c| |_) | |_| \\__ \\ ||  __/ |     |\n  |   |_| |_|\\___/ \\___/|_|\\_\\_.__/ \\__,_|___/\\__\\___|_|     |\n  |                                                          |\n  |                                                          |\n  `----------------------------------------------------------'\n\n? Enter your access token \u003e AaBbCcDdEeFfGgHhIiJjAaBbCcDdEeFfGgHhIiJjAaBbCcDdEeFfGgHhIiJj_ABCD_1a2b3c4d-1234-abcd-9876-abcdefghijkl\n! AaBbCcDdEeFfGgHhIiJjAaBbCcDdEeFfGgHhIiJjAaBbCcDdEeFfGgHhIiJj_ABCD_1a2b3c4d-1234-abcd-9876-abcdefghijkl\nINFO: token authenticated as Bot\n? Enter a port you will forward messages to \u003e 5000\n! 5000\n? Select resource [ a - all, r - rooms, m - messages, mm - memberships, aa - attachmentActions ] \u003e a\nINFO: Listening for events from the rooms resource\nINFO: Registered handler to forward  rooms:created events\nINFO: Registered handler to forward  rooms:updated events\nINFO: Listening for events from the messages resource\nINFO: Registered handler to forward  messages:created events\nINFO: Registered handler to forward  messages:deleted events\nINFO: Listening for events from the memberships resource\nINFO: Registered handler to forward  memberships:created events\nINFO: Registered handler to forward  memberships:updated events\nINFO: Registered handler to forward  memberships:deleted events\nINFO: Listening for events from the attachmentActions resource\nINFO: Registered handler to forward  attachmentActions:created events\n```\n\n**Tip**: you can use the [javabot](https://github.com/WebexSamples/javabot) to test how this app works. Start **javabot** with your access token and enter a localhost port, where **javabot** will listen to incoming messages. While both apps are running, open a Webex Teams space with the bot, whose access token you used and say **hello**. It should greet you back. :wave:\n\n## Usage -- deployment mode\n\nIf the following environment variables are set:\n\n* TOKEN\n* TARGET\n* PORT\n\nhookbuster will automatically register for all of the webhook firehose events, using the TOKEN and then forward any received events to TARGET:PORT. If you only set PORT and TOKEN in your environmental variables, then TARGET will be defaulted to localhost. Otherwise (if you do not use environmental variables) you will be prompted to enter a target manually.\n\n## Dependencies\n\n```json\n\"dependencies\": {\n  \"asciiart-logo\": \"^0.2.6\",\n  \"chalk\": \"^2.4.2\",\n  \"clear\": \"^0.1.0\",\n  \"webex\": \"^1.80.154\"\n}\n```\n\n## A note about \"read receipts\"\n\nIn addition to adding support for Webex events via websocket, the Webex JSSDK also introduces a new memberships:seen event which effectively notifies an application when a member of a space has seen messages posted in that space. As of September, 2019, there is not yet a corresponding webhook, and consequently this event is not one that is delivered via the [webhook firehose](https://developer.webex.com/docs/api/guides/webhooks/the-firehose-webhook). Since this app is designed primarily as a way to get webhook events to applications running behind a firewall, by default it does NOT register for membership:seen events.\n\nIf you would like to add membership:seen (read receipt) event processing to your application, simply uncomment the `seen` element in the `object.memberships` object defined near the top of [cli.js](./src/cli.js)\n\nFor more information on how the membership:seen events behave, run the [events via socket JSSDK sample](https://webex.github.io/webex-js-sdk/samples/browser-socket/).  It is worth noting that the system generally generates MANY more membership:seen events than all the rest of the Webex Teams events, so register for these only if your app is able to make use of them.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebexsamples%2Fhookbuster","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebexsamples%2Fhookbuster","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebexsamples%2Fhookbuster/lists"}