Quick overview
This workflow monitors incoming Gmail messages from suppliers, uses Google Gemini to analyze sentiment and relationship risk, generates an engagement strategy for risky emails, sends an alert to Slack, and logs the analysis and recommended response to Google Sheets.
How it works
- Triggers every minute by checking Gmail for new incoming emails.
- Filters out irrelevant messages (for example newsletters, unsubscribe emails, no-reply senders, and auto-replies) and keeps only valid supplier emails.
- Extracts the sender, subject, and email snippet into a single text block and waits briefly to buffer processing.
- Sends the email text to Google Gemini to return a structured JSON analysis with sentiment score/label, intent, urgency, key concern, and deterioration risk, then normalizes these fields and derives a trend.
- Flags the interaction as high risk based on the deterioration risk value or a low sentiment score and waits briefly before continuing.
- Uses Google Gemini to generate a concise engagement strategy (recommended action, draft opening message, and follow-up timeline), then parses it and formats a Slack-ready alert.
- Sends the alert to a selected Slack user and appends the full analysis and strategy to a Google Sheets log for historical tracking.
Setup
- Connect your Gmail OAuth2 credentials and ensure the Gmail Trigger is monitoring the mailbox that receives supplier emails.
- Add a Google Gemini (Google PaLM) API credential for the two Gemini steps (analysis and strategy generation).
- Connect your Slack OAuth2 credential and select the user/channel destination for the alert message.
- Connect your Google Sheets OAuth2 credential and update the target spreadsheet and sheet tab where the workflow appends the interaction log.
Additional info
How To Customize Nodes
-
Gmail Trigger
-
Filter Node
- Modify filtering conditions based on business needs
-
AI Prompt
- Add more analysis fields or adjust output format
-
Risk Detection
- Adjust sentiment threshold
-
Slack Node
- Send messages to a channel instead of a user
- Customize alert format
-
Google Sheets
- Add additional columns such as urgency or trend
Add-ons (Enhancements)
- Auto-reply to supplier emails
- CRM integration (e.g., Salesforce or HubSpot)
- Dashboard reporting using analytics tools
- Escalation for high-risk suppliers
- Multi-language support
- Sentiment trend analytics
Use Case Examples
- Supplier complaint detection
- Vendor risk monitoring
- Customer support automation
- Supplier performance tracking
- Automated relationship management
There can be many more use cases depending on business requirements.
Troubleshooting Guide
| Issue |
Possible Cause |
Solution |
| Gmail trigger not working |
Incorrect OAuth setup |
Reconnect Gmail credentials |
| AI parsing fails |
Invalid JSON response |
Ensure strict JSON prompt |
| Slack alert not sent |
Wrong user ID |
Verify Slack configuration |
| Google Sheets not updating |
Incorrect sheet mapping |
Check document ID and columns |
| Workflow stops unexpectedly |
Node execution error |
Review execution logs |
| Strategy fields empty |
AI output format mismatch |
Adjust parsing logic |
Need Help?
If you need help setting up this workflow, customizing it or extending its capabilities, professional support is available. Our n8n workflow developers at WeblineIndia can assist you in building advanced automation workflows, integrating AI into your processes and scaling your business operations efficiently.
Feel free to reach out for customization, enhancements or building business automation solutions.