How do I post data back into a Retool App?

I am trying to work with Zapier to return data back into my retool app, but not sure how to handle the return post.

I am working with an online application that only connects via Zapier. Through Zapier, I can get data for a file and I want to display this data back in retool.

The workflow looks like this - I have an "ID" field that the user will fill in and then a "Get Data" button.

When clicked, the get data button will post to a zapier webhook and it will pass the ID.

This first part is working with no issues, posting to a webhook URL via a retool query is straight forward.

In zapier, here is what my flow looks like:

Step 1. Catch Webhook works with no issues

In Step 2, I use the ID that was passed to retrieve the specific data that I want.

Now in Step 3, my goal is to push this data back to the retool app for the user to see. The fields returned will be mapped to retool fields and the user can essentially get and view the data from this app.

I am stuck on step 3, how do I post data back to the retool app? When calling the original webhook to start this flow, I get the success response that the webhook was posted to zapier, but of course I don't get the file data as this occurs in a later step.

I was thinking to somehow fire another webhook from Zapier to Retool with the loan data as the payload, but not sure how I would catch that and display the results in my app.

Any ideas on a simple solution here?

Please note - the app in the middle can only be accessed through Zapier, so that is why I am going through Zapier to get this data. There is no public/open API at the moment.

Thanks!

2 Likes

Hi rmerchant. What you want is kind of like treating zapier as a api get request, you send it an id and you get back data. But that's not really what a webhook is meant to do. Usually webhook just returns like "success", so you know it got called. Maybe zapier would allow you to trigger a event to call retool back, but based on this: Trigger App Query from Webhook, Cont'd you could use that to trigger a workflow, but not really to do anything in the app. As the user in that app mentioned, you could use the workflow to update some data and in your app keep checking on updates to that data. Sorry I don't have any better ideas.

A Retool App doesn't really store data in itself. It accesses data from databases / various third-party tools / Retool DB and then show it through the app. So, if I understand your situation correctly, this is more of a data storage issue vs webhook issue, I think.

Two solutions that I can think of off the top of my head (so not fully thought out really):

  • If you have a database / platform that can receive webhooks and store data (e.g., Postgres?), I would POST the data there and then access that through the Retool App.
    • Zapier has a native integration with Airtable I think and that could also work.
  • If you don't want to go through another platform, you could receive webhooks via a Retool Workflow then have that Workflow add it to a Retool Database. Then you can access that Retool Database in a Retool App and show that data there.
    • This solution isn't great if you have a high volume of data coming through cause Retool DB gets rate limited at 1000 queries per minute. Which is decent but not very scalable.

Hope this helps! If anyone out there has a better solution, would also love to hear it cause this is also something my team is sometimes doing and would love to hear a more efficient method. :sweat_smile:

3 Likes

Depending on your use case and size of the data coming back, you could retrieve it into a variable, have the user play around with that variable, and then send any changes back…or just have the user admire the data…or admire the data and download it? I guess I’m not super clear on what you want to do with the data once it’s “in” the Retool app. Saving it to a variable is definitely not resilient as you are not persisting the data anywhere so changes could get lost etc., but it seems like maybe you are just trying to present the data?

Hi John,

If only admiring was the only task needed. That would make things easier

The goal is for the user to review the incoming data and validate if it is correct or not. If not, they will have to go into the system of record and update it and pull the data down into retool again, or they can correct it on the spot in retool. There will be many variables to temporarily hold the data, and the goal here is to push to data into a different system (our primary loan origination system.)

The first system is used to collect loan applications from customers and the data must be pushed to our loan origination system. There is no direct integration between the two systems and Retool lives in the middle for us to give the user a cleaner and easier way to process and post the data where it belongs.

If the user corrects the temporary data in retool, we understand that the originating source system will have old/incorrect data, but we are ok with this as the system is not referenced further past the point of collecting the initial application data.

Moving forward, our loan origination system is where the data will persist and we also have the ability to read/write via API so we have already set up the ability to modify records from that system in retool.

I hope that makes sense.

In summary, system 1 has the initial loan application data. This will be pulled into Retool temporarily (and this is where I am stuck) and the user can review and update if needed. From there, once validated, the user will post the data to our loan origination system (system 2) and the loan will continue its lifecycle from there moving forward.

Understood, I am in alignment with the purpose of the webhook. We don't intend to create a database to hold this data coming back as all we have to do is validate/correct and post it to our loan origination system, which effectively serves as the database moving forward.

I thought about workflows but I couldn't figure out how to update fields in a retool app using a workflow in real time. I guess that is not supported at this time as far as I can tell.

Thank you for the input!

Hi Audrey,

This is helpful, thank you!

We don't intend to store the data long term, we just wanted the user to validate the data and then we can update and post the corrected data to our loan origination system, which is effectively the system of record or database for our loan data.

I have used Airtable in the past so I am thinking of using that or Retool databases to temporarily store and retrieve the data. The volume is very low so that shouldn't be a limiting factor thankfully.

I will have to give that a look, is there a way to post the data into a Retool Database directly from Zapier? Perhaps an API for retool itself? I haven't looked into that so forgive me if it is documented. I will check out that option now, thanks for sharing your thoughts!

In that case, I would have the user enter the ID, get the data from system 1 with the a REST query, and either (a) transform the REST query data with a transformer before triggering a Retool DB query (INSERT) on success, or (b) leave the rest data as is and triggering a JS query on success to do the modification and call the insert.

On successful insert, I’d call a retrieval query and use that data in a form or table where users can interact with it (you will need to setup an update query to save the changes back to the Retool DB).

Finally, I’d setup another REST query to post the data to system 2. Probably I’d setup a JS query that would await the POST, and then add whatever confirmation I get back to a field in the Retool DB table. Or I suppose I could call a Retool DB query to delete the record if you really don’t want to keep it.

Should all be pretty straightforward as long as you can map the initial REST query data. Let us know how it goes or if you are unclear about any particular step. Happy building!

There is Retool API in Settings > API. However, I haven't tried that myself so not sure how to set it up.

As an alternative though, since the use case here is for user validation / approval, I think you might benefit from the User Tasks feature of Retool Workflows. It is still in private beta but my company signed up and we've used it quite successfully in our systems. You can also sign-up here: Early Access: Add user-driven steps, tasks, and approvals to automations in Retool

Might be a more complicated solution but this sounds like a great use case for the user task feature.

1 Like

Thanks for reaching out, @rmerchant! And welcome back to the community. This topic has spawned a bunch of cool dialogue and has hopefully given you some leads to follow.

It sounds like creating a workflow to handle the approval process is probably the way to go. You can trigger the workflow directly from Zapier and send along the entire loan payload. You aren't able to directly manipulate an application from within the workflow, but you can do a whole bunch of other things! That includes persisting data to a temporary database or even pausing the executing of the workflow while waiting for a specific user action, to @audreyanne96's point. It's a great suggestion and exactly the kind of thing that feature was built for. :+1:

Let me know if you have any additional questions about the theory or execution!

2 Likes