nestjs-slack icon indicating copy to clipboard operation
nestjs-slack copied to clipboard

ERROR [ExceptionsHandler] An API error occurred: not_authed

Open fahadBSTech opened this issue 2 years ago • 4 comments

Hi Everyone,

Hope you guys are doing great. I am using this package to send messages to the slack using SlackServide.postMessage() method. While calling it I am getting this issue. Can anyone help to resolve that issue?

Here is the sample code:

constructor(private readonly slackService: SlackService) {}

this.slackService.postMessage(payload);

fahadBSTech avatar Sep 15 '23 13:09 fahadBSTech

Hello,

Which version are you using? API, Webhook or Google Cloud Logger?

simenandre avatar Sep 15 '23 14:09 simenandre

I'm using API version.

fahadBSTech avatar Sep 15 '23 14:09 fahadBSTech

Okay, have you made sure the API key is valid? Maybe using curl or Postman to test?

Note: You might have used the wrong key.

simenandre avatar Sep 16 '23 19:09 simenandre

Yes, I am using the BOT Token to send the message. I verified that using Postman it's working fine. Here is how actually I configured it with the module.

SlackModule.forRoot({
      type: 'api',
      token: process.env.SLACK_BOT_TOKEN,
      isGlobal: true,
    }),

fahadBSTech avatar Sep 18 '23 06:09 fahadBSTech