{"id":22860058,"url":"https://github.com/reelyactive/bins-webhook","last_synced_at":"2025-10-08T16:21:05.909Z","repository":{"id":178450274,"uuid":"661712670","full_name":"reelyactive/bins-webhook","owner":"reelyactive","description":"Webhook to forward the identifiers of detected bins.  We believe in an open Internet of Things.","archived":false,"fork":false,"pushed_at":"2024-03-06T20:10:49.000Z","size":21,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-08T01:21:05.356Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/reelyactive.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}},"created_at":"2023-07-03T13:30:22.000Z","updated_at":"2023-07-03T21:34:40.000Z","dependencies_parsed_at":"2024-03-08T13:01:25.053Z","dependency_job_id":null,"html_url":"https://github.com/reelyactive/bins-webhook","commit_stats":null,"previous_names":["reelyactive/bins-webhook"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/reelyactive/bins-webhook","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reelyactive%2Fbins-webhook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reelyactive%2Fbins-webhook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reelyactive%2Fbins-webhook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reelyactive%2Fbins-webhook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/reelyactive","download_url":"https://codeload.github.com/reelyactive/bins-webhook/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reelyactive%2Fbins-webhook/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278974723,"owners_count":26078476,"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","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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-12-13T09:08:49.216Z","updated_at":"2025-10-08T16:21:05.895Z","avatar_url":"https://github.com/reelyactive.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"bins-webhook\n============\n\nWebhook to forward the identifiers of detected bins to a remote server.\n\n\nQuick Start\n-----------\n\nClone this repository, install package dependencies with `npm install`, and then from the root folder run at any time:\n\n    npm start\n\nif using UDP raddecs as a data source, or:\n\n    npm run csl\n\nif using a CSL reader as a data source.\n\n\nConfiguration\n-------------\n\nCreate a file called __options.json__ in the /config folder and include any of the properties of the following JSON:\n\n    {\n        \"hostname\": \"localhost\",\n        \"port\": 3001,\n        \"useHttps\": false,\n        \"customHeaders\": {},\n        \"heartbeatMilliseconds\": 60000,\n        \"mixingDelayMilliseconds\": 10000,\n        \"numberOfDecodingsThreshold\": 5,\n        \"signalAppearanceMilliseconds\": 5000,\n        \"cs463SignalAppearance\": false\n    }\n\nthe default values of the properties are shown above.  Each of the start scripts will reference this file, if present.\n\n\nBin Identifier Forwarding\n-------------------------\n\n__bins-webhook__ will POST an array of bin identifiers to the /bins route of the hostname/port specified in the config/options.json file every `heartbeatMilliseconds`.  In the default configuration, __bins-webhook__ will POST to [http://localhost:3001/bins](#configuration) every minute (60000ms).\n\nTo point the webhook to a different server, update the `hostname`, `port` and `useHttps` values in the options.json file as required.  For example:\n\n    {\n        \"hostname\": \"192.168.0.123\",\n        \"port\": 8080,\n        \"useHttps\": true\n    }\n\nwould POST to [https://192.168.0.123:8080/bins](#configuration).\n\nThe target server should accept application/json on the /bins route, and expect, as the body, an array of hexadecimal strings, each representing a bin identifier.  If there are no bins, __bins-webhook__ will POST an empty array.  The following example includes two 96-bit EPC identifiers.\n\n    [ \"3074257bf7194e4000001a84\", \"3074257bf7194e4000001a85\" ]\n\n\nBin Decoding\n------------\n\n__bins-webhook__ handles decodings from a [barnowl](https://github.com/reelyactive/barnowl) instance which interprets data from the underlying hardware into [raddec](https://github.com/reelyactive/raddec) objects which contain, among other things, a _transmitterId_ and _numberOfDecodings_ by _receiverId_.\n\nThe `mixingDelayMilliseconds` parameter determines for how long the barnowl instance will combine bin decodings into a single raddec to be processed by the __bins-webhook__ logic.\n\n__bins-webhook__ maintains a Map of bins (devices) in memory with the bin identifier (transmitterId) as key and the number of decodings (cumulative over all receivers) as value.  Whenever a bin is decoded, the Map is updated to increment the number of decodings.\n\nEvery `heartbeatMilliseconds`, __bins-webhook__ iterates over the Map of bins and forwards those which have a number of decodings greater than or equal to `numberOfDecodingsThreshold`, after which the Map is cleared.\n\n\nSignal Appearance\n-----------------\n\nThe detection (appearance) of a new bin can optionally be signalled on a general-purpose output of the CS463 reader by setting the `cs463SignalAppearance` option to `true`.\n\nIn this case, GPO1 will be closed when a new bin appears and opened after `signalAppearanceMilliseconds`.  If multiple bins appear within the signal window, GPO1 will be opened `signalAppearanceMilliseconds` after the last bin appears within the window.\n\nNote that toggling GPO1 on the CS463 may require additional permissions which can be set with the following commands (on the CS463 itself):\n\n    sudo chmod 755 /opt/inf_out_set\n    sudo chmod 666 /sys/class/gpio/gpio205/value\n\nTo ensure these additional permissions apply each time the CS463 reboots, add the two commands above to the end of the /etc/rc.local file.\n\n\nLicense\n-------\n\nMIT License\n\nCopyright (c) 2023-2024 [reelyActive](https://www.reelyactive.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR \nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE \nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, \nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN \nTHE SOFTWARE.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freelyactive%2Fbins-webhook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freelyactive%2Fbins-webhook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freelyactive%2Fbins-webhook/lists"}