Reputation: 3818
I have an application in which I need to create multi-party im groups in slack, and then provide a url to the user to access the group.
First, user A
in a given client organization A_org
registers their license of the app with slack using slacks Oauth2 method.
Later on, user B
(not the user who originally registered the app / created the auth token), needs to access a multi-party group messaging channel.
Currently, I am creating the group as so:
const response = await callSlackApiMethod('mpim.open', {
token: access_token, // <-- access token of authorizing user (user A)
users: slackIds.join(',') // <-- group of users including B, not including A
});
where callSlackApiMethod
simply GET
s the REST method from slack with provided params.
The Problem:
The group returned in response
always includes the slackId of user A
. Is there a way to create a mpim channel for user B (and other users), not including user A, and without having to seprately authorize each user?
Thanks in advance!
Upvotes: 0
Views: 166
Reputation: 32854
No, that is not possible with mpim.open. Using the token of user A to create the mpim channel is the same as user A inviting other users into a group conversation.
But you can create a new private channel with groups.create instead and invite user B to it. It will also include user A at first, but user A can leave the private channel so that only user B (and any other invited users) remains.
Please note though, that by leaving the private channel with user A you loose control over it in your script. You will not be able to re-enter or manage it in any way. A workaround that I have been using is to have a admin user account (e.g. slackadmin) which can stay in private channel without appearing as a "spying user".
Upvotes: 1