question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add slack access token in runtime

See original GitHub issue

Since i want to make the slack bot installable with oauth2, is there a method that i can use to add the access token after the bot instance is created?

Currently the token is added at SlackBot is run, which means i need to provide it at the constructor. However with oauth the token is given after the constructor is run. So now i just enter an empty string first and then manually change the _token property in SlackOAuthClient.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5

github_iconTop GitHub Comments

3reactions
tw0517twcommented, Jan 15, 2018

Although we have not implemented mapTeamToAccessToken yet, you can try bottender@0.14.15 first.

As bottender@0.14.15 using new version of underlying client (messaging-api-slack@0.6.10), you can put { token: YOUR_CUSTOM_TOKEN } as options in context.postMessage(), context.sendText() and context.postEphemeral().

2reactions
tw0517twcommented, Jan 12, 2018

Hi @IniZio ,

After reading some Slack documents, I guess we should try to support mapTeamToAccessToken in SlackBot like we have mapPageToAccessToken in MessengerBot (ref: messenger-multi-pages example).

After that, you can implement the OAuth procedure to save a team’s ID and access token in a database and let the mapTeamToAccessToken function to read your database for access tokens.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Create and regenerate API tokens - Slack
Re-issue a token · From your desktop, visit the auth.revoke page at api.slack.com/methods/auth.revoke/test to revoke your token. · Then, visit the Legacy Tokens...
Read more >
Tokens & Installation — slackclient (Legacy Python Slack SDK)
We recommend you pass tokens in as environment variables, or persist them in a database that is accessed at runtime. You can add...
Read more >
Tokens & Authentication - python-slackclient - Read the Docs
Slack tokens are the keys to your—or your customers'—teams. ... in as environment variables, or persist them in a database that is accessed...
Read more >
Slack OAuth: How to Implement It in a Node.js App - Fusebit
Connecting to Slack From Node.js · Create a New Slack Team and Workspace · Get an OAuth Token in Slack · Setting Up...
Read more >
chat.postMessage xoxb token that works to post messages to ...
I see there is an OAuth Access Token (xoxp) and Bot User OAuth Access Token (xoxb) in the Slack API Bot Dashboard under...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found