{"id":22339065,"url":"https://github.com/mrcointreau/ohibot-core","last_synced_at":"2026-02-23T09:39:58.249Z","repository":{"id":44103796,"uuid":"198854695","full_name":"mrcointreau/ohibot-core","owner":"mrcointreau","description":"The perfect JavaScript library for your scripted chatbot 🤖","archived":false,"fork":false,"pushed_at":"2023-01-05T21:38:39.000Z","size":1018,"stargazers_count":4,"open_issues_count":13,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-05T21:51:17.744Z","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/mrcointreau.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-25T15:14:20.000Z","updated_at":"2025-01-07T14:34:39.000Z","dependencies_parsed_at":"2023-02-04T17:02:18.838Z","dependency_job_id":null,"html_url":"https://github.com/mrcointreau/ohibot-core","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mrcointreau/ohibot-core","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrcointreau%2Fohibot-core","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrcointreau%2Fohibot-core/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrcointreau%2Fohibot-core/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrcointreau%2Fohibot-core/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrcointreau","download_url":"https://codeload.github.com/mrcointreau/ohibot-core/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrcointreau%2Fohibot-core/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267785727,"owners_count":24144119,"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-07-29T02:00:12.549Z","response_time":2574,"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-04T07:06:56.757Z","updated_at":"2026-02-23T09:39:58.191Z","avatar_url":"https://github.com/mrcointreau.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg alt=\"ohibot-logo\" src=\"src/assets/logo.png\" width=\"256\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  The perfect JavaScript library for your scripted chatbot 🤖\n\u003c/p\u003e\n\n## Usage\n\n```javascript\n// import the personality file\nimport { default as personality } from '/src/assets/personalities/samplebot/samplebot.js'\n\n// create a new ohibot instance (with or without speech synthesis capabilities)\nconst { Ohibot, SpeechSynthesisOhibot } = ohibot\nconst samplebot = new SpeechSynthesisOhibot(new Ohibot(personality))\n\nsamplebot.introduce().then(response =\u003e {\n  // handle the response in some way\n  const pre = document.createElement('pre')\n  document.body.appendChild(pre)\n  pre.innerHTML = JSON.stringify(response, null, 2)\n})\n\nsamplebot.process('Aiuto').then(response =\u003e {\n  // handle the response in some way\n  const pre = document.createElement('pre')\n  document.body.appendChild(pre)\n  pre.innerHTML = JSON.stringify(response, null, 2)\n})\n```\n\nTry it out by serving the [index.html](index.html) file through a simple http server.\n\n## Personality\n\nA personality file is needed in order to create a new ohibot instance.\n\nThe structure of the personality file must follow the guidelines specified by the [samplebot.js](src/assets/samplebot/samplebot.js) file.\n\nA personality file is a JavaScript file which exports a default object with the following keys:\n\n- `introduction`\n- `logics`\n\n### Introduction\n\nAn array containing the ohibot welcome message(s).\n\n### Logics\n\nAn array contaning the ohibot logics, that is the way the ohibot reacts to the requests.\nEach `logics` item, a logic, is an object with the following properties:\n\n- `question`\n- `triggers`\n- `answer`\n- `action` (optional)\n- `groups` (optional)\n\n#### Question\n\nA string referring to an example of request that will trigger the logic.\n\n#### Triggers\n\nAn array of arrays containing the current logic keyword combinations (case insensitive) that will trigger the logic.\n\n#### Answer\n\nAn array of objects defining the ohibot response for a request that triggers a given logic.\n\n#### Actions and groups\n\nAn action is an object with the following properties:\n\n- `name``\n- `filterable`: a boolean, useful only from a UI perspective, that specify if the actions elements can either be filtered or not\n\nA group is an array made up of objects with the following properties:\n\n- `name`: the name of the action they refer to\n- `label` the label of the current logic when shown through an action.\n\nLet's take into consideration the following personality:\n\n```javascript\nexport default {\n  introduction: [\n    { type: 'text', content: 'Hey!' }\n  },\n  logics: [\n    {\n      question: `What's your phone number?`,\n      triggers: [['phone', 'number']],\n      answer: [{ type: 'text', content: 'My phone numbers' }],\n      action: { name: 'phone', filterable: true }\n    },\n    {\n      question: `What's your home phone number?`,\n      triggers: [['home', 'phone']],\n      answer: [{ type: 'text', content: '0123 45678' }],\n      groups: [{ name: 'phone', label: 'Home' }]\n    },\n    {\n      question: `What's your mobile phone number?`,\n      triggers: [['mobile', 'phone']],\n      answer: [{ type: 'text', content: '012 3456789' }],\n      groups: [{ name: 'phone', label: 'Mobile' }]\n    }\n  ]\n},\n```\n\nIf the request would be `What's your phone number?` the response will be\n\n```json\n{\n  \"question\": \"What's your phone number?\",\n  \"triggers\": \"\\\\bphone\\\\b.*\\\\bnumber\\\\b\",\n  \"answer\": [\n    {\n      \"type\": \"text\",\n      \"content\": \"My phone numbers\"\n    }\n  ],\n  \"action\": {\n    \"items\": [\n      {\n        \"label\": \"Home\",\n        \"question\": \"What's your home phone number?\"\n      },\n      {\n        \"label\": \"Mobile\",\n        \"question\": \"What's your mobile phone number?\"\n      }\n    ],\n    \"filterable\": false\n  }\n}\n```\n\nThis will allow you to define logics hierarchies and, from a UI perspective, presenting a list of questions that can be directly used to make new requests.\n\n## Running the tests\n\nYou can run the tests with the following command\n\n```\nnpm run test\n```\n\nTests will be automatically run before the `dist` task.\n\n## Distribution\n\nYou can distribute the last version of the library by typing\n\n```\nnpm run dist\n```\n\nIn the `dist` folder you will find the following versions\n\n- CommonJS: `ohibotCore.cjs.js`\n- ECMAScript Module: `ohibotCore.esm.js`\n- Universal Module Definition: `ohibotCore.umd.js`\n- Universal Module Definition (minified): `ohibotCore.umd.min.js`\n\n## Built With\n\n- [rollup.js](https://rollupjs.org) - The module bundler used\n- [npm](https://www.npmjs.com) - The dependency manager\n- [Babel](https://babeljs.io) - The JavaScript next generation compiler\n\n## Authors\n\n- **Luca Martini** - [LinkedIn](https://www.linkedin.com/in/lgmartini)\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details\n\n## Acknowledgments\n\nA special thanks to [Matteo Paletta](https://www.linkedin.com/in/matteopaletta) for the nicest logo ever.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrcointreau%2Fohibot-core","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrcointreau%2Fohibot-core","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrcointreau%2Fohibot-core/lists"}