Open Navigation

Simple Workflow Tutorial

On This Page

This tutorial will guide you through building your very first workflow and introduce you to the basic concepts of working with tray. Along the way there will be links to articles where you can learn more about the steps we'll go through. If you get stuck there are ways for you to get more help here.

Requirements:

  • 10 minutes
  • A Slack account with admin permissions
  • A tray.io account (you can sign up here)

If you don't have a Slack account with admin permissions you can follow this tutorial instead. However, the email version skips an important lesson about how to authenticate workflows.

We're going to create a Suggestions Box. We'll build a web form that a user can fill in with their suggestions for how to improve the office. We'll then send those suggestions to a Slack channel to be reviewed.

Let's get started...

Set up the web form

Step 1. Create a new tray workflow. Give it any name you like the sound of.

Step 2. Select the Form Trigger. You can find more information about the Form Trigger here.

form-trigger

Step 3. Give your form a title and a description. Note that we use a leading "#" here because the Form Trigger supports markdown and we want to make this a title.

form-title-and-description

Step 4. Add a Short Text Input Field to the form to capture the user's email address. Give it a name (this is its ID that we will use to refer to the field), a label (this is the text that will appear on the form), and a description (this description will also appear on the form to clarify what the user should enter into the field).

enter-email-address

Step 5. Add a Multiline Text Input Field to the form to capture the user's suggestion.

enter-suggestion

Step 6. Select Show Advanced Settings.

show-advanced-settings

Then add a call to action and a thank you message to your form.

call-to-action

Step 7. Enable your workflow. We need to enable the workflow so that the form will work properly. Click the ENABLE button in the bottom right corner of the builder.

Step 8. Get the URL for your form. You can find it by clicking on the cog in the top left corner of the workflow editor.

get-public-url

Visit the URL in your browser to make sure that it looks right. Fill in the fields and click the submit button.

webform

Step 9. Check the Debug tab to see the output of your form in the logs. You will see the output of your form as JSON:

form-debug

Add the Text Helper to compose the message to Slack

Step 10. Next, we're going to create the message to send over slack. Add a Text Helper connector to your workflow. This is now a new "step" in your workflow. We'll use the Text Helper's concatenate function to join up the email and suggestions fields from the form.

add-text-helper

Use the Connector Snake to grab email and result from the form

Step 11. Use the connector snake to import the fields from the Form Trigger and add a text string in between them. This is one of the fundamentals of using Tray. Every step has access to all of the output from the steps that came before it - you just have to join up the output of one step with the input of the next.

You can do this first for the Email output field (click on the sequence of tabs to see the process in order):

snake-1

snake-2

snake-3

And then for the Suggestion field:

snake-1

snake-2

snake-3

Configure the Slack Connector

Step 12. Now that we've constructed our message we're going to send it via Slack. Add a Slack connector to your workflow.

add-slack-step

Step 13. You need to authenticate the Slack connector so that it can use your Slack account. Select the Slack connector and click Add Authentication.

slack-add-auth

This will guide you through the authentication process. You only need to grant permissions for the connector to post as a bot. Uncheck all of the other boxes.

slack-permissions

Step 14. Select the channel you wish to send your suggestions to. Use the connector snake to select the output of the Text Helper as our message.

snake-slack-text-helper

Step 15. Go to the form URL, fill in the form again, and submit it. You should now see a message appear in Slack! If you don't - have a look in the logs and see if you can find what the problem is.

thank-you

Was this article helpful?
Yes
No
On This Page