-
Notifications
You must be signed in to change notification settings - Fork 678
Closed
Labels
questionM-T: User needs support to use the projectM-T: User needs support to use the project
Description
Description
Cannot star rtm client by providing valid xoxb token shown not_allowed_token_type error
use sample code
Am I missing something ?
I'm sure I am using a bot user token (xoxb), not a user token and the token can push message as bot to specific channel
const { RTMClient } = require("@slack/rtm-api");
import config from "../config";
// An access token (from your Slack app or custom integration - usually xoxb)
const token = config.SLACK_BOT_USER_AUTH_TOKEN;
// The client is initialized and then started to get an active connection to the platform
const rtm = new RTMClient(token);
rtm.start().catch(console.error);
// Calling `rtm.on(eventName, eventHandler)` allows you to handle events (see: https://api.slack.com/events)
// When the connection is active, the 'ready' event will be triggered
rtm.on("ready", async () => {
// Sending a message requires a channel ID, a DM ID, an MPDM ID, or a group ID
// The following value is used as an example
const conversationId = "C1232456";
// The RTM client can send simple string messages
const res = await rtm.sendMessage("Hello there", conversationId);
// `res` contains information about the sent message
console.log("Message sent: ", res.ts);
});
// After the connection is open, your app will start receiving other events.
rtm.on("user_typing", event => {
// The argument is the event as shown in the reference docs.
// For example, https://api.slack.com/events/user_typing
console.log(event);
});What type of issue is this? (place an x in one of the [ ])
- bug
- enhancement (feature request)
- question
- documentation related
- testing related
- discussion
Requirements (place an x in each of the [ ])
- I've read and understood the Contributing guidelines and have done my best effort to follow them.
- I've read and agree to the Code of Conduct.
- I've searched for any related issues and avoided creating a duplicate issue.
Packages:
Select all that apply:
-
@slack/web-api -
@slack/events-api -
@slack/interactive-messages -
@slack/rtm-api -
@slack/webhooks - I don't know
Reproducible in:
package version: 5.0.3
node version: 10.15.3
OS version(s): MAC Mojave
Steps to reproduce:
- use rtm sample code and provide valid
xoxbtoken - run the code and display
not_allowed_token_typethere is no documentation aboutnot_allowed_token_typeerror
Expected result:
rtm client should connected
Actual result:
[INFO] RTMClient:1 unable to RTM start: An API error occurred: not_allowed_token_type
Attachments:
Metadata
Metadata
Assignees
Labels
questionM-T: User needs support to use the projectM-T: User needs support to use the project
