PillarTechnology / botkit-storage-mysql

A MySQL storage driver for Botkit
Apache License 2.0
3 stars 6 forks source link

saveTeam data key "token" will cause slackbot to fail #4

Closed MaxBear closed 5 years ago

MaxBear commented 7 years ago

Hello:

I am working with https://github.com/howdyai/botkit-starter-slack and try to replace default storage to mysql storage. After cloning your code and try testing it, I noticed slackbot will stuck.. after debug a little, I find the reason is when initially slackbot tries to call saveTeam, a extra key "token" is required:

    var dataToSave = { 
      id: data.id,
      createdBy: data.createdBy,
      name: data.name,
      url: data.url,
      //token: data.token,
      bot: JSON.stringify(data.bot)
    };  

Since slackbot does not provide this key/value, it will stuck and cannot proceed. I am wondering if your module is intended for all bots or user need to folk according to their own implementation.

vicyankoff commented 7 years ago

hey @MaxBear you can add the token manually in the user_registration.js file. Around line 20 in this file, add the token to the team object like so: "token: payload.bot.bot_access_token". This should fix your problem and you can use this wrapper for your db.