{"id":13827795,"url":"https://github.com/dmitrizzle/chat-bubble","last_synced_at":"2025-05-16T14:07:24.424Z","repository":{"id":49551089,"uuid":"82791993","full_name":"dmitrizzle/chat-bubble","owner":"dmitrizzle","description":"Simple chatbot UI for the Web with JSON scripting 👋🤖🤙","archived":false,"fork":false,"pushed_at":"2021-10-30T19:25:47.000Z","size":9968,"stargazers_count":592,"open_issues_count":6,"forks_count":170,"subscribers_count":26,"default_branch":"master","last_synced_at":"2025-05-16T11:18:59.932Z","etag":null,"topics":["bot","bot-framework","chat-bots","chatbot","chatbot-ui","javascript","natural-language-classifiers","nlp"],"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/dmitrizzle.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":"dmitrizzle","tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":["https://www.buymeacoffee.com/dmitrizzle"]}},"created_at":"2017-02-22T10:30:21.000Z","updated_at":"2025-05-08T08:57:08.000Z","dependencies_parsed_at":"2022-09-16T13:10:50.118Z","dependency_job_id":null,"html_url":"https://github.com/dmitrizzle/chat-bubble","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmitrizzle%2Fchat-bubble","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmitrizzle%2Fchat-bubble/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmitrizzle%2Fchat-bubble/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmitrizzle%2Fchat-bubble/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dmitrizzle","download_url":"https://codeload.github.com/dmitrizzle/chat-bubble/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254518343,"owners_count":22084379,"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":["bot","bot-framework","chat-bots","chatbot","chatbot-ui","javascript","natural-language-classifiers","nlp"],"created_at":"2024-08-04T09:02:10.297Z","updated_at":"2025-05-16T14:07:24.390Z","avatar_url":"https://github.com/dmitrizzle.png","language":"JavaScript","funding_links":["https://ko-fi.com/dmitrizzle","https://www.buymeacoffee.com/dmitrizzle"],"categories":["JavaScript"],"sub_categories":[],"readme":"# `chat-bubble` 👋🤖🤙\n\n[![npm version](https://badge.fury.io/js/chat-bubble.svg)](https://badge.fury.io/js/chat-bubble)\n![downloads](https://img.shields.io/npm/dt/chat-bubble.svg)\n\n\u003e Simple chatbot UI for the Web with JSON scripting 👋🤖🤙\n\n![Screenshot](screenshot.gif?raw=true)\n\n- Quick set-up \u0026 implementation.\n- Works with or without Natural Language Classifiers.\n- 1KB GZipped. No dependencies. Written with ES5 (compatible with IE11+).\n\n---\n\n**[Demo](#demos--more-usage-examples)** | [Tutorial Video](https://www.youtube.com/watch?v=fkJ935a7VSk)\n\n---\n\n## Installation\n\n#### Yarn/NPM\n\n`yarn add chat-bubble` or `npm install chat-bubble`\n\n#### Download\n\nGet the .ZIP file [here](https://github.com/dmitrizzle/chat-bubble/archive/master.zip).\n\n## Quick start\n\nThis method assumes you've got a development environment running that's capable of transpiling ES6 JavaScript. There's a short guide on how to get one working [here](ENV.md). Otherwise see \"[I have no ES6 dev environment](https://github.com/dmitrizzle/chat-bubble/new/master#i-have-no-es6-dev-environment).\" This guide will show you how to build [this](https://dmitrizzle.github.io/chat-bubble/examples/1-basics.html).\n\n```javascript\n/************************************************************************/\n/******* CONVENIENCE METHODS AVAILABLE FOR ES6 BUILD ENVIRONMENTS *******/\n/************************************************************************/\n\n// the URL of where you've installed the component; you may need to change this:\nimport {\n  Bubbles,\n  prepHTML\n} from \"../node_modules/chat-bubble/component/Bubbles.js\";\n\n// this is a convenience script that builds all necessary HTML,\n// imports all scripts and stylesheets; your container DIV will\n// have a default `id=\"chat\"`;\n// you can specify a different ID with:\n// `container: \"my_chatbox_id\"` option\nprepHTML({ relative_path: \"../node_modules/chat-bubble/\" });\n\n/************************************************************************/\n/************************ SAMPLE IMPLEMENTATION *************************/\n/************************************************************************/\n\n// initialize by constructing a named function...\nconst chatWindow = new Bubbles(\n  document.getElementById(\"chat\"), // ...passing HTML container element...\n  \"chatWindow\" // ...and name of the function as a parameter\n);\n\n// `.talk()` will get your bot to begin the conversation\nchatWindow.talk(\n  // pass your JSON/JavaScript object to `.talk()` function where\n  // you define how the conversation between the bot and user will go\n  {\n    // \"ice\" (as in \"breaking the ice\") is a required conversation object\n    // that maps the first thing the bot will say to the user\n    ice: {\n      // \"says\" defines an array of sequential bubbles\n      // that the bot will produce\n      says: [\"Hey!\", \"Can I have a banana?\"],\n\n      // \"reply\" is an array of possible options the user can pick from\n      // as a reply\n      reply: [\n        {\n          question: \"🍌\", // label for the reply option\n          answer: \"banana\" // key for the next conversation object\n        }\n      ]\n    }, // end required \"ice\" conversation object\n\n    // another conversation object that can be queued from within\n    // any other conversation object, including itself\n    banana: {\n      says: [\"Thank you!\", \"Can I have another banana?\"],\n      reply: [\n        {\n          question: \"🍌🍌\",\n          answer: \"banana\"\n        }\n      ]\n    } // end conversation object\n  } // end conversation object\n);\n```\n\n## \"I have no ES6 dev environment!\"\n\nIf you don't want to bother with setting up a development server and transpiler for ES6 code, I get it. Simply unzip the [package](https://github.com/dmitrizzle/chat-bubble/archive/master.zip) and create `index.html` inside of that directory. Then add all the JavaScript that you see below the `/*SAMPLE IMPLEMENTATION*/` comment in the code example above. Replace `const` with `var`.\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\"\u003e\n  \u003chead\u003e\n    \u003cmeta charset=\"UTF-8\" /\u003e\n    \u003ctitle\u003eMy chat-bubble Project\u003c/title\u003e\n\n    \u003c!-- stylesheets are conveniently separated into components --\u003e\n    \u003clink rel=\"stylesheet\" media=\"all\" href=\"../styles/setup.css\" /\u003e\n    \u003clink rel=\"stylesheet\" media=\"all\" href=\"../styles/says.css\" /\u003e\n    \u003clink rel=\"stylesheet\" media=\"all\" href=\"../styles/reply.css\" /\u003e\n    \u003clink rel=\"stylesheet\" media=\"all\" href=\"../styles/typing.css\" /\u003e\n    \u003clink rel=\"stylesheet\" media=\"all\" href=\"../styles/input.css\" /\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\n    \u003c!-- container element for chat window --\u003e\n    \u003cdiv id=\"chat\"\u003e\u003c/div\u003e\n\n    \u003c!-- import the JavaScript file --\u003e\n    \u003cscript src=\"./component/Bubbles.js\"\u003e\u003c/script\u003e\n    \u003cscript\u003e\n      /************************************************************************/\n      /**************** add \"SAMPLE IMPLEMENTATION\" code here *****************/\n      /************************************************************************/\n    \u003c/script\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n```\n\nNow open this file in your browser. Done!\n\n## Demos \u0026 more usage examples:\n\n1. [Basic example](https://dmitrizzle.github.io/chat-bubble/examples/1-basics.html): see how the code above looks in browser.\n2. [Custom starting point](https://dmitrizzle.github.io/chat-bubble/examples/2-custom-starting-point.html): what if you wanted to resume conversation from somewhere other than required `ice:{}` starting point? This is how you'd do it.\n3. [Keyboard input](https://dmitrizzle.github.io/chat-bubble/examples/3-keyboard-input.html): a basic plugin-like structure that lets you implement your own keyboard input and text recognition (though it does not process natural language).\n4. [Run scripts](https://dmitrizzle.github.io/chat-bubble/examples/4-run-scripts.html): your bot's replies can do things. Not only it could say something, but it could point your user towards an action, or perform it by running JavaScript.\n5. Natural Language Classifier implementation is possible with additional effort by intercepting the response message and keyboard input. Example using RASA ([docs](https://github.com/dmitrizzle/chat-bubble/blob/master/README_RASA.md)) can be found [here](https://github.com/dmitrizzle/chat-bubble/blob/master/examples/7-nlc-rasa.html).\n\nCheck out `/examples` folder for the source code and more ideas.\n\n## FAQ:\n\n- Can I add images and HTML code to my bot?\n  - **Yes!** custom graphics, YouTube videos - whatever you want!\n- How can I contribute?\n  - See the contribution guide [here](CONTRIBUTING.md).\n  - Buy me a coffee: use the GH \"Sponsor\" button or do it via https://ko-fi.com/dmitrizzle\n\n## Browser compatibility\n\n- You may need to add in polyfills for [`Object.assign()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign) and [`String.includes()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmitrizzle%2Fchat-bubble","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdmitrizzle%2Fchat-bubble","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmitrizzle%2Fchat-bubble/lists"}