howdyai / botkit-starter-slack

A customizable starting point for building multi-team Slack bots that use the latest APIs
https://botkit.ai
MIT License
176 stars 141 forks source link

How to keep the bot online? #28

Open davidvexel opened 6 years ago

davidvexel commented 6 years ago

Hi guys!

I'm trying to set up this kit to remove https://github.com/mvaragnat/botkit-express-demo from my bot.

Once I cloned, installed dependencies and added my Slack app details, the bot sends me the I am a bot that has just joined your team message when the Oauth was successfully, but it never changes it states to on so I can't send any command. Also, it doesn't run if I don't remove the .data/db folder before running it.

Not sure if I'm doing something wrong or there is any configuration that I'm missing.

Thanks in advance!

davidvexel commented 6 years ago

This is the last debug message I get

debug: Got response null {"ok":true,"channel":"D52343234","ts":"1234323432343","message":{"type":"message","user":"U23423434","text":"You must now \/invite me to a channel so that I can be of use!","bot_id":"B5ACE7CH1","ts":"1234323432343"}}
benbrown commented 6 years ago

@davidvexel you should use the much more modern starting point in botkit-starter-slack!

https://github.com/howdyai/botkit-starter-slack

OR, do:

npm install -g botkit
botkit new --platform slack
benbrown commented 6 years ago

Wait, duh, I misread your message! Apologies.

The online status (the green dot next to username) for bots that use Slack's "events API" is controlled inside the api.slack.com site, under teh bot user section. Look for the option that says "always appear online."

Regardless, if properly configured with events API, you should be able to send and receive messages with the bot whether it appears online or not.

davidvexel commented 6 years ago

Hi @benbrown,

Yeah the app config in Slack looks good, it works fine if I use the same app with a different project, I guess could be something in the code...

But I'll try this first

npm install -g botkit
botkit new --platform slack

Thank you!