Quick Overview
This workflow receives investment inputs via a webhook, calculates projected returns and a risk profile, pulls matching Google News RSS headlines for market context, and uses Groq (LangChain agent) to generate a structured JSON analysis with three investment suggestions returned in the webhook response.
How it works
- Receives a POST webhook request with investment principal, expected annual return rate, and time horizon.
- Validates the inputs and immediately returns a JSON error response if the amount is below 1000, the rate is outside 0–50%, or the time horizon is under 1 year.
- Calculates compound-growth projections (future value and profit) and assigns a Low/Medium/High risk level based on the expected return.
- Fetches Google News RSS results using a risk-specific query, sorts them by newest first, and keeps the top five headlines.
- Sends the investment inputs, projections, risk level, and curated headlines to a Groq chat model to produce a strict-JSON summary, realism insight, and exactly three suggestions (low/medium/high risk).
- Wraps the AI output together with the original inputs and projection details into a final JSON object and returns it to the webhook caller.
Setup
- Activate the Webhook trigger and copy the test/production webhook URL into the app or client that will POST the investment payload.
- Add Groq API credentials for the Groq chat model used by the AI analysis step.
- Ensure your webhook request body includes
principal, rate, and time fields that match the workflow’s validation rules and calculations.
- Optionally edit the Google News RSS query URLs to match your preferred market keywords for each risk level.