Open lpatmo opened 6 years ago
Will need to do a bit more research here, but generally, I think we'll need to do the following:
1) Subscribe the bot_user to app_mention
in the Slack /events
API (See: https://api.slack.com/bot-users)
2) Add the incoming message for the bot to the generic method that parses /events
in the CodeBuddies app
3) Add a method to respond to the message, based on it's flag or content or other criteria. In this case, it would be an "unclassified" message - so maybe this can be set up as a default case in a switch statement that handles any messages addressed directly to the bot.
4) A basic bot reply will be required to open a websocket with the RTM API by sending an authenticated call to the rtm.connect
API method (See: https://api.slack.com/rtm). chat.postEphemeral
might also be useful in this context (https://api.slack.com/methods/chat.postEphemeral). If it's decided that a more complicated (or emoji-tastic ) response is needed, then the bot will need to use the Web API method chat.postMessage
(https://api.slack.com/methods/chat.postMessage).
As for messages. Something along the lines of:
Thanks for your reply, but I'm only a humble bot. Please post in #codebuddies-meta or #general to interact with human community members. ❤️
If users type a message back to greetbot, we should respond and inform them that they're typing to a bot.