Connectors / Service / Slack

Slack brings all your communication together in one place. It's real-time messaging, archiving and search for modern teams. (updated: 1603207973353)

Slack

Slack is a cloud-based platform that brings all your collaboration and messaging tool needs together, for both individuals and companies.

Overview

Slack is a single tool for messaging and sharing components and files; where you can create channels, react to key events and potentially configure Slack specifically for your team’s unique needs or tech stack via the Slack API. Their directory has over 1500 integrable apps, and data protection expectations are key.

API INFO: The Base URL used for the Slack connector is https://slack.com/api. More information can be found on their main API documentation (v1.0) site. This is where users will also be able to find the API Limitations page.

Slack templates

Please note that we have the following Slack templates available:

These will give you pre-configured best practice ways of working with Slack and integrating it with other connectors.

However, please continue to at least read the Authentication and Trigger setup instructions on this page to enable you to get started with using Slack.

Authentication

Within the builder, click on the Slack connector to display the connector properties panel. Select the 'Authentication' tab and click on the 'New authentication' button.

In the Tray.io authentication pop-up modal name the authentication in a way that will easily identify it within a potentially large list. For example whether it is a Sandbox or Production auth, etc.

Consider who/ how many people will need access to this authentication when choosing where to create this authentication ('Personal' or 'Organisational').

You will be shown a pop up similar to what is displayed below.

Bear in mind that there are several options pre-selected for you, and numerous permissions available to choose from.

Depending on your usage, you may not need all or any of these permissions. What is being given here is the most commonly requested/ used.

Make sure you select or un-tick as necessary. If you are unsure of your own needs, use the pre-selected settings for now. You can always create a new authentication later if need be.

slack-auth2

After you have clicked 'Add authentication' you will get a secondary popup screen, where you will need to confirm your permissions settings and sign into your Slack account if you have not already done so:

slack-auth-popup

Once complete, your Tray.io authentication pop-up window, click the 'Create authentication' button.

Slack Trigger

If you wish your workflow to be kicked off by a particular action in Slack, you can use the Slack Trigger.

The Slack trigger allows you to receive notifications and trigger workflows when given events occur associated with the selected trigger operation.

Trigger Operations Available:

  • On action (button or menu click)

  • On Slack event

  • On slash command

Webhook Setup

Select the Slack trigger. This can be done either at the create new workflow stage or updated within the workflow builder itself.

Use the instructions above to authenticate your trigger, and select from the options available the event you want your trigger to listen to, in order to set off the workflow itself.

slack-trigger-options

Available Operations

The examples below show one or two of the available connector operations in use.

Please see the Full Operations Reference at the end of this page for details on all available operations for this connector.

Notes on using Slack

Reference schema

When creating a message for Slack to display there are a couple of characters that you may need to use in order to display your message correctly while using Tray.io's interpolation feature.

  • Links: Use triangular brackets <>

  • Names: Include the symbol @ and <> so that the name is linked as usual

  • Markdown formatting is also interpreted such as *bold*

slack-schema-demo

Pagination

Note that there is a limit of 1000 results per response.

See our Intermediate example below for an example walkthrough of how to deal with this limitation.

Example use cases

BEST PRACTICES: Whenever you do decide to create your own workflow, please make sure you take a look at our managing data best practices guide.

TRAY POTENTIAL: Tray.io is extremely flexible. By design there is no fixed way of working with it - you can pull whatever data you need from other services and work with it using our core and helper connectors. This demo which follows shows only one possible way of working with Tray.io and the Slack connector. Once you've finished working through this example please see our Introduction to working with data and jsonpaths page and Data Guide for more details.

Due to the number of possibilities within Slack, we have created two use case scenarios for the purposes of this tutorial. A beginners and an advanced example as demonstrated below.

  • Beginner: Send message

    • Here we demo the 'Send message' operation as it is one of our most popular use cases. Basically when a user joins a Slack channel they will automatically have a welcome message displayed.

  • Intermediate: Pagination

    • This workflow shows a simple setup for how to deal with cases that involve a lot of requests (and how to mitigate the Slack API limit).

  • Advanced: Slash command

    • This tutorial involves using the Airtable connector plus additional Slack application setup. This is a complicated use case which has been built to show users how to set up Slash commands within a more likely usage scenario.

Beginner: Send message

In this example we imagine a scenario whereupon whenever a new user joins a particular channel a welcome message will be displayed automatically. This is a good use case as it is a more public notification to the channel at large that a new "team member" has joined our group.

The steps will be as follows:

  • Set up the Slack trigger to react to a new user joining a channel.

  • Get the new user's details.

  • Respond with an automated message to the channel at large.

The completed workflows looks like this:

slack-beginner-result

Advanced: Slash command

This scenario utilises Slack's rather special "On slash command" query.

It will showcase the Slack trigger, Slack connector, and Airtable (a "spreadsheet-database hybrid" application) connector.

You will need the following pre-requisites in order to complete the example below:

  • You will need an Airtable account and authentication already setup before continuing.

    • Airtable has a very simple sign on procedure not to mention automatically comes with prebuilt dummy data. Joining shouldn't take up more than a couple of minutes of your time.

  • You will need to have administrative permissions to a Slack application

IMPORTANT!: Having a Slack application is NOT the same as having a Slack account/ channel.

In order to proceed with this demo you will need to have a Slack app ready to test with. Building a test app from the Slack API Docs page is really simple, especially if you already have a Slack account. Please see Step 1.1 for more details.

The steps will be as follows:

  • Set up the Slack trigger using the Slack app verification token.

  • Use text helper connector in order to obtain your user's unique ID.

  • Using the Slack connector and ID, glean said user's email address from their Slack profile.

  • Cross compare your email results with Airtable's database records.

  • Send said user an automated slack message based on the outcome of the comparison.

The completed workflow and results look like this:

slack-complete-wf
slack-result

All Operations

Latest version:

9.1

Add reminder

This method creates a reminder.

Archive conversation

Archive a conversation in your Slack account.

Conversation exists?

Checks to see whether a conversation exists in Slack.

Create conversation

Create a public or private channel-based conversation.

Create pin

Pin a message, file, or file comment to a channel.

Delete scheduled message

Delete a pending scheduled message from the queue.

Generate channel name

Given a piece of text (e.g. an Account name in Salesforce), generate a Slack friendly channel name in the format "my-channel-name". You can then pass this directly to the "Create Channel" operation.

Get conversation info

Retrieve information about a conversation.

Get user

Get details of a user in your Slack channel, using their unique ID.

Get user by email

Get a user by their email address.

Invite user to conversation

Invite a user to a conversation in your Slack account. The calling user must be a member of the channel.

Leave conversation

Remove yourself (the authenticated user) from a conversation.

List conversations

List of all channel-like conversations in a workspace.

List conversations DDL

List conversations non archived DDL

List filetypes DDL

List scheduled messages

Returns a list of pending scheduled messages.

List scheduled messages DDL

List users

Get a list of all of the users in your Slack team.

List users DDL

List users actual DDL

List users and conversations DDL

List users conversations

List conversations the calling user may access

Send ephemeral message

Send a message that only a certain user can see in a public or private channel.

Send ephemeral response

Send an ephemeral response message using the response_url parameter provided by Slack slash commands and actions. This will only be visible by the user.

Send message

Send a message to a user or channel.

Set conversation purpose

Set the purpose for a conversation. The calling user must be a member of the conversation. Not all conversation types may have a purpose set.

Set conversation topic

Set the topic for a conversation. The calling user must be a member of the conversation. Not all conversation types may have a purpose set.

Set profile

Set the user's presence and status.

Unfurl message links

Unfurl one or more links in a Slack message, adding "attachments" that contain additional context to the message.

Update message

Update a message that's previously been sent. Useful when reacting to actions like buttons and menus.

Upload file

Uploads or creates a file. Optionally share to users or channels. This operation requires a scope to be enabled in your authentication, either files:write (for new Slack apps) or files:write:user.