Run a Botkit Bot
Botkit is the leading developer tool for building chat bots, apps and custom integrations for major messaging platforms.
Botkit offers everything you need to design, build and operate an app:
In addition, Botkit works with all the NLP services (like Microsoft LUIS and IBM Watson), it can use any type of database, and runs on almost any hosting platform.

Quick start guide

Botkit is a Node.js module and works with Node and npm.
The fastest way to start with Botkit is using botkit-starter-rocketchat:
1. clone the starter repo and install dependencies
1
git clone https://github.com/RocketChat/botkit-starter-rocketchat
2
cd botkit-starter-rocketchat/
3
npm install
Copied!
2. create a .env file with the following content
1
ROCKETCHAT_URL=<ROCKETCHAT HOST>
2
ROCKETCHAT_USER=<BOTKIT USER NAME>
3
ROCKETCHAT_PASSWORD=<BOTKIT USER PASS>
4
ROCKETCHAT_USE_SSL=<SSL USAGE>
5
ROCKETCHAT_ROOM=<ROCKETCHAT CHANNEL>
6
MENTION_ROOMS=<CHANNEL THAT THE BOT WILL ONLY ANSWER WHEN MENTIONED>
7
RESPOND_TO_DM=<ENABLE BOT TO RESPOND TO DIRECT MESSAGES>
8
RESPOND_TO_LIVECHAT=<ENABLE BOT TO RESPOND TO LIVE CHAT>
9
RESPOND_TO_EDITED=<ENABLE BOT TO RESPOND TO EDITED MESSAGES>
Copied!
3. run the bot
1
npm start
Copied!
After executing the command, botkit will try to connect to the Rocket.Chat instance and then will listen to messages in general room:
1
Initializing Botkit v0.6.16
2
info: ** No persistent storage method specified! Data may be lost when process shuts down.
3
debug: Setting up a handler for spawned
4
debug: Setting up a handler for heard_trigger
5
debug: Setting up a handler for command_triggered
6
debug: Setting up a handler for remote_command_end
7
debug: Setting up a handler for direct_message
8
debug: Setting up a handler for live_chat
9
debug: Setting up a handler for channel
10
debug: Setting up a handler for private_channel
11
[connect] Connecting { username: 'mybotuser',
12
password: 'mypassword',
13
ldap: false,
14
host: 'myserver.com',
15
useSsl: true,
16
timeout: 20000,
17
rooms: [ 'GENERAL' ],
18
allPublic: false,
19
dm: true,
20
livechat: true,
21
edited: true,
22
integrationId: 'js.SDK',
23
roomCacheMaxSize: 10,
24
roomCacheMaxAge: 300000,
25
dmCacheMaxSize: 10,
26
dmCacheMaxAge: 100000 }
27
debug: Setting up a handler for message_received
28
debug: Setting up a handler for sticker_received
29
debug: Setting up a handler for image_received
30
debug: Setting up a handler for audio_received
31
debug: Setting up a handler for heard_trigger
32
debug: Setting up a handler for conversationStarted
33
debug: Setting up a handler for message_received
34
~~~~~~~~~~
35
NOTE: Botkit Studio functionality has not been enabled
36
To enable, pass in a studio_token parameter with a token from https://studio.botkit.ai/
37
Botkit Studio statistics are no longer supported. Update your project to the latest version of Botkit, or add `stats_optout: true` to your bot configuration.
38
[connect] Connected
39
[login] Logging in mybotuser
40
[getRoomIdByNameOrId] Calling (caching): GENERAL
41
[getRoomIdByNameOrId] Success: "GENERAL"
42
[joinRoom] Calling (async): ["GENERAL"]
43
[joinRoom] Success
44
[subscribe] Preparing subscription: stream-room-messages: __my_messages__
45
[subscribe] Stream ready: 4
46
[reactive] Listening for change events in collection stream-room-messages
Copied!
4. talk to your bot
On the server, login as a regular user (not the BOT user), go to general room, and try to talk to your bot:
Botkit bot is talking
Last modified 6mo ago
Export as PDF
Copy link