Reputation: 1164
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
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