{"id":21406619,"url":"https://github.com/ringcentral/ringcentral-chatbot-core","last_synced_at":"2025-07-14T00:32:37.752Z","repository":{"id":38376011,"uuid":"422133241","full_name":"ringcentral/ringcentral-chatbot-core","owner":"ringcentral","description":"This is a fork of https://github.com/ringcentral/ringcentral-chatbot-js, the goal is put bot logic into one standalone module so add-in framework or other project can use it.","archived":false,"fork":false,"pushed_at":"2024-11-19T03:26:39.000Z","size":1677,"stargazers_count":3,"open_issues_count":9,"forks_count":3,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-07-03T23:51:31.854Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"DaKingKong/ringcentral-chatbot-core","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ringcentral.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":"2021-10-28T08:56:28.000Z","updated_at":"2024-06-27T02:52:50.000Z","dependencies_parsed_at":"2024-01-19T03:31:00.338Z","dependency_job_id":"b8cad3bb-8859-44c0-a00f-9496354d000a","html_url":"https://github.com/ringcentral/ringcentral-chatbot-core","commit_stats":{"total_commits":56,"total_committers":3,"mean_commits":"18.666666666666668","dds":0.4642857142857143,"last_synced_commit":"2afe8a62d61ffa2a92a2e3f61d42ddff7c8ce49f"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/ringcentral/ringcentral-chatbot-core","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ringcentral%2Fringcentral-chatbot-core","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ringcentral%2Fringcentral-chatbot-core/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ringcentral%2Fringcentral-chatbot-core/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ringcentral%2Fringcentral-chatbot-core/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ringcentral","download_url":"https://codeload.github.com/ringcentral/ringcentral-chatbot-core/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ringcentral%2Fringcentral-chatbot-core/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265227898,"owners_count":23731059,"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-11-22T16:40:56.843Z","updated_at":"2025-07-14T00:32:37.301Z","avatar_url":"https://github.com/ringcentral.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RingCentral chatbot framework Core module\n\nThis is a fork of [https://github.com/ringcentral/ringcentral-chatbot-js](https://github.com/ringcentral/ringcentral-chatbot-js), the goal is put bot logic into one standalone module so add-in framework or other project can use it.\n\n## How to use\n\n```js\nimport { extendApp } from 'ringcentral-chatbot-core'\nimport express from 'express'\n\nfunction eventHandler ({\n    type, // could be 'BotRemoved', 'Message4Bot', 'Message4Others', 'BotGroupLeft', 'BotJoinGroup', 'Maintain', 'SetupDatabase'\n    bot, // the bot instance, check src/models/Bot.ts for instance methods\n    text, // the text message user posted in chatgroup\n    group, // the group object, can get chat group id from group.id\n    userId, // message creator's id\n    isPrivateChat, // if it is a private chat\n    message, // message object, check ringcentral api document for detail\n    commandLineOptions, // only if set commandLineConfigs in botConfig, would get parse result from text, check doc/command-line-parser.md for detail\n}) {\n    console.log(\n        type,\n        bot,\n        text,\n        group,\n        userId,\n        message\n    )\n\n  // bot.sendMessage(groupId, body)\n  if (type === 'BotJoinGroup') {\n    await bot.sendAdaptiveCard(group.id, {\n      $schema: 'http://adaptivecards.io/schemas/adaptive-card.json',\n      type: 'AdaptiveCard',\n      version: '1.3',\n      body: [\n        {\n          type: 'TextBlock',\n          text: 'hello!',\n          size: 'large'\n        },\n        {\n          type: 'TextBlock',\n          text: 'I am a chat bot',\n          weight: 'bolder'\n        }\n      ]\n    })\n    // or send text message\n    // await bot.sendMessage(group.id, {\n    //   text: 'welcome'\n    // })\n  } else if (type === 'Message4Bot') {\n    await bot.sendAdaptiveCard(group.id, {\n      $schema: 'http://adaptivecards.io/schemas/adaptive-card.json',\n      type: 'AdaptiveCard',\n      version: '1.3',\n      body: [\n        {\n          type: 'TextBlock',\n          text: 'hello!',\n          size: 'large'\n        },\n        {\n          type: 'TextBlock',\n          text: 'You posted: ' + text,\n          weight: 'bolder'\n        }\n      ]\n    })\n    // or send text message\n    // await bot.sendMessage(group.id, {\n    //   text: 'hi'\n    // })\n  }\n}\n\nconst botConfig = {\n    adminRoute: '/admin', // optional\n    botRoute: '/bot', // optional\n    models: { // optional\n        Bot: 'your bot data model defination' // check src/models/Bot.ts as a example, optional\n    },\n    commandLineConfigs: [ // optional\n      {\n        command: 'add'\n        options: [\n          ['-f, --float \u003cnumber\u003e', 'float argument'],\n          ['-i, --integer \u003cnumber\u003e', 'integer argument'],\n          ['-v, --verbose', 'verbosity that can be increased']\n        ]\n      }\n    ]\n    // if set commandLineConfigs in botConfig, would get parsed commandLineOptions object from text, check doc/command-line-parser.md for detail(use commander module)\n}\n\nlet app = express()\nconst skills = []\napp = extendApp(app, skills, eventHandler, botConfig)\napp.listen(3000, () =\u003e {\n    console.log('server running')\n})\n```\n\n## Exposed routes\n\n### bot\n\n- `/{botConfig.botRoute}/oauth`: bot oauth url\n- `/{botConfig.botRoute}/webhook`: bot webhook url\n\n### for administrator\n\n- `/{botConfig.adminRoute}/setup-database`: Init data base\n- `/{botConfig.botRoute}/update-token`: fix token for single bot\n- `/{botConfig.botRoute}/maintain`: remove dead bots from database, ensure live bots have WebHooks(fix broken subscribe), destroy very old cache data\n- `/{botConfig.botRoute}/dump-database`: provide administrator with database data for troubleshooting\n- `/{botConfig.botRoute}/list-subscriptions`: provide administrator with subscriptions data for troubleshooting\n\n\n\n## Bot instance methods\n\nCheck [src/models/Bot.ts](src/models/Bot.ts) for details.\n\n## Params controlled by ENV\n\n```js\n // default is true, can be set to false\nprocess.env.DYNAMO_SAVE_UN_KNOWN=true\n\n// default is false, can be set to true\nprocess.env.DYNAMO_SAVE_JSON_AS_OBJECT=false\n\n// default is false, can be set to true\nprocess.env.USE_HEROKU_POSTGRES = false\n\n// set db url\nRINGCENTRAL_CHATBOT_DATABASE_CONNECTION_URI = 'sqlite:///file/db.sql'\n\n// when set to 'dynamo', process.env.RINGCENTRAL_CHATBOT_DATABASE_CONNECTION_URI will be ignored\nprocess.env.DIALECT = 'dynamo'\n```\n\n## More details\n\nCheck [https://github.com/ringcentral/ringcentral-chatbot-js](https://github.com/ringcentral/ringcentral-chatbot-js)\n\n## demos\n\n- [https://github.com/ringcentral/demo-bot-poly](https://github.com/ringcentral/demo-bot-poly)\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fringcentral%2Fringcentral-chatbot-core","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fringcentral%2Fringcentral-chatbot-core","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fringcentral%2Fringcentral-chatbot-core/lists"}