Workflow - AI Summary from PostgreSQL Query

Hi @pod2! Thanks for reaching out. This sounds like a perfectly reasonable workflow. :slightly_smiling_face:

Here's a quick example I put together:

At a high level, this workflow fetches user data from the database and then generates a very nice compliment for each of them. One of the keys to effectively using a Loop block is understanding that each element in the input array is exposed through the value variable. Similarly, the index is exposed through the index variable. In the last block, we take advantage of this to associate each user's email with their AI-generated compliment.

If I understand correctly, you want to parameterize the workflow in order to fetch some subset of users instead of the entire dataset. Is that right? If so, you can provide a search parameter or filter via the payload of the request that you use to trigger the webhook and then reference that value in subsequent blocks.

image

I hope that helps! Definitely let me know if you have any follow-up questions.