Skip to content

Open WebUI Tools for Google Services: Manage contacts, send emails, and schedule Google Meet meetings directly from your AI assistant using Google APIs.

Notifications You must be signed in to change notification settings

pahautelman/open-webui-email-calendar-assistant

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Open WebUI Tools for Google Services (Email, Contacts, Meetings)

This repository contains a set of Python tools designed to extend the capabilities of Open WebUI (or similar AI platforms supporting tool use) by integrating with Google Services. These tools allow your AI assistant to perform actions like looking up email addresses, sending emails via Gmail, and scheduling Google Meet meetings via Google Calendar.

Features

  • Email Lookup Tool: Search for email addresses using fuzzy matching against a local dictionary and add new contact entries.
  • Email Sending Tool: Send emails using the Gmail API.
  • Google Meet Scheduling Tool: Schedule meetings and generate Google Meet links using the Google Calendar API.
  • Integration designed for platforms supporting tool calling, like Open WebUI.
  • Secure authentication via OAuth 2.0 for Google APIs.

Prerequisites

  • An instance of Open WebUI or a compatible AI platform with tool calling support.
  • A Google Cloud Project with the Gmail API and Google Calendar API enabled.
  • OAuth 2.0 Client ID credentials (Desktop app type) from your Google Cloud Project. You will need the client_id and client_secret from the downloaded JSON file. See the Google API documentation for details on setting this up.
  • Python 3.11+ installed on the system where the tools will run (this is typically the system hosting Open WebUI).

Use

For guidelines on how to configure these tools in your Open WebUI app, please refer to this article

Configuration

Each tool requires configuration, primarily for Google API authentication. This is done within the Open WebUI interface via the "Valves" for each tool.

  1. Access Tool Configuration: In Open WebUI, navigate to the Tools section and select each of the newly added tools.
  2. Configure google_credentials: For the Email Sending Tool and Google Meet Scheduling Tool, you must update the google_credentials valve. Replace the placeholder JSON content with the actual content of your downloaded Google Cloud OAuth 2.0 Client ID JSON file.
  3. Configure Tool-Specific Valves:
    • Email Lookup Tool:
      • similarity_threshold: Adjust the minimum score for fuzzy name matching (0-100).
      • case_sensitive: Set to True for case-sensitive name matching.
      • email_dict_path: Specify the path where the email_dictionary.json file will be stored. By default, this will be in the directory where the tool is executed from.
    • Google Meet Scheduling Tool:
      • default_time_zone: Set your preferred default IANA time zone (e.g., Europe/Amsterdam).
    • Email Sending Tool:
      • No additional specific valves beyond google_credentials.
  4. Authentication Flow: The first time each Google API tool is used, it will require you to complete an OAuth 2.0 consent flow. This will typically open a browser window asking you to log in to Google and authorize the application. Complete this flow, and the tool will save a token.json (or similarly named) file to maintain authentication for future use. Do NOT delete this token file.

Recommended Setup: Specialized Model and System Prompt

For the best and safest experience, it is highly encouraged to create a specialized model instance within Open WebUI specifically for using these tools. Configure this model with access only to the following tools:

  • EmailLookupTool
  • EmailSendingTool
  • GoogleMeetSchedulingTool
  • A get time tool (easily creatable)
  • A get date tool (easily creatable)
  • A Calculator tool (easily creatable)

This limits the model's capabilities to only the intended functions, reducing the risk of unintended actions.

Use the following System Prompt for this specialized model. This prompt instructs the model on how to use the tools and, critically, implements a strict safety protocol requiring user confirmation before sending emails or scheduling meetings.

**System Prompt:**

You are a helpful assistant designed to manage contacts, emails, and meetings using specialised tools.

Your capabilities include:
* Looking up email addresses using the `EmailLookupTool`.
* Sending emails using the `EmailSendingTool`.
* Scheduling Google Meet meetings using the `GoogleMeetSchedulingTool`.

**VERY IMPORTANT SAFETY PROTOCOL:**
**BEFORE** you execute an action using the `EmailSendingTool` or the `GoogleMeetSchedulingTool`, you MUST follow these steps:
1.  Clearly state the action you are about to take (sending email or scheduling meeting).
2.  Present ALL the parameters you intend to use for the tool call.
    * For `EmailSendingTool`, list: `sender`, `to`, `subject`, `message_text`.
    * For `GoogleMeetSchedulingTool`, list: `summary`, `start_time`, `end_time`, `attendees` (if provided), `time_zone` (if provided), `description` (if provided).
3.  Explicitly ask the user: "Do you approve executing this action with these parameters?" or a similar clear request for confirmation before taking the action.
4.  Only execute the tool call *AFTER* receiving explicit confirmation (e.g., "Yes", "Proceed", "Confirm", "Okay") from the user. Do not proceed with the original parameters if the user denies permission or asks for changes.

The `EmailLookupTool`, `Calculator`, and `DateTime` only retrieve information. You may use them when necessary to fulfil a request without asking for prior permission, but you must state that you are using them (e.g., "I'll use the EmailLookupTool to find that address...").

Always be clear about your intentions and the information you are using. If any details required for a tool are missing or ambiguous (like specific times, recipients, or email content), ask the user for clarification *before* preparing the tool call parameters for review.

About

Open WebUI Tools for Google Services: Manage contacts, send emails, and schedule Google Meet meetings directly from your AI assistant using Google APIs.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages