Reputation: 1
I'm trying to make a Slack App that can send messages on user behalf (similar to Giphy, which apparently is different than regular Slack Apps).
In order to send messages as users (not just impersonating using chat:write.customized), I need the user's User Token.
When you install the app, it automatically generates a user token for the installer account, but I need a token for every user that wants to use the app.
The Slack API says "User tokens represent workspace members. They are issued for the user who installed the app and for users who authenticate the app."
How can I get users to authenticate the app and get a token for them? Is that possible?
Thank you!
I've tried searching around, but haven't been able to find much information on this yet. Others have said that you need to use the Slack App oauth page to get tokens, but I'm still not sure how users can "authenticate the app".
Upvotes: 0
Views: 1017
Reputation: 712
Instead of using legacy tokens, Slack recommends creating a Slack app with the necessary scopes. Here are some alternatives:
a. User Token with chat:write.customize
scope:
chat:write.customize
and users:read.email
scopeThis allows you to send messages with a custom username and avatar, which can be set to match your own.
To get the user oauth token:
To add the chat:write.customize and users:read.email scopes to your Slack app, you need to modify your app's configuration in the Slack API dashboard. Here's a step-by-step guide on how to do this:
-Go to the Slack API website: Visit https://api.slack.com/apps
chat:write.customize
users:read.email
Add User Token Scopes (if needed): NOTE: If you're using User tokens, you may also need to add these under "User Token Scopes".
Upvotes: 0