0

Invite Users to Channel

by
Published today

Invite up to 100 users to a channel. Requires channels:write.invites (or channels:manage for a bot token, channels:write for a user token).

Script slack Verified

The script

Submitted by hugo989 Bun
Verified 1 hour ago
1
import { WebClient } from "@slack/web-api"
2

3
/**
4
 * Invite Users to Channel
5
 * Invite up to 100 users, by user ID, to a channel the token's user or app is in. Requires channels:write.invites on the connection (or channels:manage for a bot token, channels:write for a user token); private channels need groups:write.invites.
6
 */
7
export async function main(auth: RT.Slack, channel: string, users: string[]) {
8
  const client = new WebClient(auth.token)
9
  return await client.conversations.invite({ channel, users: users.join(",") })
10
}
11