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_userwhere id = 'U0K7FH41E';
select *from slack_userwhere 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_userwhere email = 'jim.harper@dundermifflin.com';
select *from slack_userwhere 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_namefrom slack_userwhere is_admin;
select id, display_name, real_namefrom slack_userwhere 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_namefrom slack_userwhere is_bot;
select id, real_namefrom slack_userwhere 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_namefrom slack_userwhere is_ultra_restricted;
select id, real_namefrom slack_userwhere 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, updatedfrom 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, updatedfrom slack_user;
Schema for slack_user
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
api_app_id | text | If an app user, then this is the unique identifier of the installed Slack application. | |
bot_id | text | If a bot user, this is the unique identifier of the bot. | |
color | text | Used in some clients to display a special username color. | |
deleted | boolean | True if the user has been deleted. | |
display_name | text | Indicates the display name that the user has chosen to identify themselves by in their workspace profile. | |
display_name_normalized | text | The display name, but with any non-Latin characters filtered out. | |
text | = | Email address of the user. | |
first_name | text | First name of the user. | |
has_2fa | boolean | True if two-factor authentication is enabled for the user. | |
id | text | = | Unique identifier for the user. |
image_192 | text | URL of the user profile image, size 192x192 pixels. | |
image_24 | text | URL of the user profile image, size 24x24 pixels. | |
image_32 | text | URL of the user profile image, size 32x32 pixels. | |
image_48 | text | URL of the user profile image, size 48x48 pixels. | |
image_512 | text | URL of the user profile image, size 512x512 pixels. | |
image_72 | text | URL of the user profile image, size 72x72 pixels. | |
image_original | text | URL of the user profile image, original size. | |
is_admin | boolean | True if the user is an administrator of the current workspace. | |
is_app_user | boolean | True if the user is an owner of the current workspace. | |
is_bot | boolean | True if the user is a bot. | |
is_invited_user | boolean | True if the user joined the workspace via an invite. | |
is_owner | boolean | True if the user is an owner of the current workspace. | |
is_primary_owner | boolean | True if the user is the primary owner of the current workspace. | |
is_restricted | boolean | Indicates 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_stranger | boolean | If 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_restricted | boolean | Indicates whether or not the user is a single-channel guest. | |
job_title | text | Job title of the user. | |
last_name | text | Last name of the user. | |
locale | text | IETF language code for the user's chosen display language. | |
phone | text | Phone number of the user. | |
profile_fields | jsonb | Custom fields for the profile. | |
real_name | text | The real name that the user specified in their workspace profile. | |
real_name_normalized | text | The real_name field, but with any non-Latin characters filtered out. | |
skype | text | Skype handle of the user. | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
status_emoji | text | Status emoji the user has set. | |
status_expiration | timestamp with time zone | Expiration for the user status. | |
status_text | text | Status text the user has set. | |
team_id | text | The team workspace that the user is a member of. | |
tz | text | A human-readable string for the geographic timezone-related region this user has specified in their account. | |
tz_label | text | Describes the commonly used name of the timezone. | |
tz_offset | bigint | Indicates the number of seconds to offset UTC time by for this user's timezone. | |
updated | timestamp with time zone | Time when the user was last updated. | |
workspace_domain | text | =, !=, ~~, ~~*, !~~, !~~* | 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