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.
There is a template of the finished workflow which you can use by clicking here.
- 10 minutes
- An email address
- 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 in an email 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 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.
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 Email. Add a Send Email connector to your workflow.
Step 13. Add a recipient for the suggestions box emails and a subject line. Use the connector snake to select output of the Text Helper as your email content.
Step 14. Go to the form URL, fill in the form again, and submit it. You should receive an email with your suggestion! 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
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.