import { WebClient } from "@slack/web-api"
/**
* List User Groups
* List the workspace's user groups (e.g. @oncall) with their IDs and handles; `include_users` adds each group's member IDs, `include_disabled` adds disabled groups. Requires usergroups:read on the connection.
*/
export async function main(
auth: RT.Slack,
include_users?: boolean,
include_disabled?: boolean,
include_count?: boolean
) {
const client = new WebClient(auth.token)
return await client.usergroups.list(
dropEmpty({ include_users, include_disabled, include_count })
)
}
function dropEmpty<T extends { [key: string]: any }>(params: T) {
return Object.fromEntries(
Object.entries(params).filter(
([, v]) => v !== undefined && v !== null && v !== ""
)
) as T
}
Submitted by hugo989 2 hours ago