Get started with tray.io in 10 minutes
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.
- 10 minutes
- A Slack account with admin permissions
- A tray.io account (you can sign up here)
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...
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.
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.
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).
Step 5. Add a Multiline Text Input Field to the form to capture the user's suggestion.
Step 6. Select Show Advanced Settings. Then add a call to action and a thank you message to your form.
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. Visit the URL in your browser to make sure that it looks right. Fill in the fields and click the submit button.
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. Note that the video below shows the new user interface which includes the new "Debug" tab that doesn't appear in other videos.
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.
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.
Step 12. Now that we've constructed our message we're going to send it via Slack. Add a Slack connector to your workflow.
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. 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.
Step 14. Select the channel you wish to send your suggestions to. (You might want to use your own since this is a tutorial). Use the connector snake to select the output of the Text Helper as our message.
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.
That's it! You've now built your first tray workflow and you're on your way to becoming a Master Builder.
You've done all of the most important steps involved in building a workflow. Here are some suggestions for what to try next:
- Use the Boolean Condition connector to ignore all messages from certain email addresses
- Add another Slack Connector and to send a confirmation slack message to whoever submitted the suggestion (Add a third Slack Connector and use the "Get user by email" Operation to get a slack user based on the email address they add to the form)
- Use the Email Connector to send a confirmation email about the suggestion
If you'd like more information then please get in touch. Hit the chat button to the top right of the builder or the intercom widget in the bottom right of your screen to say hello. We'd love to hear from you. We're nice humans.