Back to Catalog

Manage Google Calendar & Gmail with a Gemini/GPT powered AI assistant

Praneel SPraneel S
701 views
2/3/2026
Official Page

Manage Google Calendar events and Gmail with a customizable AI assistant

⚠️ Disclaimer: This workflow uses Google Calendar and Gmail nodes which you will have to configure yourself

Who’s it for

This workflow is built for busy professionals, freelancers, and teams who want to automate calendar scheduling and email handling with the help of an AI assistant. Instead of switching between Gmail and Google Calendar, you can delegate tasks like “schedule a meeting,” “send an invite,” or “check my latest emails” directly to the assistant.

How it works

  • The AI Agent interprets natural language requests and decides which tool to use.
  • Uses Google Calendar nodes to:
    • Check availability and list events.
    • Create new events with attendees.
    • Update existing events.
  • Uses Gmail nodes to:
    • Send emails with a clear subject and body.
    • Retrieve recent messages or filter by sender/date.
  • The Date & Time node ensures correct time handling for scheduling.
  • Built-in guardrails ensure clarity: if information is missing (e.g., timezone, meeting duration), the AI will ask you instead of guessing.

How to set up

  1. Import the workflow into your self-hosted n8n.
  2. Create credentials for:
    • Google Calendar API (OAuth2)
    • Gmail API (OAuth2)
    • AI model (Google Gemini, OpenAI GPT, or another supported connector)
  3. Connect these credentials to the corresponding workflow nodes.
  4. Update default values like:
    • Your Google Calendar email ID
    • Timezone preferences
    • Default conference solution (Google Meet is included by default)
  5. Test the workflow by asking natural queries such as:
    • “Schedule a meeting with alice@example.com tomorrow at 3 PM.”
    • “Check my emails from this morning.”
    • “What’s on my calendar next week?”

Tools

🤖 AI Agent

The “brain” of the workflow. Interprets your requests and chooses the right tool. Asks for clarification if details are missing and confirms before important actions.

🧠 Google Gemini Chat Model (or any LLM)

The AI language model that powers the assistant. You can swap Gemini with OpenAI, Claude, or another model.

📌 Simple Memory

Keeps short-term context of the last ~10 interactions so the agent remembers what “it” refers to in your requests.

📧 Send a message in Gmail

Sends emails from your Gmail account. Requires recipient, subject, and body. Generates clear, professional text.

📥 Get many messages in Gmail

Checks your inbox. Can filter by timeframe or sender. Returns detailed summaries, not just one-liners.

📅 Get many events in Google Calendar

Lists your events for a chosen date range. Useful for “What’s on my schedule this week?”

⏰ Date & Time

Converts natural phrases like “tomorrow at 3 PM” into exact ISO date-time values.

✅ Get availability in Google Calendar

Checks if you’re free during a specific time slot. Prevents double-booking before scheduling.

📝 Create an event in Google Calendar

Schedules a new meeting. Adds title, start/end times, attendees, description, and Google Meet link.

✏️ Update an event in Google Calendar

Edits an existing meeting. Change time, attendees, or details without creating a new event.

Example Prompt

# n8n AI Agent System Prompt: Personal Assistant

You are an advanced AI Personal Assistant operating within an n8n workflow. Your primary function is to serve as a cognitive engine that translates user requests into specific, executable tool calls. You are precise, methodical, and you do not act without sufficient information.

---

## Core Operating Principles

1.  **Tool-Centric Operation:** You can only perform actions for which you have been explicitly provided a tool. Before acting, you will review the `Tool Manifest` to confirm you have the required capability. If a user's request does not map to any available tool, you **MUST** clearly state that you cannot perform the action and why. For example: "I am sorry, but I cannot set a reminder as I do not have a tool for that function."
2.  **Clarification Mandate:** If a user's request is ambiguous or is missing a required parameter for a tool, you **MUST** ask clarifying questions before proceeding. Never guess or assume details like timezones, email recipients, or event durations.
3.  **Single-Focus Execution:** Handle one primary task at a time. If a user asks to schedule a meeting and check emails, process the meeting first unless the user specifies otherwise.
4.  **User Confirmation:** Before executing actions that create data or notify others (e.g., creating an event, sending an email), briefly state your plan of action for the user to confirm. Example: "I will schedule an event titled 'Project Sync' for 3 PM tomorrow and invite 'bob@example.com'. Is that correct?"

---

## Tool Manifest & Usage Protocols

You have access to the following tools. Adhere strictly to their parameters and usage triggers.

#### Tool: `system_getCurrentTime`
* **Description:** Retrieves the current date and time.
* **When to Use:** When the user asks for the current time, date, or uses relative terms like "today", "tomorrow", "this week". This tool is often a dependency for other tools.
* **Parameters:**
    * `timezone` (string, required): The IANA timezone identifier (e.g., 'America/New_York', 'Asia/Kolkata').
* **Protocol:** If the user asks for the time without providing a `timezone`, you **MUST** respond by asking: "Certainly. In which timezone would you like the time?" You will output the time in `HH:MM` format as requested.

#### Tool: `googleCalendar_getEvents`
* **Description:** Fetches a list of events from the user's Google Calendar within a specified date range.
* **When to Use:** When the user asks "What's on my schedule?", "Am I busy?", or asks about events for a specific day, week, or month.
* **Parameters:**
    * `startDate` (string, ISO 8601 format, required): The start of the time period.
    * `endDate` (string, ISO 8601 format, required): The end of the time period.
* **Protocol:** Use `system_getCurrentTime` to establish the date for relative queries. "This week" means from today's date for the next 7 days. "Today" means from the start of the current day to the end of the current day.

#### Tool: `googleCalendar_createEvent`
* **Description:** Creates a new event on the user's Google Calendar.
* **When to Use:** When the user asks to "schedule", "book", "create", or "add" an event, meeting, or appointment.
* **Parameters:**
    * `summary` (string, required): The title of the event.
    * `startTime` (string, ISO 8601 format, required): The start time of the event.
    * `endTime` (string, ISO 8601 format, required): The end time of the event.
    * `attendees` (array of strings, optional): A list of attendee email addresses.
* **Protocol:** If the user mentions other people in the scheduling request, automatically include their names/emails in the `attendees` parameter. You must have all required parameters before calling this tool.

#### Tool: `gmail_sendMessage`
* **Description:** Composes and sends an email via Gmail.
* **When to Use:** When the user asks to "email", "send a message", or "contact" someone.
* **Parameters:**
    * `recipient` (string, required): The primary recipient's email address.
    * `subject` (string, required): The email subject line.
    * `body` (string, required): The content of the email.
* **Protocol:** The `subject` must be detailed and relevant to the body's content. The `body` should be professionally written and clearly articulate the user's message without unnecessary embellishment.

#### Tool: `gmail_getMessages`
* **Description:** Retrieves a list of emails from the user's Gmail account.
* **When to Use:** When the user asks to "check my email", "see recent emails", or "find an email from someone".
* **Parameters:**
    * `startDate` (string, ISO 8601 format, optional): The start date to filter emails from.
    * `endDate` (string, ISO 8601 format, optional): The end date to filter emails to.
    * `from` (string, optional): Filter emails from a specific sender.
* **Protocol:** Use `system_getCurrentTime` to define date ranges for requests like "emails from this morning".

---

## Defined Workflow: "Schedule a Meeting and Send Invite"

When a user's request involves both scheduling a meeting and notifying the attendees, you **MUST** follow this exact sequence of tool calls:

1.  **Acknowledge and Gather:** Acknowledge the request. Check if you have all the necessary information (`topic/summary`, `attendees`, `proposed time/date`, `duration`). If not, ask for the missing details.
2.  **Step 1: Check Availability (`googleCalendar_getEvents`)**: Use the `googleCalendar_getEvents` tool to check the user's schedule for the proposed `startTime` and `endTime`.
3.  **Step 2: Report & Decide**:
    * **If Conflict Exists:** Report the scheduling conflict to the user, mentioning the existing event. State: "You already have '[Existing Event Title]' scheduled at that time. Would you like to find a different time?" Await further instructions.
    * **If No Conflict:** Proceed to the next step.
4.  **Step 3: Create Event (`googleCalendar_createEvent`)**: Once the time is confirmed to be free, call this tool with the gathered `summary`, `startTime`, `endTime`, and `attendees`.
5.  **Step 4: Notify Attendees (`gmail_sendMessage`)**: After the event is successfully created, immediately call this tool to send an invitation email.
    * `recipient`: The `attendees` from the event.
    * `subject`: "Meeting Invitation: [Event Summary]".
    * `body`: "Hello,\n\nThis is an invitation to schedule '[Event Summary]' on [Date] at [Time]. Please check your calendar for the official Google Calendar invite.\n\nBest regards,"
6.  **Step 5: Final Confirmation**: Report to the user that the event has been scheduled and the invitation email has been sent.

Requirements

  • n8n instance
  • Google Workspace or Gmail account with API access enabled
  • Google Calendar API credentials
  • Gmail API credentials
  • AI model API key (Gemini, OpenAI, or other supported LLM)

How to customize the workflow

  • Swap out the AI model (Gemini, OpenAI, or another LLM).
  • Modify the system prompt in the AI Agent to change its personality or strictness.
  • Extend the workflow to trigger Slack or Teams notifications after scheduling.
  • Adjust the email formatting template for different tones (casual, professional, etc.).
  • Add error-handling logic for more advanced use cases (e.g., auto-rescheduling).

Contributions

AI Assistant for Google Calendar & Gmail (Gemini-powered)

This n8n workflow provides a powerful AI assistant that can manage your Google Calendar and Gmail, powered by Google's Gemini AI model. It allows you to interact with your digital life using natural language commands, making scheduling and email management effortless.

What it does

This workflow automates the following steps:

  1. Listens for chat messages: It acts as a conversational AI, waiting for incoming chat messages or commands.
  2. Maintains conversational memory: It remembers previous interactions within the conversation, allowing for more natural and context-aware responses.
  3. Processes commands with a Gemini-powered AI Agent: It uses a Google Gemini Chat Model to understand your natural language requests and determine the appropriate actions.
  4. Executes actions (e.g., Google Calendar, Gmail): Although the specific tools for Google Calendar and Gmail are not explicitly defined in the provided JSON, the "AI Agent" node, combined with the workflow's directory name, strongly implies its capability to interact with these services based on the AI's understanding.

Prerequisites/Requirements

To use this workflow, you will need:

  • n8n instance: A running n8n instance to import and execute the workflow.
  • Google Gemini API Key: For the Google Gemini Chat Model node to function.
  • Google Account: For accessing Google Calendar and Gmail (credentials will need to be configured within n8n).
  • LangChain Nodes: Ensure you have the @n8n/n8n-nodes-langchain package installed in your n8n instance.

Setup/Usage

  1. Import the workflow: Download the JSON provided and import it into your n8n instance.
  2. Configure Credentials:
    • Set up your Google Gemini API Key credential for the Google Gemini Chat Model node.
    • Configure your Google Account credentials for any Google Calendar and Gmail nodes that the AI Agent will utilize (these would typically be linked as "Tools" within the AI Agent configuration, though not detailed in the provided JSON).
  3. Activate the workflow: Once configured, activate the workflow to start listening for chat commands.
  4. Interact with the AI: Send chat messages to the workflow, and the AI assistant will process your requests related to Google Calendar and Gmail.

Related Templates

Auto-create TikTok videos with VEED.io AI avatars, ElevenLabs & GPT-4

💥 Viral TikTok Video Machine: Auto-Create Videos with Your AI Avatar --- 🎯 Who is this for? This workflow is for content creators, marketers, and agencies who want to use Veed.io’s AI avatar technology to produce short, engaging TikTok videos automatically. It’s ideal for creators who want to appear on camera without recording themselves, and for teams managing multiple brands who need to generate videos at scale. --- ⚙️ What problem this workflow solves Manually creating videos for TikTok can take hours — finding trends, writing scripts, recording, and editing. By combining Veed.io, ElevenLabs, and GPT-4, this workflow transforms a simple Telegram input into a ready-to-post TikTok video featuring your AI avatar powered by Veed.io — speaking naturally with your cloned voice. --- 🚀 What this workflow does This automation links Veed.io’s video-generation API with multiple AI tools: Analyzes TikTok trends via Perplexity AI Writes a 10-second viral script using GPT-4 Generates your voiceover via ElevenLabs Uses Veed.io (Fabric 1.0 via FAL.ai) to animate your avatar and sync the lips to the voice Creates an engaging caption + hashtags for TikTok virality Publishes the video automatically via Blotato TikTok API Logs all results to Google Sheets for tracking --- 🧩 Setup Telegram Bot Create your bot via @BotFather Configure it as the trigger for sending your photo and theme Connect Veed.io Create an account on Veed.io Get your FAL.ai API key (Veed Fabric 1.0 model) Use HTTPS image/audio URLs compatible with Veed Fabric Other APIs Add Perplexity, ElevenLabs, and Blotato TikTok keys Connect your Google Sheet for logging results --- 🛠️ How to customize this workflow Change your Avatar: Upload a new image through Telegram, and Veed.io will generate a new talking version automatically. Modify the Script Style: Adjust the GPT prompt for tone (educational, funny, storytelling). Adjust Voice Tone: Tweak ElevenLabs stability and similarity settings. Expand Platforms: Add Instagram, YouTube Shorts, or X (Twitter) posting nodes. Track Performance: Customize your Google Sheet to measure your most successful Veed.io-based videos. --- 🧠 Expected Outcome In just a few seconds after sending your photo and theme, this workflow — powered by Veed.io — creates a fully automated TikTok video featuring your AI avatar with natural lip-sync and voice. The result is a continuous stream of viral short videos, made without cameras, editing, or effort. --- ✅ Import the JSON file in n8n, add your API keys (including Veed.io via FAL.ai), and start generating viral TikTok videos starring your AI avatar today! 🎥 Watch This Tutorial --- 📄 Documentation: Notion Guide Need help customizing? Contact me for consulting and support : Linkedin / Youtube

Dr. FirasBy Dr. Firas
39510

Automate Dutch Public Procurement Data Collection with TenderNed

TenderNed Public Procurement What This Workflow Does This workflow automates the collection of public procurement data from TenderNed (the official Dutch tender platform). It: Fetches the latest tender publications from the TenderNed API Retrieves detailed information in both XML and JSON formats for each tender Parses and extracts key information like organization names, titles, descriptions, and reference numbers Filters results based on your custom criteria Stores the data in a database for easy querying and analysis Setup Instructions This template comes with sticky notes providing step-by-step instructions in Dutch and various query options you can customize. Prerequisites TenderNed API Access - Register at TenderNed for API credentials Configuration Steps Set up TenderNed credentials: Add HTTP Basic Auth credentials with your TenderNed API username and password Apply these credentials to the three HTTP Request nodes: "Tenderned Publicaties" "Haal XML Details" "Haal JSON Details" Customize filters: Modify the "Filter op ..." node to match your specific requirements Examples: specific organizations, contract values, regions, etc. How It Works Step 1: Trigger The workflow can be triggered either manually for testing or automatically on a daily schedule. Step 2: Fetch Publications Makes an API call to TenderNed to retrieve a list of recent publications (up to 100 per request). Step 3: Process & Split Extracts the tender array from the response and splits it into individual items for processing. Step 4: Fetch Details For each tender, the workflow makes two parallel API calls: XML endpoint - Retrieves the complete tender documentation in XML format JSON endpoint - Fetches metadata including reference numbers and keywords Step 5: Parse & Merge Parses the XML data and merges it with the JSON metadata and batch information into a single data structure. Step 6: Extract Fields Maps the raw API data to clean, structured fields including: Publication ID and date Organization name Tender title and description Reference numbers (kenmerk, TED number) Step 7: Filter Applies your custom filter criteria to focus on relevant tenders only. Step 8: Store Inserts the processed data into your database for storage and future analysis. Customization Tips Modify API Parameters In the "Tenderned Publicaties" node, you can adjust: offset: Starting position for pagination size: Number of results per request (max 100) Add query parameters for date ranges, status filters, etc. Add More Fields Extend the "Splits Alle Velden" node to extract additional fields from the XML/JSON data, such as: Contract value estimates Deadline dates CPV codes (procurement classification) Contact information Integrate Notifications Add a Slack, Email, or Discord node after the filter to get notified about new matching tenders. Incremental Updates Modify the workflow to only fetch new tenders by: Storing the last execution timestamp Adding date filters to the API query Only processing publications newer than the last run Troubleshooting No data returned? Verify your TenderNed API credentials are correct Check that you have setup youre filter proper Need help setting this up or interested in a complete tender analysis solution? Get in touch 🔗 LinkedIn – Wessel Bulte

Wessel BulteBy Wessel Bulte
247

Automate invoice processing with OCR, GPT-4 & Salesforce opportunity creation

PDF Invoice Extractor (AI) End-to-end pipeline: Watch Drive ➜ Download PDF ➜ OCR text ➜ AI normalize to JSON ➜ Upsert Buyer (Account) ➜ Create Opportunity ➜ Map Products ➜ Create OLI via Composite API ➜ Archive to OneDrive. --- Node by node (what it does & key setup) 1) Google Drive Trigger Purpose: Fire when a new file appears in a specific Google Drive folder. Key settings: Event: fileCreated Folder ID: google drive folder id Polling: everyMinute Creds: googleDriveOAuth2Api Output: Metadata { id, name, ... } for the new file. --- 2) Download File From Google Purpose: Get the file binary for processing and archiving. Key settings: Operation: download File ID: ={{ $json.id }} Creds: googleDriveOAuth2Api Output: Binary (default key: data) and original metadata. --- 3) Extract from File Purpose: Extract text from PDF (OCR as needed) for AI parsing. Key settings: Operation: pdf OCR: enable for scanned PDFs (in options) Output: JSON with OCR text at {{ $json.text }}. --- 4) Message a model (AI JSON Extractor) Purpose: Convert OCR text into strict normalized JSON array (invoice schema). Key settings: Node: @n8n/n8n-nodes-langchain.openAi Model: gpt-4.1 (or gpt-4.1-mini) Message role: system (the strict prompt; references {{ $json.text }}) jsonOutput: true Creds: openAiApi Output (per item): $.message.content → the parsed JSON (ensure it’s an array). --- 5) Create or update an account (Salesforce) Purpose: Upsert Buyer as Account using an external ID. Key settings: Resource: account Operation: upsert External Id Field: taxid_c External Id Value: ={{ $json.message.content.buyer.tax_id }} Name: ={{ $json.message.content.buyer.name }} Creds: salesforceOAuth2Api Output: Account record (captures Id) for downstream Opportunity. --- 6) Create an opportunity (Salesforce) Purpose: Create Opportunity linked to the Buyer (Account). Key settings: Resource: opportunity Name: ={{ $('Message a model').item.json.message.content.invoice.code }} Close Date: ={{ $('Message a model').item.json.message.content.invoice.issue_date }} Stage: Closed Won Amount: ={{ $('Message a model').item.json.message.content.summary.grand_total }} AccountId: ={{ $json.id }} (from Upsert Account output) Creds: salesforceOAuth2Api Output: Opportunity Id for OLI creation. --- 7) Build SOQL (Code / JS) Purpose: Collect unique product codes from AI JSON and build a SOQL query for PricebookEntry by Pricebook2Id. Key settings: pricebook2Id (hardcoded in script): e.g., 01sxxxxxxxxxxxxxxx Source lines: $('Message a model').first().json.message.content.products Output: { soql, codes } --- 8) Query PricebookEntries (Salesforce) Purpose: Fetch PricebookEntry.Id for each Product2.ProductCode. Key settings: Resource: search Query: ={{ $json.soql }} Creds: salesforceOAuth2Api Output: Items with Id, Product2.ProductCode (used for mapping). --- 9) Code in JavaScript (Build OLI payloads) Purpose: Join lines with PBE results and Opportunity Id ➜ build OpportunityLineItem payloads. Inputs: OpportunityId: ={{ $('Create an opportunity').first().json.id }} Lines: ={{ $('Message a model').first().json.message.content.products }} PBE rows: from previous node items Output: { body: { allOrNone:false, records:[{ OpportunityLineItem... }] } } Notes: Converts discount_total ➜ per-unit if needed (currently commented for standard pricing). Throws on missing PBE mapping or empty lines. --- 10) Create Opportunity Line Items (HTTP Request) Purpose: Bulk create OLIs via Salesforce Composite API. Key settings: Method: POST URL: https://<your-instance>.my.salesforce.com/services/data/v65.0/composite/sobjects Auth: salesforceOAuth2Api (predefined credential) Body (JSON): ={{ $json.body }} Output: Composite API results (per-record statuses). --- 11) Update File to One Drive Purpose: Archive the original PDF in OneDrive. Key settings: Operation: upload File Name: ={{ $json.name }} Parent Folder ID: onedrive folder id Binary Data: true (from the Download node) Creds: microsoftOneDriveOAuth2Api Output: Uploaded file metadata. --- Data flow (wiring) Google Drive Trigger → Download File From Google Download File From Google → Extract from File → Update File to One Drive Extract from File → Message a model Message a model → Create or update an account Create or update an account → Create an opportunity Create an opportunity → Build SOQL Build SOQL → Query PricebookEntries Query PricebookEntries → Code in JavaScript Code in JavaScript → Create Opportunity Line Items --- Quick setup checklist 🔐 Credentials: Connect Google Drive, OneDrive, Salesforce, OpenAI. 📂 IDs: Drive Folder ID (watch) OneDrive Parent Folder ID (archive) Salesforce Pricebook2Id (in the JS SOQL builder) 🧠 AI Prompt: Use the strict system prompt; jsonOutput = true. 🧾 Field mappings: Buyer tax id/name → Account upsert fields Invoice code/date/amount → Opportunity fields Product name must equal your Product2.ProductCode in SF. ✅ Test: Drop a sample PDF → verify: AI returns array JSON only Account/Opportunity created OLI records created PDF archived to OneDrive --- Notes & best practices If PDFs are scans, enable OCR in Extract from File. If AI returns non-JSON, keep “Return only a JSON array” as the last line of the prompt and keep jsonOutput enabled. Consider adding validation on parsing.warnings to gate Salesforce writes. For discounts/taxes in OLI: Standard OLI fields don’t support per-line discount amounts directly; model them in UnitPrice or custom fields. Replace the Composite API URL with your org’s domain or use the Salesforce node’s Bulk Upsert for simplicity.

Le NguyenBy Le Nguyen
942