Get visibility of Slack users by creating configurable workflows to automate tasks.
Contents
- Before you start
- Setting the Slack team ID as a global variable
- Creating workflows
- Creating user workflows
- Creating SaaS user workflows
Before you start
Before you create Slack workflows, you must add Slack OAuth credentials to Oomnitza.
Best practice is to create the Slack last login and the Slack user integration. You can use the information retrieved in these integrations to trigger workflows that can invite new users to Slack, deactivate Slack users, and much more.
Setting the Slack team ID as a global variable
To save time when you create workflows, add the Slack Team ID as a global variable in Oomnitza.
- In Oomnitza, click Configuration> General > Global Settings.
- Click Add new variable (+).
- Enter Slack.Team_id as the variable name.
- Enter the value for the Team ID.
- Save your changes.
Creating workflows
Creating user workflows with the API block
To reduce the workload and automate complex and repetitive tasks, you can use the API block to create user workflows. See Using the API block. To choose presets, enter Slack in the Select Preset search field. Select a preset and for each enter your Slack credentials in the Configure section. See Adding your Slack OAuth credentials to Oomnitza.
The Slack API block workflow comes with the following presets for users:
- Get SlackID by email
- Invite new user
- Invite users to channel
- Send message
- Deactivate user
- Using the Get SlackID by email preset
Get SlackID by email
Retrieve a single user by using their registered email address to look them up. You might need to do this when you onboard a new user. When you select the preset, you must map the API response to an Oomnitza field. To do this, complete these steps:
- In the API block window, click Advanced Mode.
- Select the Response tab. Map the Response field {{ response.user.id }} to an Oomnitza field. For example, you can map {{ response.user.id }} to the Slack user ID field that you created in Creating custom mappings.
The following user and Bot scopes are required: users:read.email
. See Slack API documentation: Lookup email.
Invite new user
Add a new user to your company's Slack account. When you select the preset, the following information is required:
-
The Slack channel IDs that you want to invite the new user to. To find the channel ID, right click the channel name and select Copy Link. The Slack URL is in the following format:
https://myteam.slack.com/archives/[channelid].
Your Channel ID begins with the letter C and contains both letters and numbers. You can enter the channel name by referring to it with a # sign, for example, #Slack-channel-name. - The invitation message for the new user.
- The team ID should be derived from the Slack.Team_id variable you set in Setting the Slack Team Id as a global variable, or it can be added manually.
Use Advanced Mode to configure the message payload.
- In the API block window, click Advanced Mode.
- Click the Body tab. Modify, update or add fields that will be used in the request payload. For information on the fields that are permitted in the request payload, see Slack API documentation: Invite user.
The following scope is required: admin.users:write
. See Slack API documentation: admin.users.invite.
Invite user to channel
Invite a new user to a channel in your Slack SaaS. When you select this preset, the following information is required:
- The Slack channel IDs. See Using the Invite user to channel preset.
- The Slack user IDs. Use the field notation {{Slack_user_id}} to add a reference to the field.
The following Bot scopes are required:channels:manage
groups:write
im:write
mpim:write
. The following user scopes are required: preset:channels:write
groups:write
im:write
mpim:write
. For further information, see Slack API documentation: conversations.invite.
Send message
Send a message to a Slack user or a channel in your Slack SaaS. When you select this preset, the following information is required:
- The Slack channel IDs. See Using the Invite user to channel preset.
- Your message to the user.
Use Advanced Mode to configure the message payload.
- In the API block window, click Advanced Mode.
- Click the Body tab. Modify, update or add fields that will be used in the request payload. Learn more about the fields that are permitted in the request payload: Slack API documentation: chat.postMessage.
The following Bot and user scopes are required for the Send message preset: chat:write
. For further information, see Slack API documentation: Send message.
Sending messages to private slack channels
If you want to use the send message preset to send messages to private Slack channels, the Oomnitza app must be added to each private channel. Complete the following actions and checks:
- Check Membership. Confirm that you are a member of the private channel that you want to send messages to.
- Access Channel Details. Right-click the name of the private channel and select View channel details.
- Manage Integrations. Navigate to the Integrations tab and click Add apps and add the that you created. See Adding your Slack OAuth credentials to Oomnitza.
Deactivate user
Deactivate a Slack user account in your Slack SaaS. A user ID is required for this preset and can be configured in Advanced Mode.
- In the API block window, click Advanced Mode.
- On the Information tab, you will see that the Slack user ID is referenced in the variable {{user_external_id}}. You can replace this with the actual user id or a different notation like {{Slack_user_id}}.
The following scope is required: admin
. See Slack API documentation: delete-users-id.
Reference articles for workflows
Creating Saas user workflows
You can create a SaaS User workflow by following the steps in Creating SaaS user workflows. To locate the available presets, enter Slack in the Select Preset search field. Select a preset and for every preset enter the following information in the Configure section:
Your Slack Credentials that you created in Adding your Slack OAuth credentials to Oomnitza.
The Slack SaaS User workflow block comes with one available preset, the SaaS user role API.
Slack SaaS user role API
Within the Slack SaaS User Role block we are able to identify different Slack roles. These are:
- Deactivated - Deleted users.
- Bot - Users that are used for the various bot activities.
- Single-Channel Guest - External users to your organization that only have access to one or a few channels.
- Multi-Channel Guest - External users to your organization that have access to multiple channels.
- Primary Owner - The primary account owner. This user is always also an Admin user.
- Owner - Additional owners. These users are always also an Admin user.
- Admin - Account administrators.
- Member - A regular user in Slack which you might get billed for based on the activity status.
The following Bot and User scopes are required for the user preset: users:read
and users:read.email
.For further information, see Slack API documentation: users.list and Slack API documentation: users.lookupByEmail
Tip: The Slack User API returns a list of all Slack users listed above. To refine the type of users returned, create a filter on the integration mapping page to load only active users. This will pass active members for further processing and load the active users into the user or SaaS User module. See Filtering results. To limit the list of users that get added to Oomnitza as members, admins, owners, multi-channel guests, and single channel guests, you might want to create the following filter:
To filter single-channel guests, add the ultra-restricted
attribute to this list as well.
Another thing to consider when loading the users in the SaaS module is Slack fair billing policy, which means you only get charged for active users. For further information see, Slack's fair billing policy.
Comments
0 comments
Please sign in to leave a comment.