filippo-toso/driver-rocket-chat
Composer 安装命令:
composer require filippo-toso/driver-rocket-chat
包简介
Rocket Chat driver for BotMan
关键字:
README 文档
README
BotMan driver to create bots for RocketChat
Installation & Setup
First you need to pull in the RocketChat Driver.
composer require filippo-toso/driver-rocket-chat
Then load the driver before creating the BotMan instance (only when you don't use BotMan Studio):
DriverManager::loadDriver(\FilippoToso\BotMan\Drivers\RocketChat\RocketChatDriver::class);
// Create BotMan instance
BotManFactory::create($config);
This driver requires a valid and secure URL in order to set up webhooks and receive events and information from the chat users. This means your application should be accessible through an HTTPS URL.
ngrok is a great tool to create such a public HTTPS URL for your local application. If you use Laravel Valet, you can create it with "valet share" as well.
To connect BotMan with your RocketChat server, you need to:
- Create an integration for outgoing messages. You can find more details about this process in the RocketChat documentation.
- Create a bot user in RocketChat that will "talk" with the other users.
Once you have setup the integration and created the user, you need to configure the driver. Open the app/config/botman/rocketchat.php file and insert the required information in the token, endpoint and bot parameters. Don't touch the 'matchingKeys' array.
Authentication
To send messages as the bot user the driver needs to authenticate with the REST API. To avoid the need to re-authenticate each time the bot needs to send a message, you can use the RocketChatAuth support class to get the access token and save it for later use. Here is a sample code you can use as a starting point.
use Illuminate\Support\Facades\Cache;
use FilippoToso\BotMan\Drivers\RocketChat\RocketChatAuth;
$auth = Cache::remember('rocketchat.auth', 60 * 24 * 30, function () {
return RocketChatAuth::getAuth(
config('botman.rocketchat.bot.username'),
config('botman.rocketchat.bot.password'),
config('botman.rocketchat.endpoint')
);
});
config(['botman.rocketchat.auth' => $auth]);
You must execute it before creating the BotMan instance. It checks if the auth details are saved in Laravel's cache. If they aren't, RocketChatAuth authenticates with the REST API and saves the access token and user id in the cache for later use. These details are also saved in the botman.rocketchat.auth configuration array where the driver searches for them.
Supported Features
Currently this driver supports only text messages (for both questions and answers). I'm working on the attachment implementation. If you want to contribute, get in touch!
filippo-toso/driver-rocket-chat 适用场景与选型建议
filippo-toso/driver-rocket-chat 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 194 次下载、GitHub Stars 达 8, 最近一次更新时间为 2018 年 04 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「bot」 「Botman」 「rocketchat」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 filippo-toso/driver-rocket-chat 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 filippo-toso/driver-rocket-chat 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 filippo-toso/driver-rocket-chat 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Dialogflow php sdk
Fork of botman/studio-addons to be used with PHP 8 and Laravel 9. BotMan Studio specific addons.
Laravel 5.6 Monolog custom telegram channel
RocketChat Monolog Handler
Middleware for BotMan (BotMan Studio). Integration with DialogFlow API v2.
Rocket.Chat Notifications for laravel
统计信息
- 总下载量: 194
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 8
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-04-12