Quick Overview
This workflow checks unread Gmail messages every hour, uses Groq-hosted LLM prompts to triage importance and route emails to the right manager, then updates a Notion CRM database, forwards an assignment email via Gmail, and triggers a Twilio confirmation call via HTTP.
How it works
- Triggers every hour and pulls unread emails from Gmail.
- Uses Groq (via LangChain) to classify each email as important or not based on the sender, subject, and snippet.
- If the email is important, fetches member/manager records and existing company records from Notion.
- Combines the email, manager list, and company list, then uses Groq (via LangChain) to match the email to an existing company or assign a new company and select an active manager.
- If the status is "assigned," creates a new company record in the Notion Companies database with the selected manager and extracted company details.
- Sends an assignment notification email to the selected manager through Gmail and then triggers a confirmation call using the Twilio Calls API over HTTP.
Setup
- Connect Gmail OAuth2 credentials for both the Gmail trigger (unread polling) and the Gmail send action.
- Add Groq API credentials for the two LangChain LLM steps and adjust the prompts if you want different importance/routing rules.
- Connect Notion API credentials and update the two Notion database IDs to point to your duplicated Members and Companies databases.
- Configure the Twilio HTTP request with your Twilio Account SID in the URL, HTTP Basic Auth (Account SID and Auth Token), and set the To/From phone numbers and webhook URL used for the call.