Edits history of script submission #23046 for ' Invite Users to Channel (slack)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    import { WebClient } from "@slack/web-api"
    
    /**
     * Invite Users to Channel
     * 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.
     */
    export async function main(auth: RT.Slack, channel: string, users: string[]) {
      const client = new WebClient(auth.token)
      return await client.conversations.invite({ channel, users: users.join(",") })
    }
    

    Submitted by hugo989 2 hours ago