Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open direct message channel to a user with a Slack Workspace token?

I'm working on a new Workspace app for Slack. I have a use case where I need to send notifications to users in Slack, through a direct message (or IM). Since the chat.postMessage endpoint requires a channel ID, I can get the existing IM channels using conversations.list and send them the notification.

However, if the user hasn't yet opened an IM channel from their side, I need to create one. It seems that neither Web API endpoints (conversations.open or im.open) support Workspace tokens. I keep getting not_allowed_token_type error response. I can create a public channel with conversations.create, but that's not what I need.

Is there another to open an IM channel to a user when using a Workspace token?

like image 393
JSTL Avatar asked Oct 16 '25 01:10

JSTL


1 Answers

Took me awhile to figure this out. You need to add/request the conversations.app_home:create scope to your permissions. Then you can just specify the user ID as the channel arg in a chat.postMessage call.

like image 163
Phil Christensen Avatar answered Oct 19 '25 13:10

Phil Christensen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!