Artisan IMG > Slack (slack)

Slack
9.1

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

Overview
Copy

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 Information
Copy

The Slack connector has the following Base URL: https://slack.com/api. More information can be found on their main API documentation (v1) site. Details regarding their API limitations can be found here.

Slack templates
Copy

Please note that we have the following Slack templates available:

Artisan IMG > Slack (slack)
Send Slack alert on workflow failure
Workflow
Universal
Beginner

Sends a notification to a Slack channel each time a given workflow fails

Details
Artisan IMG > Slack (slack)
Slack keyword alert
Workflow
Security
Intermediate

Monitors Slack channel messages for specific keywords and alerts a dedicated channel

Details
Artisan IMG > Salesforce (salesforce)
Artisan IMG > Slack (slack)
Notify Slack when Salesforce opp is "Closed Won"
Workflow
Sales
Beginner

Sends a celebratory Slack notification to a chosen channel when an opportunity is successfully closed in Salesforce

Details
Artisan IMG > BambooHR (bamboohr)
Artisan IMG > Slack (slack)
Artisan IMG > Greenhouse (greenhouse)
Create new hire in Bamboo when 'hired' in Greenhouse
Workflow
HR
Intermediate

Set up new hires in Bamboo when marked as 'hired' in Greenhouse, and alert the team on Slack

Details
Artisan IMG > G Suite (g-suite)
Artisan IMG > Slack (slack)
Create Google Account
Workflow
HR
Intermediate

Automatically creates a G-Suite account for new hires

Details
Artisan IMG > Slack (slack)
Artisan IMG > Salesforce (salesforce)
Create Salesforce accts / opps with Slack modal
Workflow
Sales
Intermediate

Presents users with a referral form in Slack to create a new account / opportunity in Salesforce

Details
Artisan IMG > Zendesk (zendesk)
Artisan IMG > Slack (slack)
Notify Slack with Zendesk ticket info
Workflow
Sales
Intermediate

When a Zendesk ticket is created or updated, send appropriate info to Slack

Details

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
Copy

Within the builder, click on the Slack connector to display the connector properties panel. Select the 'Auth' tab and click 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').

The next page asks you for 'Slash command signing secret'.

Slash command signing secret is an optional field but is required when working with Slash commands. 

You can skip adding the value for this field in your auth if you will not work with slash commands.

To get value for this field, go to the Slack api page and click the 'Your apps' tab from the top right corner.

On the next page, select your app from the available list.

You will be redirected to the 'Basic Information' page of your App. On this page, scroll down to the 'App Credentials' section. Here you will get value for the Signing Secret.

The next step is to select permissions.

There is a list of permissions that you can select based on your usage. You may need all or a few of these permissions.

For your convenience, basic permissions are already selected. Feel free to check or un-check the permissions based on your use case.

If unsure about the required permissions, you can always start with the pre-selected settings.

Once you select the permissions, click the 'Create authentication' button.

You will be redirected to a popup screen, where you will be asked to confirm the access you are granting to Tray.io. Once you have reviewed the permissions, click the 'Allow' button.

Your connector authentication setup should now be complete.

Slack Trigger
Copy

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:
Copy

  • On action (button or menu click)

  • On Slack event

  • On slash command

Webhook Setup
Copy

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.

Available Operations
Copy

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
Copy

Reference schema
Copy

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*

Pagination
Copy

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

Building Apps for Slack
Copy

For certain purposes (such as creating slash commands) you will need to create a Slack app by following the steps below:

You have successfully created your Slack app, which is ready to use.

Creating a slash command
Copy

Slash commands act as shortcuts for specific actions in Slack. There are three types of slash commands that you may be able to use in your workspace:

  • Built-in slash commands: created by Slack

  • App slash commands: created by developers

  • Customised slash commands: created by members of your organisation

In this section we are going to learn how to create App slash commands. You can create slash commands by following the steps below:

Before you start creating your Slash command, make sure you have your Slack App in place. If you don't already have a Slack App, refer to our Building Apps for Slack section above.

While working with Slash command make sure you have added Slash command signing secret to your Slack authentication.

Refer to the Authentication section for more details.

Slack Block Kit
Copy

Slack Block Kit is a UI framework for designing Slack app components like modal, message format, etc.

Block kit uses visual components like "blocks" that can be stacked and arranged to create application layouts.

Building an app using blocks automatically generates a JSON object which you can copy and paste into your connector. 

Before you start working with Slack Block Kit, make sure you have your Slack App in place. If you don't already have a Slack App, refer to our Building Apps for Slack section above.

The Modal generated using Slack Block Kit can be used in various ways. If you wish to simply share certain information over Slack using the modals, you can use the Slack connector.

If you wish to work with interactive modals that allow users to respond, you need to use an HTTP client connector instead of the Slack connector.

For example, if you wish to open a modal in Slack when a /survey command is triggered, then you need to run POST https://slack.com/api/views.open using the HTTP client connector with the following information:

  • URL: https://slack.com/api/views.open

  • Header:

    • Key: Content-Type

    • Value: application/json; charset=utf-8

  • Body Type: raw

    • raw: paste the JSON object for your modal here.

For a better understanding of working with modals using the HTTP client connector refer our detailed template example.

You can create a modal by following the steps below:

Best Practice: Add a WF URL
Copy

It is a good practice to add a link to the Workflow URL so that users will know from where the bot/ automated message came from.

This is a great way to troubleshoot quickly as an organisation may have multiple workflows involving Slack Connector automations.

We recommend adding the URL using the $.env.execution_log_url jsonpath and adding it to the Footer section in the properties panel.

So your final Footer would be: <{$.env.execution_log_url}|Sent via tray.io>

When doing this make sure you do not add or reveal any workflow URLs which could contain sensitive information.

Example use cases
Copy

BEST PRACTICES: Whenever you do decide to create your own workflow, be sure to check out some of our key articles such as:

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.

  • 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
Copy

This example demonstrates a workflow that is triggered whenever a new user joins a particular channel. A welcome message will then 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:

Advanced: Slash command
Copy

Slash Commands allow users to invoke their app by typing a string into the message box. A submitted command will cause a payload of data to be sent from Slack to the associated app. The app will then respond using the context provided by that payload.

This workflow is triggered by a /contact-details <slack-user-name> slash command. Where the <slack-user-name> is the name of a slack user whose contacts are to be fetched from a database.

To fetch these contact details from a database the workflow uses the unique ID/ Name of a Slack user which is received through the trigger.

Based on if the contact details were found or not an appropriate message is then sent to the user (the one who initiated the Slash command).

Results:
Copy

Prerequisites:
Copy

Before you start working on the example below make sure:

Completed workflow:
Copy

Slack Operations

Latest version:
9.1