Search code examples
node.jschatbotslackslack-apislack-commands

Error: An API error occurred: missing_scope | How to get the userID with NodeJS (bolt Framework for Slack)


I'm creating a slackbot with NodeJS (bolt Framework) and I need to get the sender of the message that was sent to the bot.

My current approach is to get the information with users.identity, but every time I try to reinstall identity.basic

I get this error:

error

"Invalid permissions requested invalid_scope" on the reinstall page and when using identify instead,

I get this error in the console:

error.

Does anyone know what I could try, or is there another way to get the userID when the user sent a slash command?


Solution

  • Whenever a user triggers your Slash Command Slack sends a data payload to your configured Request URL. That payload will include the user_id of the user who triggered the command. (https://api.slack.com/interactivity/slash-commands#app_command_handling).