Quick overview
This workflow receives WhatsApp messages via Evolution API, uses Google Gemini multi-agent routing with Redis conversation memory to generate specialist replies, optionally schedules meetings in Google Calendar, logs qualified leads to Google Sheets, and sends the response back to WhatsApp.
How it works
- Receives an inbound
messages.upsert webhook from Evolution API with the WhatsApp message payload.
- Normalizes the payload to extract the chat ID, phone number, sender name, message text, and a flag indicating if the message was sent by the bot.
- Ignores messages sent by the bot or events without message text to prevent loops and unnecessary processing.
- Uses a Google Gemini-based orchestrator with Redis-backed memory to categorize the request and either answer directly or call a specialist tool (Sales, Support, or Finance) and optionally a Google Calendar scheduling tool.
- Parses the orchestrator result into a structured object containing
replyText, category, lead details, and a shouldLog flag.
- When
shouldLog is true, appends or updates the lead in Google Sheets by matching on the phone number.
- Sends
replyText back to the customer through Evolution API’s sendText endpoint.
Setup
- Configure Evolution API to send the
messages.upsert webhook event to this workflow’s Production webhook URL, and create an HTTP Header Auth credential with header name apikey set to your Evolution API key.
- Add a Google Gemini (PaLM) API credential and assign it to the orchestrator and the three specialist agents.
- Provide a Redis credential for the orchestrator and each specialist agent memory node.
- Add Google Sheets OAuth2 credentials, create a sheet with the expected columns, and set the spreadsheet ID and tab name in the Config values.
- Add Google Calendar OAuth2 credentials and set the calendar ID and timezone in the Config values so the agent can create meetings when requested.