steampipe plugin install slack

Table: slack_user - Query Slack Users using SQL

Slack is a channel-based messaging platform used for communication and collaboration within teams. It allows users to send messages, share files, and interact with various apps. A Slack User is an individual with a unique profile within a workspace or organization in Slack.

Table Usage Guide

The slack_user table provides insights into Slack users within a workspace. As an administrator, explore user-specific details through this table, including their profile information, status, and associated metadata. Utilize it to uncover information about users, such as their activity status, role in workspace, and time zone settings.

Examples

List all users (includes deleted)

Explore all user profiles, including those that have been deleted, to gain a comprehensive view of your Slack workspace's user history. This can be particularly useful for audits, investigations, or understanding user growth and churn patterns.

select
*
from
slack_user
select
*
from
slack_user

Get user by ID

Explore which Slack user corresponds to a specific ID, allowing for targeted user information retrieval and management. This can be useful in scenarios where understanding user behavior or troubleshooting user-specific issues is required.

select
*
from
slack_user
where
id = 'U0K7FH41E';
select
*
from
slack_user
where
id = 'U0K7FH41E';

Get user by email

Explore which Slack user corresponds to a specific email address. This can be useful for identifying the user behind a particular action or message in the Slack platform.

select
*
from
slack_user
where
email = 'jim.harper@dundermifflin.com';
select
*
from
slack_user
where
email = 'jim.harper@dundermifflin.com';

List all workspace admins

Discover the segments that include all workspace administrators, allowing you to understand who holds higher permissions within your organization. This can be beneficial in managing access controls and maintaining security protocols.

select
id,
display_name,
real_name
from
slack_user
where
is_admin;
select
id,
display_name,
real_name
from
slack_user
where
is_admin;

List all bots

Discover the segments that consist of bot accounts within your Slack workspace. This can be useful in understanding the extent of automated interactions in your team's communication.

select
id,
real_name
from
slack_user
where
is_bot;
select
id,
real_name
from
slack_user
where
is_bot = 1;

List all single channel guests

Discover the segments that consist of single channel guests within your Slack workspace. This can be particularly useful to understand the extent of guest access and participation in your organization's discussions.

select
id,
real_name
from
slack_user
where
is_ultra_restricted;
select
id,
real_name
from
slack_user
where
is_ultra_restricted = 1;

List users with domains and locations

Uncover details of users, including their domain and location, to gain insights into the geographical distribution and email domain usage within your Slack user base. This can be useful for understanding the diversity of your team and for planning localized events or communications.

select
id,
display_name,
real_name,
email,
(regexp_match(email, '@(.+)')) [ 1 ] as domain,
(regexp_match(tz, '^.+/(.+)')) [ 1 ] as city,
(regexp_match(tz, '^(.+)/')) [ 1 ] as region,
updated
from
slack_user;
select
id,
display_name,
real_name,
email,
substr(email, instr(email, '@') + 1) as domain,
substr(tz, instr(tz, '/') + 1) as city,
substr(tz, 1, instr(tz, '/') -1) as region,
updated
from
slack_user;

Schema for slack_user

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form.
api_app_idtextIf an app user, then this is the unique identifier of the installed Slack application.
bot_idtextIf a bot user, this is the unique identifier of the bot.
colortextUsed in some clients to display a special username color.
deletedbooleanTrue if the user has been deleted.
display_nametextIndicates the display name that the user has chosen to identify themselves by in their workspace profile.
display_name_normalizedtextThe display name, but with any non-Latin characters filtered out.
emailtext=Email address of the user.
first_nametextFirst name of the user.
has_2fabooleanTrue if two-factor authentication is enabled for the user.
idtext=Unique identifier for the user.
image_192textURL of the user profile image, size 192x192 pixels.
image_24textURL of the user profile image, size 24x24 pixels.
image_32textURL of the user profile image, size 32x32 pixels.
image_48textURL of the user profile image, size 48x48 pixels.
image_512textURL of the user profile image, size 512x512 pixels.
image_72textURL of the user profile image, size 72x72 pixels.
image_originaltextURL of the user profile image, original size.
is_adminbooleanTrue if the user is an administrator of the current workspace.
is_app_userbooleanTrue if the user is an owner of the current workspace.
is_botbooleanTrue if the user is a bot.
is_invited_userbooleanTrue if the user joined the workspace via an invite.
is_ownerbooleanTrue if the user is an owner of the current workspace.
is_primary_ownerbooleanTrue if the user is the primary owner of the current workspace.
is_restrictedbooleanIndicates whether or not the user is a guest user. Use in combination with the is_ultra_restricted field to check if the user is a single-channel guest user.
is_strangerbooleanIf true, this user belongs to a different workspace than the one associated with your app's token, and isn't in any shared channels visible to your app. If false (or this field is not present), the user is either from the same workspace as associated with your app's token, or they are from a different workspace, but are in a shared channel that your app has access to. Read our shared channels docs for more detail.
is_ultra_restrictedbooleanIndicates whether or not the user is a single-channel guest.
job_titletextJob title of the user.
last_nametextLast name of the user.
localetextIETF language code for the user's chosen display language.
phonetextPhone number of the user.
profile_fieldsjsonbCustom fields for the profile.
real_nametextThe real name that the user specified in their workspace profile.
real_name_normalizedtextThe real_name field, but with any non-Latin characters filtered out.
skypetextSkype handle of the user.
sp_connection_nametext=, !=, ~~, ~~*, !~~, !~~*Steampipe connection name.
sp_ctxjsonbSteampipe context in JSON form.
status_emojitextStatus emoji the user has set.
status_expirationtimestamp with time zoneExpiration for the user status.
status_texttextStatus text the user has set.
team_idtextThe team workspace that the user is a member of.
tztextA human-readable string for the geographic timezone-related region this user has specified in their account.
tz_labeltextDescribes the commonly used name of the timezone.
tz_offsetbigintIndicates the number of seconds to offset UTC time by for this user's timezone.
updatedtimestamp with time zoneTime when the user was last updated.
workspace_domaintext=, !=, ~~, ~~*, !~~, !~~*The domain name for the workspace.

Export

This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.

You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh script:

/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- slack

You can pass the configuration to the command with the --config argument:

steampipe_export_slack --config '<your_config>' slack_user