Search code examples
coffeescripthubotslack

Using hubot to have a converstion with a user


I am hoping to create a slackbot which when it's asked something to respond with a question and listen for an answer to that specific question, only when its asked though.

For example

User: @Hubot Please add a link to youtube
Hubot: @User Can you please post a link to youtube
User: @Hubot youtube.com
Hubot: @User A link to youtube has been added

However I don't hubot to always listen for a url to be posted to it, I only want it to listen for a url after its been asked to add one. Hubot will timeout after a certain amount of time if a url hasn't been sent to it.

For example

User: @Hubot Please add a link to youtube
Hubot: @User Can you please post a link to youtube
Hubot: @User Timeout: 1min url not added, you will need to add link to youtube again to save

The plan is to save the website name and url to the brain and when its asked for the website hubot will post the url. It is only the conversation part I'm having trouble with.


Solution

  • I looked into this functionality for our Hubot a few weeks ago, but haven't got back to actually building it. This is the module I was planning on using:

    https://github.com/lmarkus/hubot-conversation