Jeremy M.
Jeremy M.

Reputation: 1164

Slack App (bot) send private messages to multiple users

i'm trying to create a chess bot to play with other users on the workspace. I can't figure out how to create a private conversation including 2 users (the 2 players) and the bot user. To play in private.

I tried to use the slack api but it does not work.

Upvotes: 3

Views: 2046

Answers (1)

Erik Kalkoken
Erik Kalkoken

Reputation: 32698

I would recommend using a "multi-person direct message" (MPIM). It allows you to create a new / or join an existing direct message channel with multiple users, e.g. 2 players and your bot user.

A MPIM is different from a private channel as it does not require a dedicated name and you can create multiple in the same workspace as long as it contains a different set of users.

To open a MPIM call the API method conversations.open with your bot user token and provide the user IDs of the two users in the users parameter. You will get a channel ID in return, which you can use later to resume the conversation. Alternatively you can just open it again with the same list of users.

Upvotes: 2

Related Questions