Quick overview
Youtube Video: https://youtu.be/4eBS3peutkI
This workflow captures Facebook Lead Ads submissions, validates and normalizes contact data, upserts the lead into GoHighLevel, and immediately sends a WhatsApp welcome template while saving the first message to Redis so a Google Gemini–powered WhatsApp agent can continue the conversation with context.
How it works
- Triggers when a new lead is submitted via Facebook Lead Ads.
- Normalizes the payload (email, name, and phone), validates required fields, and stops processing for invalid leads.
- Searches GoHighLevel for an existing contact by email and creates/updates the contact when no match is found.
- Prepares a personalized WhatsApp outreach message, sends a WhatsApp approved template to the lead, and stores the same initial message in a Redis list keyed by the lead’s phone digits.
- Triggers on incoming WhatsApp messages and ignores any non-text messages.
- Uses a Google Gemini chat model with Redis chat memory to generate a short sales-assistant reply based on the inbound message and prior context.
- Sends the generated reply back to the lead via WhatsApp.
Setup
- Connect Facebook Lead Ads OAuth2 credentials and select the correct Facebook Page and Lead Form in the Facebook Lead Ads trigger.
- Connect GoHighLevel (HighLevel) OAuth2 credentials and confirm the contact lookup uses the right identifier (email) for your CRM.
- Connect WhatsApp Business API credentials, set the correct Phone Number ID, and ensure the “lead_welcome” WhatsApp message template exists and is approved for your account.
- Connect Redis credentials and ensure your Redis instance is reachable for storing and retrieving chat history.
- Connect Google Gemini (Google PaLM) credentials for the LangChain chat model used by the WhatsApp AI agent.
- Update environment-specific defaults as needed, such as the default country code used to normalize 10-digit phone numbers in the validation logic.