turbot/slack

steampipe plugin install slacksteampipe plugin install slack

Table: slack_group

Slack workspace user groups.

Examples

List all groups (includes deleted)

select
id,
name,
date_delete,
user_count
from
slack_group;

List groups that are currently active

select
id,
name,
user_count
from
slack_group
where
deleted_by is not null;

List all groups a user is a member of

select
g.id,
g.name
from
slack_group as g,
slack_user as u
where
g.users ? u.id
and u.email = 'dwight.schrute@dundermifflin.com';

List all user group membership pairs

select
g.name as group_name,
u.email as user_email
from
slack_group as g
left join lateral jsonb_array_elements_text(g.users) as gu on true
left join lateral (
select
id,
email
from
slack_user
) as u on u.id = gu
order by
g.name,
u.email;

.inspect slack_group

Slack workspace user groups.

NameTypeDescription
auto_typetextThe auto_type parameter can be admin for a Workspace Admins group, owner for a Workspace Owners group or null for a custom group.
created_bytextUser who created the group.
date_createtimestamp without time zoneDate when the group was created.
date_deletetimestamp without time zoneDate when the group was deleted.
date_updatetimestamp without time zoneDate when the group was last updated.
deleted_bytextUser who deleted the group.
descriptiontextDescription of the group.
handletextThe handle parameter indicates the value used to notify group members via a mention without a leading @ sign.
idtextID of the group.
is_externalbooleanTrue if the group is external facing.
is_user_groupbooleanTrue if this is a user group.
nametextName of the group.
prefsjsonbThe prefs parameter contains default channels and groups (private channels) that members of this group will be invited to upon joining.
team_idtextTeam ID the group is defined in.
updated_bytextUser who last updated the group.
user_countbigintNumber of users in the group.
usersjsonbList of users (IDs) in the group.