- Print
- DarkLight
- PDF
Bots Development Environment Setup
- Print
- DarkLight
- PDF
Prerequisites
Developing bots on RocketChat requires you to get and customize our boilerplate code. To do that, you need to have the following on your machine.
Bot configuration
Regardless of bot type, the Rocket.Chat SDK requires you to create a configuration with some variables for your environment. This configuration can be stored in a .env
file, for local development, while in production, they would need to be set on server startup.
Bot environmental variables
The following is a list of all the environmental variables you can use in your project.
Variables marked with an asterisk (*) are mandatory.
Environment variable | Description |
---|---|
| URL of the Rocket.Chat instance to connect to. Can be specified as |
| Force bot to connect with SSL. If unset, it will try and detect from URL protocol. |
| Authorization method for a bot. Default: |
| The bot's username (account name users will summon the bot with). Must be registered on your Rocket.Chat server and granted |
| The bot user's password. |
| Stream callbacks receive messages from the listed channel name/s. Default: |
Responding to channels and DMs | |
| Stream callbacks receive messages from Livechat (true/false). Default: |
| Stream callbacks receive DMs with bot (true/false). Default: |
| Stream callbacks receive edited messages (true/false). Default: |
SDK development | |
| Size of cache (LRU) for room (ID or name) lookups. |
| Max age of cache for room lookups. |
| Size of cache for Direct Message room lookups. |
| Max age of cache for DM lookups. |
| ID applied to message object to integration source. Default: |
| Admin user name for API calls used in SDK tests. |
| Admin user password for API calls used in SDK tests. |
Hubot specific | |
| Name of the bot. Hubot listeners can respond to this. |
| Another name to respond to. If unset, the adapter sets the |
| Hubot scripts to require as NPM modules. Used only in some Docker instances. |
|
|
Common set of variables
The common set for the majority of bots is to listen and respond to direct messages and all new public channels and private groups:
RESPOND_TO_DM=true
ROCKETCHAT_ROOM=''
Note that you must add the bot's user as a member of a channel before the bot can respond.