The Slack connector allows you to communicate with your Slack account using the Tray workflow builder. You can send messages, create channels, and react to key events that happen in your Slack account (e.g. when a channel is created).
|Archive channel||Archive a channel in your Slack account.|
|Channel exists?||Checks to see whether a channel exists in Slack.|
|Create channel||Create a channel in your Slack account.|
|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 channel||Gets a public or private channel or group (private channel), using the name of the channel, e.g. "#general".|
|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 channel||Invite a user to a channel in your Slack account.|
|Leave Channel||Remove yourself (the authenticated user) from a channel.|
|Leave Group||Remove yourself (the authenticated user) from a group.|
|List channels||List all of the Slack channels in your Slack team.|
|List groups||List all of the Slack groups in your Slack team.|
|List users||Get a list of all of the users in your Slack team.|
|Send Message||Send a message to a user or channel|
|Set Channel Purpose||Add a purpose to a Slack channel.|
|Set Channel Topic||Set the topic for a channel.|
|Set Group Purpose||Add a purpose to a Slack group.|
|Set Group Topic||Set the topic for a channel.|
|Update Message||Update a message that's previously been sent. Useful when reacting to actions like buttons and menus.|
|On Slack event||When a specific event (e.g. a channel is created) occurs in your Slack account, automatically trigger the Tray workflow. NOTE: you can only tell us to listen for events that you have given Tray permission to listen for.|
|On action (button or menu click)||Receive notifications when your message buttons or menus are acted upon in Slack. NOTE: you'll need to point the message attachments to this workflow in the workflow where you're sending the original message.|
|On slash command||Trigger a workflow from a Slash command in your Slack account. Tip: read the docs on this to learn how to set things up with Slash commands.|
Setting up your private Slack app
If you'd like to trigger Tray workflows from Slash commands, or use workflows to unfurl links (coming soon!), then you'll need to set up your own private Slack app for your team. This app is entirely separate from the Tray app, and will be entirely private to your organization.
1) Go to https://api.slack.com/apps
2) Click Create New App in the top-right of the page
3) Specify your new app details, choosing the Slack team you use at your company. Then click Create App.
Slash command trigger
Note: you'll need to set up an internal Slack app for your team (above) before you can start using slash commands.
Slash commands are a great way of triggering Tray workflows, without you ever having to leave Slack. You can set up any Slash command you like, and workflows will be triggered in real-time when you type the command in your Slack account.
The possibilities are endless, but here's a few exciting ideas:
- List all open opportunities in Salesforce
- Create a task for yourself in Asana
- Send an email to a customer via your Gmail account
As an example, we'll use the first one - listing all open opportunities in Salesforce. We want to set up a Slash command called /open_opportunities.
1) First things first, create a new workflow in Tray, using the Slack trigger. Choose the On slash command operation and enable the workflow.
2) Visit your internal Slack app at https://api.slack.com/apps
3) Click Basic Information, and copy the Verification Token into the trigger connector settings. (This is how you keep things secure)
4) Open up your app, and click Slash Commands
5) Click Create New Command
6) Enter the full details of the slash command, as you'd like it to appear in Slack. In this example, we don't need a usage hint.
7) Type /open_opportunities in Slack and press enter - you should see a message appear in your Slack.
8) You'll see in the workflow logs the trigger data from Slack. With a bit of workflow building, you can adapt this workflow to do something useful, for example:
The Slack connector has full support for Interactive messages, which allow you to build Tray workflows for things like:
- Approvals workflows
- Getting feedback from users
Interactive messages can be created as part of the standard Send message operation in the Slack connector. This works by using a different workflow to receive the interactions, and act accordingly.
Here's a quick example:
1) Create a workflow with the Slack trigger. Select the On action (menu or button click) operation. Enable the workflow.
2) Create another workflow in a new tab with a manual trigger, and a Slack connector with the Send message operation selected.
3) Add some actions inside of a message attachment, and select the first workflow you created to handle the interactions.
4) Send the message with the second workflow manual trigger. You should see the buttons show in Slack.
5) Try clicking one of the actions. You should see a spinner for a short period of time, but nothing else should happen. Then visit your workflow logs (the first workflow), and you'll see a new trigger, with the interaction details.
The details of the interaction can be found inside the action key in the data sent to the workflow. You can use this to react accordingly in your Slack trigger workflow!
Tip: it's also possible to pass any kind of data you like from the workflow that originally sends the Slack message, to the Slack triggered workflow. There is an Actions Data field that allows you to do this. Typically you'll want to pass something like a unique ID or number along.
Events API trigger
The Tray Slack trigger connector allows you to react to key events that happen in your Slack account, including:
- Channel creations
- New team members
- Message reactions
A full list of available events can be found in the Slack docs.
Tip: different events require different permissions for Slack to send them to your workflow. An error will be shown if you initialize your workflow and the required permissions haven't been provided. In this case - you'll need to re-authenticate Slack with the relevant permissions.
To give an example, let's build a workflow that is triggered when a reaction is added to a message. If the reaction is the :rage: emoji, let's send a message encouraging more positive reactions.
1) Create a new workflow in the Tray dashboard, and add the Slack trigger with the On Slack event operation.
2) You may need to re-authenticate your Slack account. Make sure you tick the Reactions:read permission when authenticating.
3) Start the workflow, and wait for it to show Saved & enabled in the bottom left of the screen.
4) Go and react with an emoji to any message in your Slack account. You'll notice that the workflow is triggered the details of the reaction.
5) (Optional) With a bit of workflow building, set up a boolean condition to message back into the channel when the :rage: reaction is added.
Note: you'll need to set up an internal Slack app for your team (above) before you can start using link unfurls.
You can use Tray.io to automatically unfurl links in your Slack team. You can unfurl links from up to 5 different domains. Every time a link is shared in your team, Slack will trigger one of your workflows. You can then use this trigger to update the Slack message, adding in the link unfurl.
1) Create a workflow, and pick the "On link share" operation.
2) Enable your workflow.
3) Open your Slack app, and click "Add features and functionality" > "Event Subscriptions"
4) Enable Events, and then add the URL of your workflow into the "Request URL" field. The URL will validate automatically, and you should see a "Verified" tick. (If you don't see this, make sure you've enabled your workflow)
5) Add the "link_shared" event as the event you'd like to listen for, then save your changes.
6) Go to to the "OAuth & Permissions" page and ensure that you have the the "links:read" permission added to your app.
7) Re-install your app to your team.
8) Now you can add a second Slack connector to your workflow, to unfurl the link. You'll need to pass the following to to the "Unfurl links" operation:
- Message ID
- Channel ID
- URL to unfurl
- Attachment to add to append to the message
REQUEST FREE TRIAL
Share A Little Information To Request Free Trial