Node-slack-sdk: RTM API Error: not_allowed_token_type

Created on 5 Feb 2020  路  4Comments  路  Source: slackapi/node-slack-sdk

Description

Describe your issue here.
I have been trying to get the RTM API to work, but because of some error I am unable to complete a connection to slack servers.

What type of issue is this? (place an x in one of the [ ])

  • [ ] bug
  • [ ] enhancement (feature request)
  • [x] question
  • [ ] documentation related
  • [ ] testing related
  • [ ] discussion

Requirements (place an x in each of the [ ])

  • [x] I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • [x] I've read and agree to the Code of Conduct.
  • [x] I've searched for any related issues and avoided creating a duplicate issue.

Bug Report

Filling out the following details about bugs will help us solve your issue sooner.

Packages:

Select all that apply:

  • [ ] @slack/web-api
  • [ ] @slack/events-api
  • [ ] @slack/interactive-messages
  • [x] @slack/rtm-api
  • [ ] @slack/webhooks
  • [ ] I don't know

Reproducible in:

package version: v5.0.3

node version: v12.10.0

OS version(s): MacOS v10.15.3

Steps to reproduce:

  1. Try the code in the Code Section
    2.
    3.

Expected result:

What you expected to happen

Connection to Slack RTM API to be able to realtime message with bot.

Actual result:

What actually happened

DEBUG]  WebClient:1 initialized
[DEBUG]  RTMClient:1 transitioning to state: disconnected
[DEBUG]  RTMClient:1 pausing outgoing event queue
[DEBUG]  RTMClient:1 initialized
[DEBUG]  RTMClient:1 start()
[DEBUG]  RTMClient:1 transitioning to state: connecting
[DEBUG]  RTMClient:1 transitioning to state: connecting:authenticating
[DEBUG]  WebClient:1 apiCall('rtm.connect') start
[DEBUG]  WebClient:1 will perform http request
[DEBUG]  WebClient:1 http response received
[INFO]  RTMClient:1 unable to RTM start: An API error occurred: not_allowed_token_type
[DEBUG]  RTMClient:1 transitioning to state: connecting:reconnecting

Attachments:

Logs, screenshots, screencast, sample project, funny gif, etc.
**All scopes have been added on slack app dashboard.

Code

const { RTMClient, LogLevel } = require('@slack/rtm-api');

const token = "xoxb-************-************-************************"

const rtm = new RTMClient(token,{
    dataStore: false,
    useRtmConnect: true,
    logLevel: LogLevel.DEBUG,
    // agent: proxy
  });
  rtm.on('message', (event) => {
    console.log(event);
  });

  (async () => {
    await rtm.start();
  })();
rtm-api question

All 4 comments

As mentioned in the document: https://slack.dev/node-slack-sdk/rtm-api

Note: RTM isn鈥檛 available for modern scoped apps anymore. We recommend using the Events API and Web API instead. If you need to use RTM (possibly due to corporate firewall limitations), you can do so by creating a legacy scoped app. If you have an existing RTM app, do not update its scopes as it will be updated to a modern scoped app and stop working with RTM.

You need to create a classic Slack app for using RTM API. You can create a classic app from the following URL:
https://api.slack.com/apps?new_classic_app=1

Alright, thank you for the quick response! I will look into the Event API.

Happy to hear that 馃憤 For Events API, please consider using Bolt! Bolt enables you to build an endpoint that receives events from Slack more easily. Can we close this issue now?

Yes, and thank you for the recommendation.

Was this page helpful?
0 / 5 - 0 ratings