2

Having troubles to get my head around slack apps with node.js. I am using the Starter Botkit (Howdy), hosted on glitch (glitch.com)

What I have so far works perfectly, it starts a convo with the user, asks a few questions, one after another and ends with a summary including all answers the user gave to the bot.

module.exports = function(controller) {

 controller.hears(['reminder'], 'direct_message', function(bot, message) {

 bot.startConversation(message, function(err, convo) {
   convo.say('Ok, let me help you with that ...');

   // Ask Target
   convo.ask('Who should I remind ?', function(response, convo) {

    convo.setVar('target', response.text);
    convo.next();

   });

   // Ask About
   convo.ask('About what ?', function(response, convo) {

    convo.setVar('about', response.text);
    convo.next();

   });

   // Ask Date
   convo.ask('Date ?', function(response, convo) {

    convo.setVar('date', response.text);
    convo.next();

   });

   // Ask Time
   convo.ask('And what time ?', function(response, convo) {

    convo.setVar('time', response.text);
    convo.next();

   });

   convo.say('Got it, I should remind {{vars.target}} : {{vars.about}} on {{vars.date}} at {{vars.time}}');
   convo.next();

  });
 });
};

Now I want to make more use of all the methods Slack is providing through the API, for example the reminders.add method. I can't find any starting point in writing a function that uses this method. Or how to include it in the code above. I am on beginner level of knowledge, please be patient with me :)

For what I understand, all the Oauth process is already taken care of within the botkit files (just need to provide all the keys, and install the app in my team)

1 Answer 1

2

I read the BotKit docs for you and found that they show an example where you simply access the Slack api via the api property on the bot object.

https://github.com/howdyai/botkit/blob/master/readme-slack.md#working-with-slack-integrations

bot.api.channels.list({},function(err,response) {
  //Do something...
})
Sign up to request clarification or add additional context in comments.

1 Comment

My hero ! Thanks <3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.