{"id":15524347,"url":"https://github.com/codeforequity-at/botium-connector-websocket","last_synced_at":"2025-04-11T03:02:16.315Z","repository":{"id":55090452,"uuid":"218008167","full_name":"codeforequity-at/botium-connector-websocket","owner":"codeforequity-at","description":"Botium Connector for Websocket Endpoints","archived":false,"fork":false,"pushed_at":"2022-09-12T14:44:07.000Z","size":30,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-25T00:42:37.963Z","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/codeforequity-at.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}},"created_at":"2019-10-28T09:15:34.000Z","updated_at":"2021-10-15T10:50:37.000Z","dependencies_parsed_at":"2022-08-14T11:40:37.973Z","dependency_job_id":null,"html_url":"https://github.com/codeforequity-at/botium-connector-websocket","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeforequity-at%2Fbotium-connector-websocket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeforequity-at%2Fbotium-connector-websocket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeforequity-at%2Fbotium-connector-websocket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeforequity-at%2Fbotium-connector-websocket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codeforequity-at","download_url":"https://codeload.github.com/codeforequity-at/botium-connector-websocket/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248333605,"owners_count":21086199,"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-10-02T10:51:02.932Z","updated_at":"2025-04-11T03:02:16.284Z","avatar_url":"https://github.com/codeforequity-at.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Botium Connector for Websocket Endpoint\n\n[![NPM](https://nodei.co/npm/botium-connector-websocket.png?downloads=true\u0026downloadRank=true\u0026stars=true)](https://nodei.co/npm/botium-connector-websocket/)\n\n[![Codeship Status for codeforequity-at/botium-connector-websocket](https://app.codeship.com/projects/60211350-dba2-0137-2a2e-422ecf3ee4c1/status?branch=master)](https://app.codeship.com/projects/371437)\n[![npm version](https://badge.fury.io/js/botium-connector-websocket.svg)](https://badge.fury.io/js/botium-connector-websocket)\n[![license](https://img.shields.io/github/license/mashape/apistatus.svg)]()\n\nThis is a [Botium](https://github.com/codeforequity-at/botium-core) connector for testing your chatbot published on a [Websocket endpoint](https://en.wikipedia.org/wiki/WebSocket).\n\n__Did you read the [Botium in a Nutshell](https://medium.com/@floriantreml/botium-in-a-nutshell-part-1-overview-f8d0ceaf8fb4) articles? Be warned, without prior knowledge of Botium you won't be able to properly use this library!__\n\n## How it works\nBotium connects to your Websocket endpoint by transforming the Botium internal message representation to match your communication protocol in both directions (user to bot, bot to user).\n\nIt can be used as any other Botium connector with all Botium Stack components:\n* [Botium CLI](https://github.com/codeforequity-at/botium-cli/)\n* [Botium Bindings](https://github.com/codeforequity-at/botium-bindings/)\n* [Botium Box](https://www.botium.ai)\n\n## Requirements\n* **Node.js and NPM**\n* a bot published on a **Websocket endpoint**\n* a **project directory** on your workstation to hold test cases and Botium configuration\n\n## Install Botium and Websocket Connector\n\nWhen using __Botium CLI__:\n\n```\n\u003e npm install -g botium-cli\n\u003e npm install -g botium-connector-websocket\n\u003e botium-cli init\n\u003e botium-cli run\n```\n\nWhen using __Botium Bindings__:\n\n```\n\u003e npm install -g botium-bindings\n\u003e npm install -g botium-connector-websocket\n\u003e botium-bindings init mocha\n\u003e npm install \u0026\u0026 npm run mocha\n```\n\nWhen using __Botium Box__:\n\n_Already integrated into Botium Box, no setup required_\n\n## Connecting Websocket chatbot to Botium\n\nCreate a botium.json with the the URL of your Websocket installation in your project directory:\n\n```\n{\n  \"botium\": {\n    \"Capabilities\": {\n      \"PROJECTNAME\": \"Botium Project Websocket\",\n      \"CONTAINERMODE\": \"websocket\",\n      \"WEBSOCKET_URL\": \"ws://127.0.0.1:2345\",\n      \"WEBSOCKET_REQUEST_BODY_TEMPLATE\": {\n        \"conversationId\": \"botium\",\n        \"text\": \"{{msg.messageText}}\"\n      },\n      \"WEBSOCKET_RESPONSE_TEXTS_JSONPATH\": \"$.text\"\n    }\n  }\n}\n```\n\nTo check the configuration, run the emulator (Botium CLI required) to bring up a chat interface in your terminal window:\n\n```\n\u003e botium-cli emulator\n```\n\nBotium setup is ready.\n\n## Using a Proxy\n\nThe connector checks for the HTTPS_PROXY and HTTP_PROXY environment variables.\n\n## How to start sample\n\nThere is a simple *Echo*-bot included, see [samples/echoserver](./samples/echoserver) folder. You have to start it before running the samples:\n\n```\n\u003e npm install \u0026\u0026 npm run echoserver\n```\n\nNow you can start the included Botium samples:\n\n```\n\u003e cd ./samples/echo\n\u003e npm install \u0026\u0026 npm test\n```\n\n## Supported Capabilities\n\nSet the capability __CONTAINERMODE__ to __websocket__ to activate this connector.\n\n### WEBSOCKET_URL\nWebsocket endpoint URL, starting with _ws://_ or _wss://_\n\n### WEBSOCKET_HEADERS_TEMPLATE\nWebsocket HTTP Headers\n\n### WEBSOCKET_HANDSHAKE_TIMEOUT\n_Default: 10000 (10 sec)_\n\nOpening handshake timeout\n\n### WEBSOCKET_START_BODY_TEMPLATE\nInitial \"session setup\" message sent from Botium to the Websocket server, right after connecting.\n\n### WEBSOCKET_REQUEST_BODY_RAW\nIf set to _true_, the request body is sent as plain string, otherwise JSON formatting is applied.\n\nIf not given, this is automatically set to _true_ if the _WEBSOCKET\\_REQUEST\\_BODY\\_TEMPLATE_ capabilitiy is given\n\n### WEBSOCKET_REQUEST_BODY_TEMPLATE\n[Mustache template](https://mustache.github.io/) for converting the Botium internal message structure to the Websocket payload as required for your communication protocol.\n\nThe Mustache view contains the Botium internal message structure in the _msg_ field, see [Botium Wiki](https://botium.atlassian.net/wiki/spaces/BOTIUM/pages/38502401/Howto+develop+your+own+Botium+connector#The-outgoing-message). Example:\n\n    ...\n    \"WEBSOCKET_REQUEST_BODY_TEMPLATE\": {\n       \"conversationId\": \"botium\",\n       \"text\": \"{{msg.messageText}}\"\n    },\n    ...\n\n### WEBSOCKET_RESPONSE_RAW\nIf set to _true_, the response body is handles as plain string, otherwise JSON parsing is applied.\n\nIf not given, this is automatically set to _true_ if the _WEBSOCKET\\_RESPONSE\\_TEXTS\\_JSONPATH_ capabilitiy is given. The _WEBSOCKET\\_RESPONSE\\_*_-JSONPath expressions are only possible if this capability is set to _false_.\n\n### WEBSOCKET_RESPONSE_TEXTS_JSONPATH\n[JSONPath expression](https://github.com/dchester/jsonpath) to extract the message text from the Websocket response.\n\n### WEBSOCKET_RESPONSE_BUTTONS_JSONPATH\n[JSONPath expression](https://github.com/dchester/jsonpath) to extract button texts from the Websocket response.\n\n### WEBSOCKET_RESPONSE_MEDIA_JSONPATH\n[JSONPath expression](https://github.com/dchester/jsonpath) to extract media attachments from the Websocket response.\n\n### WEBSOCKET_REQUEST_HOOK\ntbd\n\n### WEBSOCKET_RESPONSE_HOOK\ntbd\n\n### WEBSOCKET_RESPONSE_IGNORE_EMPTY\ntbd\n\n## Current Restrictions\n\n* Only JSON data supported\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeforequity-at%2Fbotium-connector-websocket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodeforequity-at%2Fbotium-connector-websocket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeforequity-at%2Fbotium-connector-websocket/lists"}