{"id":13764831,"url":"https://github.com/marchfederico/ciscospark-websocket-events","last_synced_at":"2026-02-21T14:10:35.076Z","repository":{"id":19309897,"uuid":"86751909","full_name":"marchfederico/ciscospark-websocket-events","owner":"marchfederico","description":"A simple way to get events through Cisco Spark's native websocket","archived":false,"fork":false,"pushed_at":"2024-06-29T08:33:21.000Z","size":35,"stargazers_count":19,"open_issues_count":9,"forks_count":5,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-11-23T22:08:33.141Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marchfederico.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":"2017-03-30T21:47:08.000Z","updated_at":"2023-02-14T00:26:00.000Z","dependencies_parsed_at":"2024-08-03T16:03:43.846Z","dependency_job_id":"e331919a-214f-4d06-a25d-2613fa4a7ceb","html_url":"https://github.com/marchfederico/ciscospark-websocket-events","commit_stats":{"total_commits":25,"total_committers":2,"mean_commits":12.5,"dds":0.07999999999999996,"last_synced_commit":"718ea46f89ec5a80cb530d71f9828b6ddab3c839"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/marchfederico/ciscospark-websocket-events","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marchfederico%2Fciscospark-websocket-events","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marchfederico%2Fciscospark-websocket-events/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marchfederico%2Fciscospark-websocket-events/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marchfederico%2Fciscospark-websocket-events/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marchfederico","download_url":"https://codeload.github.com/marchfederico/ciscospark-websocket-events/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marchfederico%2Fciscospark-websocket-events/sbom","scorecard":{"id":617729,"data":{"date":"2025-08-11","repo":{"name":"github.com/marchfederico/ciscospark-websocket-events","commit":"718ea46f89ec5a80cb530d71f9828b6ddab3c839"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 1/24 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 5 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-21T04:24:53.961Z","repository_id":19309897,"created_at":"2025-08-21T04:24:53.961Z","updated_at":"2025-08-21T04:24:53.961Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29682751,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-21T13:29:26.630Z","status":"ssl_error","status_checked_at":"2026-02-21T13:26:50.125Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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-08-03T16:00:29.892Z","updated_at":"2026-02-21T14:10:35.060Z","avatar_url":"https://github.com/marchfederico.png","language":"JavaScript","funding_links":[],"categories":["Developer Tools"],"sub_categories":["Web SDK \u0026 Widgets samples"],"readme":"Cisco Spark Websocket Events\n===========================================\n\nProvides a simple way to get events through Cisco Spark's native websocket.\n\nThis module is useful when deploying a Cisco Spark bot behind a firewall with no way to get the traditional inbound webhooks back to the bot.\n\n\n## Installation\n\n`npm install ciscospark-websocket-events`\n\n\n## Usage\n\nThis module can be used in two different ways.\nThe first is by setting an event callback to handle the events directly in your code.\nThe second is to define URL to the location you would like to post event data to.\n\nThe current events supported are:\n\n* Message Created\n* Membership Created\n* Room Updated\n\nHere is an example event:\n```json\n{\n  \"event\": \"created\",\n  \"resource\": \"messages\",\n  \"data\": {\n    \"id\": \"Y2lzY29zcGFyazovL3VzL01FU1NBR0UvMzkyM2RiNDAtMTU4ZS0xMWU3LWI1OWItMjNiODI4NTFiY2Fh\",\n    \"roomId\": \"Y2lzY29zcGFyazovL3VzL1JPT00vOTAwYjZiNTEtNDc2ZC0zMjkzLThlMTAtYmI1MTVjN2RjNDQy\",\n    \"roomType\": \"direct\",\n    \"text\": \"Hello\",\n    \"personId\": \"Y2lzY29zcGFyazovL3VzL1BFT1BMRS83M2YwNThiZS01MTRjLTQ5OTAtYTkyZi00MWNlY2M4NWFiMzc\",\n    \"personEmail\": \"marfeder@cisco.com\",\n    \"html\": \"\u003cp\u003e\u003cstrong\u003eHello\u003c/strong\u003e\u003c/p\u003e\",\n    \"created\": \"2017-03-30T21:17:04.628Z\"\n  }\n}\n```\n\n\n## Example 1: using the event handler callback\n\nRun the sample from a terminal:\n\n```shell\n\u003e cd ciscospark-websocket-events\n\u003e npm install\n\u003e cd tests\n\u003e SPARK_TOKEN=XXXXXXXXXXXXXXXXX node event-callback.js\n...\n``` \n\nCheck the code:\n\n```javascript\n   var SparkWebSocket = require('ciscospark-websocket-events');\n   var accessToken = process.env.SPARK_TOKEN;\n\n   sparkwebsocket = new SparkWebSocket(accessToken);\n   sparkwebsocket.connect(function (err, res){\n      if (!err) {\n        sparkwebsocket.setEventCallback(function (event){\n          console.log(\"New Event\");\n          console.log(\"---------\");\n          console.log(JSON.stringify(event, null, 2));\n          \n          // do something with the event\n        });\n\n      }\n      else {\n        console.log(\"Error starting up websocket: \" + err);\n      }\n   }):\n```\n\n\n## Example 2: forwarding the event using the webhook_url\n\n```javascript\n   var SparkWebSocket = require('ciscospark-websocket-events');\n   var accessToken = process.env.SPARK_TOKEN;\n   var webHookUrl =  process.env.WEBHOOK_URL; // http://localhost:8080/mybot/incoming_event\n\n   sparkwebsocket = new SparkWebSocket(accessToken);\n   sparkwebsocket.connect(function(err, res){\n      if (!err) {\n         if (webHookUrl) {\n            sparkwebsocket.setWebHookURL(webHookUrl);\n         }\n      }\n      else {\n         console.log(\"Error starting up websocket: \" + err);\n      }\n   });\n```\n\n\n## BotKit Example\n\nRun the sample from a terminal:\n\n```shell\n\u003e cd examples\n\u003e cd botkit\n\u003e npm install\n\u003e SPARK_TOKEN=XXXXXXXXXXXXXXXXX node bot.js\n...\n```\n\nCheck the [BotKit code sample](examples/botkit/bot.js):\n\n```javascript\n/// Setup the Cisco Spark Websocket\n\nvar SparkWebSocket = require('ciscospark-websocket-events')\n\nvar accessToken = process.env.SPARK_TOKEN\nvar PORT = process.env.PORT || 3000\n\nvar webHookUrl =  \"http://localhost:\"+PORT+\"/ciscospark/receive\"\n\nsparkwebsocket = new SparkWebSocket(accessToken)\nsparkwebsocket.connect(function(err,res){\n   if (!err) {\n         if(webHookUrl)\n             sparkwebsocket.setWebHookURL(webHookUrl)\n   }\n   else {\n        console.log(\"Error starting up websocket: \"+err)\n   }\n})\n\n//////// Bot Kit //////\n\nvar Botkit = require('botkit');\n\nvar controller = Botkit.sparkbot({\n    debug: true,\n    log: true,\n    public_address: \"https://localhost\",\n    ciscospark_access_token: process.env.SPARK_TOKEN\n});\n\n\nvar bot = controller.spawn({\n});\n\ncontroller.setupWebserver(PORT, function(err, webserver) {\n\n //setup incoming webhook handler\n  webserver.post('/ciscospark/receive', function(req, res) {\n            res.sendStatus(200)\n            controller.handleWebhookPayload(req, res, bot);\n  });\n\n});\n\ncontroller.hears('hello', 'direct_message,direct_mention', function(bot, message) {\n    bot.reply(message, 'Hi');\n});\n\ncontroller.on('direct_mention', function(bot, message) {\n    bot.reply(message, 'You mentioned me and said, \"' + message.text + '\"');\n});\n\ncontroller.on('direct_message', function(bot, message) {\n    bot.reply(message, 'I got your private message. You said, \"' + message.text + '\"');\n});\n```\n\n\n## Flint Example\n\nRun the sample from a terminal:\n\n```shell\n\u003e cd examples\n\u003e cd flint\n\u003e npm install\n\u003e SPARK_TOKEN=XXXXXXXXXXXXXXXXX node bot.js\n...\n```\n\n\nCheck the [flint code sample](examples/flint/bot.js):\n\n```javascript\n// Spark Websocket Intialization\nvar SparkWebSocket = require('ciscospark-websocket-events')\n\nvar accessToken = process.env.SPARK_TOKEN\nvar PORT = process.env.PORT || 8080\n\nvar webHookUrl =  \"http://localhost:\"+PORT+\"/flint\"\n\nsparkwebsocket = new SparkWebSocket(accessToken)\nsparkwebsocket.connect(function(err,res){\n      if (!err)\n      {\n        sparkwebsocket.setWebHookURL(webHookUrl)\n      }\n      else {\n        console.log(\"Error starting up websocket: \"+err)\n      }\n\n   })\n\n// Flint Bot Initialization\n\nvar Flint = require('node-flint');\nvar webhook = require('node-flint/webhook');\nvar express = require('express');\nvar bodyParser = require('body-parser');\nvar app = express();\napp.use(bodyParser.json());\n\n// flint options\nvar config = {\n  token: accessToken,\n  port: PORT,\n  removeWebhooksOnStart: true,\n  maxConcurrent: 5,\n  minTime: 50\n};\n\n// init flint\nvar flint = new Flint(config);\nflint.start();\n\n// say hello\nflint.hears('/hello', function(bot, trigger) {\n  flind.debug('Flind hears /hello');\n  bot.say('I hear you, %s!', trigger.personDisplayName);\n});\n\n// add flint event listeners\nflint.on('message', function(bot, trigger, id) {\n  flint.debug('\"%s\" said \"%s\" in room \"%s\"', trigger.personEmail, trigger.text, trigger.roomTitle);\n  if (trigger.text === '/hello') {\n    bot.say('\"%s\" said keyword in room \"%s\".', trigger.personEmail, trigger.roomTitle);\n  }\n});\n\nflint.on('initialized', function() {\n  flint.debug('initialized %s rooms', flint.bots.length);\n});\n\n// define express path for incoming webhooks\napp.post('/flint', webhook(flint));\n\n// start express server\nvar server = app.listen(config.port, function () {\n  flint.debug('Flint listening on port %s', config.port);\n});\n\n// gracefully shutdown (ctrl-c)\nprocess.on('SIGINT', function() {\n  flint.debug('stoppping...');\n  server.close();\n  flint.stop().then(function() {\n    process.exit();\n  });\n});\n```\n\n## Proxy Support\n\nCisco Spark Websockets now support web proxies!\n\nTo enable web proxy support set the following enviroment variables:\n* HTTP_PROXY=(to your web proxy URL)\n* NO_PROXY=localhost\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarchfederico%2Fciscospark-websocket-events","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarchfederico%2Fciscospark-websocket-events","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarchfederico%2Fciscospark-websocket-events/lists"}