Workspace Operations

In this article

Overview

Use this Snap to perform the following Workspace operations.

  • Workspace Info
  • Create Workspace
  • List Workspaces
  • List Channels
  • List Users
  • Delete Channel

Prerequisites

Add valid Slack Scopes based on the intended operation. You must have the owner or administrator privileges to perform some of these operations. See Required Slack Scopes below for details.

Required Slack Scopes

Any action you want to perform within a Slack Workspace, additionally needs appropriate Scopes assigned to your app. See the Scope and Permissions article in Slack API documentation for the complete list and each Account page under Configuring Slack Accounts for information on defining Scopes for your app.

ToBot Token Accounts
(scope)

User Token Accounts
(user_scope)

Workspace InfoN/Aadmin.teams:read
Create WorkspaceN/Aadmin.teams:write
List WorkspacesN/Aadmin.teams:read
List Channels in a WorkspaceN/Aadmin.usergroups:read 
List Users in a WorkspaceN/Aadmin.users:read
Delete ChannelN/A

admin.usergroups:write OR
admin.conversations:write OR 
admin.users:write 

Support for Ultra Pipelines

Works in Ultra Pipelines

Limitations

  • Workspace operations work with User Tokens only. Do not use Bot Token Account with this Snap.
  • Snaps in this Snap Pack use conditional display/hiding of fields. So, ensure that you always use the New Form UI (and not the classic UI) for the Snaps to function as designed/expected.

Known Issues

This Snap is not tested with admin credentials against an Enterprise-oriented Slack installation and this document does not deal with these features in detail.

Snap Input and Output

Input/OutputType of ViewNumber of ViewsExamples of Upstream and Downstream SnapsDescription
Input 

Document

  • Min: 0
  • Max: 1
  • Mapper
  • Copy
  • JSON Generator
A document with an input to perform one of the Workspace operations.
Output

Document

  • Min: 1
  • Max: 1
  • Mapper
  • JSON Formatter
  • Filter

A document containing the output records or result (success/failure) based on the operation performed.

Snap Settings

Parameter NameData TypeDescriptionDefault ValueExample 
LabelString
Specify a name for the Snap. You can modify this to be more specific, especially if you have more than one of the same Snap in your Pipeline.
Workspace OperationsWorkspace Operations
OperationDrop-down list

Select an operation from the following list of permitted workspace operations and specify the corresponding details needed:

  • Workspace Info. To fetch information about settings in a workspace.
  • Create WorkspaceTo create an Enterprise Team/Workspace. Also, specify the details for the new team/workspace. Needs Admin permissions for the Enterprise Grid.
  • List Workspaces. To list all teams/workspaces on an Enterprise/organization. Needs Admin permissions for the Enterprise Grid.
  • List Channels. To list all Channels within the Enterprise/organization
  • List Users. To list all the users in the Enterprise/organization.
  • Delete Channel. To delete a channel in the Enterprise/organization. Needs Admin permissions for the Enterprise Grid.
Workspace InfoCreate Workspace
Snap ExecutionDrop-down list

Select one of the three following modes in which the Snap executes:

  • Validate & Execute. Performs limited execution of the Snap and generates a data preview during Pipeline validation, then performs full execution of the Snap (unlimited records) during Pipeline runtime.
  • Execute only. Performs full execution of the Snap during Pipeline execution without generating preview data.
  • Disabled. Disables the Snap and all Snaps downstream from it.

Execute onlyValidate & Execute

Troubleshooting

ErrorReasonResolution
Unable to list all the workspaces. missing_scope

The token corresponds to an individual (non-Enterprise Grid) installation and hence not authorized to perform this Admin operation.

OR

The token associated with your Snap account does not have the required Slack Scope assigned.

If the Snap account/token is related to an individual installation of Slack, you cannot perform this operation.

For Enterprise Grids, ensure that the token, and hence the account, have the required Slack Scope assigned as mentioned in the Prerequisites section of this document. 

You must re-install the Slack application for the new Scope assignments to take effect.

Examples

Extracting the List of non-Admin Users in the Workspace

This example demonstrates how we can use the Workspace Operations Snap to extract/prepare a list of users in the Workspace that do not have admin privileges.

Firstly, we select List Users as the Operation in Workspace Operations Snap. This Snap does not need any other input and generates the list of all users added to the Workspace.

Workspace Operations Snap
Output

Now, we connect a Filter Snap to extract only the users who do not have admin privileges using the Filter expression $is_admin == False. This Snap yields the following output.

Filter Snap
Output

With this information at hand, we now connect a Mapper Snap to the Filter Snap to extract the user details we want to populate for each non-Admin user. This example showcases three fields - $id as id, $real_name as Name, and the result of an expression $is_admin == true?"Admin user":"Not Admin user" as Admin? for each non-Admin user in the list. You can map and extract as many fields as available for each user record in the Filter Snap's output.

Mapper Snap

Output

To save the extracted data as a file, you can choose to format this data using any Formatter Snap and write the output into a file (JSON, CSV, and so on) using the File Writer.

Download this Pipeline

Downloads

Important Steps to Successfully Reuse Pipelines

  1. Download and import the Pipeline into SnapLogic.
  2. Configure Snap accounts as applicable.
  3. Provide Pipeline parameters as applicable.

  File Modified

File Slack_WorkspaceOperations_ListUsers_Example.slp

Oct 31, 2020 by Anand Vedam

Snap Pack History

 Click here to expand...

Release

Snap Pack Version 

Type

Updates

4.29main15993Stable

Enhanced the Slack - Send Message Snap with User Emails option for the Target Type dropdown list to send messages on Slack app using the user’s email.

4.28main14627

Stable

Upgraded with the latest SnapLogic Platform release.
4.27main12833StableUpgraded with the latest SnapLogic Platform release.
4.26main11181 LatestUpgraded with the latest SnapLogic Platform release.
4.25 Patch425patches10994Latest

Improved the error messages in the Channel Operations Snap where the Snap fails with Null Pointer Exception when the account reference provided is invalid.

4.25main9554StableNo updates made.
4.24main8556StableNo updates made.

4.23

main7430

Stable

Initial release of the Snap Pack with the following Snaps and Accounts:


See Also