In our previous lesson we created a schedule to send an email reminder to buy potatoes every X amount of time. It was a simple reminder that you receive daily with the same message, same content, same time, it is a static flow. That is fine if that is only what you need, but the world of automation has much more to offer .
In this lesson, you will find out the importance of passing data and how it looks like, you will also learn the importance of testing steps in Activepieces.
Why is passing data important?
Passing data helps you customize your flows to be more dynamic, the simple reminder in our previous lesson is static because it does not utilize data, nothing changes in the variables of the trigger nor in the action we used, so by passing down messages (data), we can make the email sent much more fun by sending a different message daily along with the daily reminders! And we will apply this scenario.
What is passing data?
Passing data is simply using data from previous steps in the current one. Your previous step could be an action, or a trigger. An action can access data from all parents’ steps that are passing data, here is a chart representing this concept.
The following screenshot is an example of a Flow in Activepieces that includes data being passed down to children’s steps.
• The trigger “Every Day” does not produce data.
• Then the “Ask ChatGPT” action produces data.
• Then the “Send Email” action receives data from the previous action and sends it as an email.
Testing Steps to Generate Data
In Activepieces it is required to test steps before accessing their data. This protects you from selecting the wrong data and breaking your flows after publishing them.
Some steps do not produce data and other steps you simply don’t want to use their passed down data, so you don’t need to test in these cases.
Scenario
We want to create a flow that reminds us to buy groceries every X amount of time, and with the reminder we want to send a heartwarming email that is generated and passed by ChatGPT.
Let’s Build the First Dynamic Flow
To build the flow that sends a dynamic email reminder, we will need to do the following:
- We will begin by adding a schedule that is scheduled to run every X amount of time, this acts as the trigger of the flow.
- Then we will add a step that generates text based on a prompt, we will be using the “ChatGPT” action by the “OpenAI” piece, this step will generate data and pass it down the flow.
- Then we will have to add a step that sends an email and receive data from the previous step and use it. We will be using the Gmail piece to send the reminder from.
- We will also need to configure the options and data of the trigger and actions according to our needs.
Follow the steps below to create your first dynamic flow that sends a heartwarming email as a reminder to buy potatoes daily.
Results of Testing & Key Takeaways
After testing, here are screenshots of what the emails look like whenever we test them.
1st test
2nd test
3rd test
4th test
Remember:
- Loading your sample data is an important step to make sure your data is passed down to the next steps correctly.
- Each step passes down the output to the next step, but only after testing.
- Using passed down data helps us create more dynamic flows specifically crafted to our needs.
- Testing your whole flow is a good way for you to see your fit, notice that the after a couple of tests “You are” was added.
Next up: Navigate Activepieces dashboard
In the next lesson, we will take a look at Activepieces’s dashboard and explore all the features in it.