Download the PHP package filippo-toso/driver-rocket-chat without Composer
On this page you can find all versions of the php package filippo-toso/driver-rocket-chat. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download filippo-toso/driver-rocket-chat
More information about filippo-toso/driver-rocket-chat
Files in filippo-toso/driver-rocket-chat
Package driver-rocket-chat
Short Description Rocket Chat driver for BotMan
License MIT
Homepage http://github.com/filippo.toso/driver-rocket-chat
Informations about the package driver-rocket-chat
BotMan Rocket Chat Driver
BotMan driver to create bots for RocketChat
Installation & Setup
First you need to pull in the RocketChat Driver.
Then load the driver before creating the BotMan instance (only when you don't use BotMan Studio):
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.
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!