As the title says: I have retool populating a table of data from our backend database, and I'd like to push to a separate CRM via API each time a new row of data appears into the table (not from adding the data within retool, but it's being added via another source into our database and then showing up in the Retool table - I'm not trying to edit anything in our backend database). Currently I have the API linked and I can send data from the table, but I can't quite figure out how to trigger it based on a new row of data appearing.
Happy to help you out here! To confirm, you're wanting to know when a table of yours changes in size, right? It's going to be tough but you'll want to periodically test it's length, I suppose. Am I understanding your issue here correctly?
I have a similar requirement.
My PostGre is updated from services outside of Retool (resource query: channelUpdate).
I also have an update api for slack which sends a specific row from channelUpdate to a Slack Channel(resource query:updateSlackChannel).
Whenever there is an update on my channelUpdate query (new row with a is_active flag =Y), I want to trigger the updateSlackChannel query for that row.
We are creating an app that shows our leads from our website. We would like Retool to send an update when there's a new lead. This update should reflect to our Slack channel. Can you help me with this?
Similar to what I mentioned in the post above some context about how exactly you're creating leads would help here
If you haven't already, you might want to check out Retool's Workflows product in case you're generating leads from outside Retool as OP mentioned. That allows you to trigger processes via webhooks that you can call from wherever your leads are being generated, you can also set them up to run periodically to monitor for changes in your DB.
Where is the row passed to channelUpdate being pulled from?
/It should pullout from the query we've setup in retool. Here's our flow
From our website, we created a query that shows all of our leads. What we need now is for those newly added leads, we should be notified via Slack.
Can you share some links that would redirect me to the workflow you're referring to?
Hi @Kabirdas - Thank you for this. I think workflow is still in beta mode.
Thanks for informing me, I've joined the BETA waitlist.
To distinguish that they are new, we'll have to base it on "created at column"
SELECT * FROM leads WHERE created_at > CURRENT_DATE - INTERVAL '1 day';
That should grab all leads created in the past day and you can change the interval to something like '2 days' or '2 hours' if you prefer. From there, you can trigger a query with a success handler that actually makes the necessary posts. This can be either a query that posts all of the leads together at once in a single slack message or something like one of the examples here that triggers your slack query multiple times for each new lead.
There's more documentation on reading from SQL here that might help understand how you can work with your SQL data. We also have documentation here on how to set up a Slack integration.
Let me know what new questions that raises! Also curious to see how you end up building it out