Quick overview
This workflow runs on a daily schedule to review contract records in Google Sheets, calculates auto-renewal risk, uses a Groq-hosted chat model to generate renewal recommendations for flagged contracts, posts alerts to Slack, and logs each alert back to Google Sheets.
How it works
- Runs on a schedule trigger at 9:00 to start the contract review.
- Reads contract rows from a Google Sheets spreadsheet and standardizes key fields like end date, auto-renewal clause, notice period, usage level, and supplier rating.
- Calculates days remaining until the contract end date and assigns a renewal risk level (Low/Medium/High) based on auto-renewal, notice period timing, supplier rating, and usage level.
- Filters to only Medium- and High-risk contracts that require procurement review.
- Sends the contract details to a Groq chat model to generate a structured renewal recommendation (decision, reason, risk, and recommended action).
- Posts a contract renewal alert with the risk details and AI recommendation to a Slack channel.
- Waits for alert delivery and appends an audit entry to an AlertLog sheet in Google Sheets with the contract, risk level, days to end, timestamp, and action taken.
Setup
- Connect Google Sheets credentials and update the spreadsheet ID and sheet names for the contract source sheet and the AlertLog destination sheet.
- Add a Groq API credential for the chat model used to generate renewal recommendations.
- Add Slack credentials and select the target channel where renewal alerts should be posted.
- Ensure your contract sheet includes the expected columns (ContractID, SupplierName, ContractEndDate, AutoRenewalClause, NoticePeriodDays, UsageLevel, SupplierRating) and that dates and numbers are formatted consistently.