Quick overview
This workflow receives a ManyChat webhook, instantly returns a 200 OK to avoid ManyChat’s 10-second timeout, then asynchronously generates a WhatsApp reply with OpenAI, syncs the lead to Brevo CRM, and optionally notifies an SDR team in Slack for hot leads.
How it works
- Receives a POST webhook request from ManyChat and immediately responds with an HTTP 200 JSON handshake.
- Extracts subscriber details and message context from the ManyChat payload and calculates a lead score and tier.
- Sends the lead context to OpenAI (Chat Completions, gpt-4o-mini) to generate a short WhatsApp-ready reply.
- Upserts the contact into Brevo CRM with lead attributes (score, tier, interest, budget, and WhatsApp ID).
- Pushes the generated reply back to the user by calling ManyChat’s sendContent API for a WhatsApp callback message.
- If the lead is scored as HOT, sends an escalation alert to Slack via an incoming webhook with a direct wa.me chat link.
Setup
- Create environment variables (or replace placeholders in the requests) for MANYCHAT_API_KEY, OPENAI_API_KEY, BREVO_API_KEY, and SLACK_WEBHOOK_URL.
- Copy the production webhook URL from the ManyChat webhook trigger and configure it in your ManyChat external request/webhook step.
- Ensure your Brevo account has the contact attributes used by the workflow (e.g., WHATSAPP_ID, LEAD_SCORE, LEAD_TIER, INTEREST, BUDGET) or adjust the payload to match your schema.
- Confirm your ManyChat channel supports sendContent for your WhatsApp setup and that subscriber_id and phone are present in the webhook payload.
- Customize the lead scoring rules and the OpenAI prompt to match your qualification criteria and brand voice.