0

Hello this is my first time attempting to create a slackbot using this resource https://botkit.ai/ , the slackbot I am trying to create should notify me if someone' post on a slack channel is not answered after a period of time,say after 30 minutes

So far I have been able to make my slackbot respond to specific keywords

//make slackbot hear for specific keywords and then reply without directly being mentioned
let now = new Date()

controller.hears(['help', 'I need help', 'stuck', 'question'],['ambient'], function (bot,message) {

  // do something to respond to message.
  bot.reply(message,'Hello <@'+message.user+'> someone needs help!' );

});

At first I was hoping that botkit already had some time tracking features, but it doesn't seem like it does, how can I make my slackbot notify me of posts that have not been answered after a specific period of time??

Erik L
  • 195
  • 1
  • 2
  • 18

1 Answers1

0

I would look into storing state someplace. You can query for the messages in a channel and then store off when they were posted. Then, every minute (or more, depending on your needs), you can run through all those and see if they were answered. Now, it is going to be hard to know what "answered" means, unless you can control that answers are either:

  • in a thread keyed off the question
  • reference the original question via a link
  • tag the original question asker (and then you'd have an issue if someone asked two questions in a row)
  • marked with a token (like 'ANSWERED') (and then you'd have the same issue as the tag solution)

I can't think of any other way to associate an answer with a question.

Anyway, you can store off the time in a database, google spreadsheet or other solution (depending on where you are running your node code). I'm not familiar with botkit, but Transposit (disclosure, I work for them) has integration with Slack and with Google Sheets, and is free to use.

mooreds
  • 4,932
  • 2
  • 32
  • 40