Workflows Tutorial: Triggers, Logic Blocks & Automation
Workflows let you automate your workflows, connect to dozens of databases, third-party services and APIs, and ship it all in a single click. You can build automated reports, inventory alerts, cart recovery emails, Slack bots, and so much more – all on Retool’s interactive canvas. Ready to get started? The latest video from our Developer Advocate Angelik Laboy Torres will run through the basics and guide you step by step towards your first automation. You’ll get a close-up look at our IDE, add logic blocks, set triggers, and create end-to-end sequences that connect to your data and run on schedules or WebHooks. By the end of this video, you’ll leave with the knowledge you need to create your first workflow and publish it for use across your apps. Give it a watch below, and let us know what else you want to see from the Retool team!
Transcript
Hi, my name is Angelik Laboy Torres, I'm a Developer Advocate here at Retool and today we'll get started with building workflows. Many times we have repeated or background processes like publishing content, handling onboarding of our teammates, or doing customer requests, tasks that happen regularly in the same order. A workflow is simply a series of steps that happen the same way from start to end. It's like a checklist that delivers consistent outcomes every single time. Now, Retool Workflows allows you to build complex automation that interacts with any data source, transforms data, uses AI, or is able to do what it help triggers as well as custom scheduling. Okay, so what we have right here is our Retool space. And if we go into the Navigation Bar, you can see Workflows up in there. So we'll click on it. And this is where all of your organization's workflows will assist. The best thing is that you can duplicate or reuse them across other apps as you build them in your organization space. Now let's go and click on create new and then click on Workflows. This is now going to open up our workflow IDE, which is a visual canvas to build automations. And it has four main stages. Firstly, of the canvas, which is where you would arrange your blogs in order to build your workflows. Then you have the left panel. And as you can see, there's many different tabs in here. Some of them include blocks, triggers, as well as configuration options. From there, you also have the toolbar, which is where you can rename your workflow. You can either run them or publish them, do different versions of them as well. And then lastly, you have the status bar, which is where you would do the version control of your environments, whether you want to work on staging or production. It's really cool. You can even add more. You can You can also see the version and then how many times this workflow has run and what were the results of them. Cool. So let's close this over here. Now, one thing about Workflows is that they always start with a start trigger. And this is actually going to define how your workflow runs. So you can notice here actually from this interaction, how blocks are connected to one another. There is support and you can drag from there to create another block in order to create the next step of your automation sequence. Now, let's go back to the left panel over here. And let's start talking about the essential tabs that you can see in order to configure your workflow. So in the plus icon, you have all the blocks available to you. We'll cover them in a second. So you can add them into your canvas, right? The same way that you can vote an agent, et cetera, et cetera. From there, you have the outline, which is allowing you to see all the different blocks in your workflow. This is particularly helpful as you start creating huge connections to one another and you have a lot of branches and you just kind of want to see like a drop down of everything in the canvas itself. Then you have functions, which allow you to create reusable logic that can be called by other blocks. Then you have triggers. This can be there to configure a webhook or schedule it at a very specific time. Then you have, well, the code search, right? Searching anything particularly. Then you have libraries, and this is where you can import any custom JavaScript or Python libraries. Right? Then you have the different releases, which I mean, and you know what releases are, as well as the setting, which allow you to either deploy or configure your environment. So now that we have a better understanding of what our workflow IDE looks like, then let's start building our first automation. So let's build a simple automated email workflow. So for that reason, I've started off like cleaning up all this canvas and I've deleted the default code. And from there in the start trigger, I'm actually going to pull from the port and add a resource query. If you're actually questioning what this is, we covered it in the last few videos of the getting started. So just go and check out that playlist. Now from there, I'm going to click on Retool database. And the reason being is that I already have this table over here that has like 11 users that in contain information like first name, last name, company, email, I'm just going to use that in order to send out this weekly update that I want to do. So from there, I actually just going to make sure that it runs and like all this is fine. I'm going to do select all posts, all from top users as the name of it. Their email is not NULL and this actually needs to be in quotation because otherwise it won't detect it. There we go. And click on the play button and then wow you have a preview of your data. Now I just, I don't want all the information so I'm going to do first name, last name, I'm going to do email and I'm going to do company. Awesome. and I'm gonna rename this get users. That works for me. Click on the play. We have this array now. Awesome. So what I wanna do now is actually start adding some other logic to this workbook. If I pull from the port, you can see all the other blocks that are accessible to you. So I'll give you a little bit of a breakdown here. First you have the research query, which allow you to connect to your resources and any sort of like query information. stuff that we've been working on in our app IDE. So if I go back here, actually, you can set up your resources by clicking on the resources tab and then from there create new and click on resources and you have I mean, so many of them. Yeah, Google Sheets, GraphQL, MongoDB, Firebase, Retool Storage, I don't know, like OpenAI, OpenAPI, RestAPI, so many, right? Even like Notion. So once you set this up one time, you don't need to do them all the time. And that is what this is for. Then you have code. So this could be like anything like adding a JavaScript or Python. I will make a note here, but you could because it's really helpful for so many people. You can add a block of code whenever you want. Like you don't have to like use any of these blocks if you don't want like go code it. I think it's no problem. In the same way that like in the libraries, you can also add any sort of like custom libraries like from NPM. Keep that in mind. Then you have workflows which allow you to connect to other workflows. Pretty meta. Then you have the AI actions. And to show you a little bit of this, this is the Retool AI. And here you can generate like so many different types of actions from there. You have stuff like generate tags, summarize tags, classified tags, generate image, track entity from an image. You also have all these different types of models, all these different types of versions, as well as controlling the temperature, even adding a Retool vector. Okay, so close this down. And then let's move on into the next one, which is invoking Agents. The agents that you have generated over here, let me go and show you the agents tab. You can actually access them inside of your workflow. So you'll click over here, and whatever agent you have you can click on in the habit run and like execute as actions. I'll close this down and then I'll cover now a little bit of the other ones that you see over here you have filters filter out any sort of values brand child you know brand child into different areas loops specific logic or add a delay to your workflow which would be wait. The last one actually is response which allows you to return a response within your workflow. This could be helpful, especially when you're having your workflows be used inside an app and like see like if there's any like errors that are happening in the back end, you can receive a blog of them. And yeah, this is pretty helpful when it comes to what hooks. So I'm going to be adding a loop. And from there, you can actually see that because it was already attached to the previous block, it already knows that this is the one that is going to be using the information from hence the sequence, right? If there are any sort of branches created, then you can start selecting which one you want specifically that's looked to run from. Now, in terms of execution modes, you have parallel, which runs all at the same time. It's more for speed. You also have sequential, which allows you to do one at a time, as well as batch, like batching by group sizes. And then also have a delay between these groups. Now, I wanna do parallel. And what I want to do is actually select a Retool email inside of it. I'm going to call this email schedule. Cool. And I mean, you know what an email composition looks like. So let's do value.email. There you go. This information is all coming from this array over here, which is pretty awesome. The, this is called weekly update. And I'm going to say hi value first name. (upbeat music) value last name. - You are 24, value of 20. (laughing) - We have received some. We have received some news. - Leave it at that. And then I can include a signature. I'm just gonna uncheck this, do an attachment or even add a reply to, or even like CC, whatever you want. It's just a normal EVA, right? So what I actually wanna check before, or I want to show you before I actually click on the play button, is that when you refresh, if this block hasn't been executed, then this one is going to give you an error. There you go. So you always have to, like if you're testing them out, you have to do the previous one before you continue with the sequential block. Just the stuff when you're doing trial and error, I see a lot of people like mis-stepping on this. Cool. Oh, I'm having some issues here. Value. Donate email. Cool. It wasn't capitalized from this. Amazing. Let's see if this works 'cause I put myself there. Voila. There you have it. I have my name, my last name as well as the company and obviously the email because I received it. So that is how the looping area works. I do want to set up now a trigger. So let's go over here in the left panel, and then from there you can click on the lightning. And right now we have it set it up as a webhook. I don't want that, let's do a scheduling. So I mean, the same old does click over here. And let's do like once a week, let's do UTC on Monday and at nine AM. Cool, awesome. And you can even select like which environments that come in from. For dope, I'll save this. And then also another way to access this would be on the start trigger. You can click on edit trigger and then you can enable with risk through a Webhook or a custom schedule. I guess something to keep in mind is that when we're dealing with more advanced event driven processes, Retool also supports Kafka and Amazon SQS in terms of integration's workflow triggers. This allows you to pull messages from existing message queues and automatically trigger workflows that run when message are received, which is really perfect for real time event processing without maintaining separate infrastructure. Now that this is all done, let's actually just like run this. Let's click over here. And then it would open up a log window there you can actually see how long it takes. This is important, especially with that the loop that you have running if you're running them parallel. Obviously, we're talking about scale right now is only 11 users, but keep that in mind. We got the green. Oh, you can even see more information like the JSON input data and everything close this. And I'm going to keep click publish and I'm going to do a major version release. And it's something really important, even though it auto saves in the canvas itself, if I were to make a modification, like adding, I don't know, block of code or something like that and have this executed and then do a response and then this be okay, like this be fine, cool, save in, all good. You have to republish it again and you can do this whether it is as a major, minor, or patch and that is because when you're using them the app, it would only have the last official release, not whatever has been worked on on the canvas. So really important to keep that in mind. And so that brings us to the end of our video. Thank you so much for watching. This was really interesting. Just getting to teach you about like a walkthrough of the workflow. In the next few videos, we're going to be covering more about, you know, forms and inputs. And I really want to challenge you to go into our community forums and actually just create a fun workflow. Like send it over to me tag me I want to see what you create and so uh thank you so much this was really fun and I'll see you next time!To view or add a comment, sign in