Connect ChatGPT to Outlook for Email & Calendar Tasks
GPT Action workflow that connects ChatGPT to Microsoft Outlook to send and retrieve emails and calendar events using natural language commands.
Why it matters
Leverage ChatGPT's natural language capabilities to directly interact with your Outlook account, enabling seamless management of emails and calendar events.
Outcomes
What it gets done
Summarize your daily meetings and calendar events.
Send emails directly from ChatGPT outputs.
Retrieve and manage emails and calendar entries.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/oai-gptactionoutlook | bash Steps
Steps in the chain
Register a new App registration in the Azure Portal which will be used to integrate OAuth between your application and Azure Active Directory/Entra ID. Provide the application with a relevant name, leaving the Redirect URI blank for now as you will return to this later, and save.
Generate a client secret to provide secure communication between the GPT and Azure. Within the App registration, navigate to Certificate & secrets in the sidebar. Click New client secret and create a new client secret with desired name and expiry date. Save the Secret Value field as it will only be visible at creation and you will need it later.
Provide the integration with the scope it needs to perform required actions. Within the App registration, navigate to Manage > API permissions in the sidebar. Click Add a permission and select Microsoft graph > Delegated Permissions. Use the search bar to add the following permissions: Calendars.ReadWrite, Mail.Read, Mail.Send, User.Read
In ChatGPT, click on Authentication and choose OAuth. Enter the Client ID from the Azure Registered App's Overview page under Application (client) ID, and the Client Secret Value saved from step 2. Replace <Tenant_ID> with the Directory (tenant) ID from the Registered App's Overview page in the Authorization URL and Token URL fields.
Copy the callback URL from the GPT Action. In the Azure app, navigate to Manage > Authentication tab, click Add a platform, select Web and add your callback URL under Redirect URI.
Overview
GPT Action Library: Outlook
What it does
This is a developer guide for building a GPT Action that connects to Microsoft Outlook for email and calendar management. It provides step-by-step instructions for setting up Azure App Registration, configuring OAuth authentication, and establishing the necessary API permissions to enable ChatGPT to interact with a user's Outlook account.
How it connects
Use this when you want to enable ChatGPT to access and manage Outlook emails and calendar events on behalf of users through natural language interactions, such as summarizing daily meetings or sending email outputs directly from chat conversations.
Source README
GPT Action Library: Outlook
Introduction
This page provides an instruction & guide for developers building a GPT Action for a specific application. Before you proceed, make sure to first familiarize yourself with the following information:
- Introduction to GPT Actions
- Introduction to GPT Actions Library
- Example of Buliding a GPT Action from Scratch
This particular GPT Action provides an overview of how to connect to Outlook, Microsoft's web service for emailing and calendar events. This action assumes a user’s context and allows them to send and retrieve emails and calendar events from Outlook.
Value + Example Business Use Cases
Value: Users can now leverage ChatGPT's natural language capability to connect directly to Outlook
Example Use Cases:
- A user can look up all of their meetings for the day and have ChatGPT summarize the day
- A user can email a ChatGPT output to someone directly
Application Information
Application Key Links
Check out these links from the application before you get started:
- Application Website: https://portal.azure.com/
- Application API Documentation: https://learn.microsoft.com/en-us/graph/api/overview?view=graph-rest-1.0
Application Prerequisites
Before you get started, make sure you go through the following steps in your application environment:
- Ensure you have the access and permissions to Set up an App Registration in Azure
ChatGPT Steps
Custom GPT Instructions
Once you've created a Custom GPT, copy the text below in the Instructions panel. Have questions? Check out Getting Started Example to see how this step works in more detail.
OpenAPI Schema
Once you've created a Custom GPT, copy the text below in the Actions panel. Have questions? Check out Getting Started Example to see how this step works in more detail.
Authentication Instructions
Below are instructions on setting up authentication with Outlook. Have questions? Check out Getting Started Example to see how this step works in more detail.
Azure Steps
App Registration: The first step is to register a new App registration in the Azure Portal which will be used to integrate OAuth between our application and Azure Active Directory/Entra ID. Simply provide the application with a relevant name, leaving the Redirect URI blank for now as we will return to this, and save.
Certificate & Secrets: We next need to generate a client secret to provide secure communication between the GPT and Azure. Within the App registration, navigate to Certificate & secrets in the sidebar
Click New client secret and create a new client secret with desired name and expiry date. Clicking save will provide us a Secret to use in our GPT creation. Make sure to save the Value field as it’ll only be visible at creation, and we will need it later!
- API Permissions: The next step is to provide the integration with the scope it needs to perform our specific required actions.
Within the App registration, navigate to Manage > API permissions in the sidebar.
Click Add a permission and Microsoft graph > Delegated Permissions as options in the opened side menu. Use the search bar to add the following permissions:
- Calendars.ReadWrite
- Mail.Read
- Mail.Send
- User.Read
In ChatGPT
In ChatGPT, click on "Authentication" and choose "OAuth". Enter in the information below.
- Client ID: The value listed on the Azure Registered App’s Overview page under Application (client) ID
- Client Secret: the secret Value saved from step 2 of Azure Steps
For the following two inputs, replace
- Authorization URL: https://login.microsoftonline.com/
/oauth2/v2.0/authorize - Token URL: https://login.microsoftonline.com/
/oauth2/v2.0/token - Scope: https://graph.microsoft.com/User.Read https://graph.microsoft.com/Mail.Send https://graph.microsoft.com/Mail.Read https://graph.microsoft.com/Calendars.ReadWrite
- Token Exchange Method: Default (POST Request)
Post-Action Steps
Once you've set up authentication in ChatGPT, follow the steps below in the application to finalize the Action.
Copy the callback URL from the GPT Action
In the Azure app, navigate to the Manage > Authentication tab, click Add a platform, select Web and add your callback URL under Redirect URI
FAQ & Troubleshooting
- Callback URL Error: If you get a callback URL error in ChatGPT, double check the Callback URL value as it can occasionally change depending on any alterations made to the authentication
Are there integrations that you’d like us to prioritize? Are there errors in our integrations? File a PR or issue in our github, and we’ll take a look.
Step 1: App Registration
Register a new App registration in the Azure Portal which will be used to integrate OAuth between your application and Azure Active Directory/Entra ID. Provide the application with a relevant name, leaving the Redirect URI blank for now as you will return to this later, and save.
Step 2: Certificate & Secrets
Generate a client secret to provide secure communication between the GPT and Azure. Within the App registration, navigate to Certificate & secrets in the sidebar. Click New client secret and create a new client secret with desired name and expiry date. Save the Secret Value field as it will only be visible at creation and you will need it later.
Step 3: API Permissions
Provide the integration with the scope it needs to perform required actions. Within the App registration, navigate to Manage > API permissions in the sidebar. Click Add a permission and select Microsoft graph > Delegated Permissions. Use the search bar to add the following permissions: Calendars.ReadWrite, Mail.Read, Mail.Send, User.Read
Step 4: Configure OAuth in ChatGPT
In ChatGPT, click on Authentication and choose OAuth. Enter the Client ID from the Azure Registered App's Overview page under Application (client) ID, and the Client Secret Value saved from step 2. Replace <Tenant_ID> with the Directory (tenant) ID from the Registered App's Overview page in the Authorization URL and Token URL fields.
Step 5: Set Redirect URI in Azure
Copy the callback URL from the GPT Action. In the Azure app, navigate to Manage > Authentication tab, click Add a platform, select Web and add your callback URL under Redirect URI.
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.