1

I'm building a SlackBot with NodeJS.

I'm currently using this library slackbots, but the problem is that after the initialization, the bot does not appear in the Apps category, but it's inside SlackBot and every time I type a message it returns an error message:

I'm sorry, I don't understand! Sometimes I have an easier time with a few simple keywords. Or you can head to our wonderful Help Center for more assistance!

enter image description here

On the other side, when I send a message to a user I can see the bot I have set up: enter image description here

How can I make the bot Hugo separated from the SlackBot inside Slack?

That's how I set it up:

 var SlackBot                = require('slackbots');

 var bot = new SlackBot({
      token: process.env.SLACK_TOKEN,
      name: 'Hugo'
  });

  function get() {
      return bot;
  }

  exports.get = function() {
      return bot;
  }

  exports.send_message = function(user_ref, message) {
      bot.postMessage(user_ref, message).then((data) => {
          return data;
      });
  }

  exports.get_users = function() {
      var user_list = get().getUsers();
      return user_list;
  }

And this is how I send the test message:

  var bot                     = require('./modules/bot.js');

  bot.get().on('message', function(data) {
      console.log("#######################################"); // -> debug only
      console.log(data);
      console.log("#######################################");

      bot.send_message('USER_ID', 'test response');
  });
ste
  • 3,087
  • 5
  • 38
  • 73

0 Answers0