Add Outlook calendar and email actions

The following page describes how to set up actions for Outlook email and Outlook calendar.

Add Outlook email actions

When Outlook email actions are turned on, end users can ask the assistant to send emails for them.

For example, a user could enter "send an email to userA@example.com with title 'Today's meeting' and content 'What's the agenda?'". The assistant asks for additional details if necessary, and then asks the user to confirm sending the email.

The assistant can read and edit the following Outlook fields through actions:

Field Description
To Required. Recipients email list.
Subject Required. Subject of the email
Content Required. Contents of the email in Markdown format.
CC Email's CC list.
BCC Email's BCC list.

Set up authentication and permissions for Outlook email

Before turning on Outlook actions, an administrator must set up authentication and permissions for Outlook.

The following procedure applies to both Outlook email and Outlook calendar actions. If you plan to use both email and calendar actions, then enable scopes for both during the scope enabling procedure.

Create an OAuth app and add scopes

  1. Sign in to https://portal.azure.com/ and navigate to the App registrations page.
  2. Click New registration.

    1. Name your app.
    2. For redirect URI:
      • For platform type, select Web.
      • Add the following redirect URI: https://vertexaisearch.cloud.google.com/oauth-redirect
  3. Under Certificates & Secrets, create a new client secret. Take a note of the client secret. It is displayed only immediately after creation.

To enable required scopes:

  1. Go to the API Permissions settings page in your Azure App.
  2. Click Add a permission.
  3. Select Microsoft Graph.
  4. Select Delegated Permissions.
  5. Add the following scopes:
    1. offline_access
    2. User.Read
    3. Calendars.ReadWrite (if calendar actions are needed)
    4. Mail.Send (if email actions are needed)

Depending on the type of your Organizational settings in Azure, this last step of enabling scopes may be omitted.

Configure an Outlook email action

Before you begin, make sure that a Google Cloud administrator has completed the steps in Set up authentication and permissions for Outlook email and provided you with the following:

  • Client ID
  • Client secret
  • Tenant ID (called Instance ID on the API)

Configure Outlook email actions using the API

To add actions to your app using the API, do the following.

The following instructions can be used to configure both Outlook email and calendar actions. If you've already configured Outlook calendar actions, then you don't need to perform these steps again.

  1. Create an Outlook connector for actions:

    SERVER=https://discoveryengine.googleapis.com
    curl -X POST \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    -H "Content-Type: application/json" \
    -H "X-GFE-SSL: yes" \
    -H "X-Goog-User-Project: PROJECT_NUMBER" \
    "$SERVER/v1alpha/projects/PROJECT_NUMBER/locations/global:setUpDataConnector" \
    -d '{
      "collectionId": "PROJECT_NUMBER",
      "collectionDisplayName": "YOUR_COLLECTION_DISPLAY_NAME",
      "dataConnector": {
        "dataSource": "outlook",
        "params": {
          "instance_id": "INSTANCE_ID",
          "client_id": "CLIENT_ID",
          "client_secret": "CLIENT_SECRET"
        },
        "actionConfig": {
          "isActionConfigured": true,
          "actionParams": {
            "client_id": "CLIENT_ID",
            "client_secret": "CLIENT_SECRET",
            "instance_id": "INSTANCE_ID",
          }
        },
        "refreshInterval": "86400s",
        "entities": [
          {
            "entityName": "mail"
          },
          {
            "entityName": "mail-attachment"
          },
          {
            "entityName": "calendar"
          },
          {
            "entityName": "contact"
          }
        ],
        "syncMode": "PERIODIC",
      }
    }'
    
  2. Enable Outlook actions for your assistant. Leave out the entry for calendar if you only need the email action.

    SERVER=https://discoveryengine.googleapis.com
    PROJECT_NUMBER={PROJECT_NUMBER}
    ENGINE_ID="{YOUR ENGINE ID}"
    CONNECTOR_ID="{THE CONNECTOR'S COLLECTION ID YOU GENERATED IN PREVIOUS STEP}"
    
    curl -X PATCH \
      -H "Authorization: Bearer $(gcloud auth print-access-token --project "${PROJECT_NUMBER}")" \
      -H "Content-Type: application/json" \
      -H "X-Goog-User-Project: ${PROJECT_NUMBER}" \
      "$SERVER/v1alpha/projects/${PROJECT_NUMBER}/locations/global/collections/default_collection/engines/${ENGINE_ID}/assistants/default_assistant?update_mask=enabledActions" \
      -d '{
        "name": "projects/'"${PROJECT_NUMBER}"'/locations/global/collections/default_collection/engines/'"${ENGINE_ID}"'/assistants/default_assistant",
        "enabledActions": {
          "projects/'"${PROJECT_NUMBER}"'/locations/global/collections/'"${CONNECTOR_ID}"'/dataConnector": {
            "actionInfo": [
              {
                "actionName": "send_email",
                "actionDisplayName": "Send Email"
              },
              {
                "actionName": "create_calendar_event",
                "actionDisplayName": "Create Calendar Event"
              }
            ]
          }
        }
      }'
    

After you add actions, the assistant can perform those actions on behalf of your end users in the app. The first time a user asks the assistant to perform an Outlook action, they are asked to authorize access to their Outlook account. To use the assistant, users must have Agentspace Enterprise Plus licenses.

Add Outlook calendar actions

When Outlook calendar actions are turned on, end users can ask the assistant to create calendar events for them.

For example, a user could enter "schedule a meeting with userA@example.com at 11am on Friday November 4". The assistant asks for additional details if necessary, then asks the user to confirm creating the event.

The assistant can read and edit the following Outlook calendar fields through actions:

Field Description
Attendees Required. List of attendee email addresses. The requesting user is automatically added to the list.
Title Title of the meeting.
Start time Start time of the meeting.
Duration Duration of the meeting. Default is 30 minutes.
Time zone Time zone for meeting. If not provided the user's time zone is used.
Description Description of the meeting.

Set up authentication and permissions for Outlook calendar

Before turning on Outlook actions, an administrator must set up authentication and permissions for Outlook.

The following procedure applies to both Outlook email and Outlook calendar actions. If you plan to use both email and calendar actions, then enable scopes for both during the scope enabling procedure.

Create an OAuth app and add scopes

  1. Sign in to https://portal.azure.com/ and navigate to the App registrations page.
  2. Click New registration.

    1. Name your app.
    2. For redirect URI:
      • For platform type, select Web.
      • Add the following redirect URI: https://vertexaisearch.cloud.google.com/oauth-redirect
  3. Under Certificates & Secrets, create a new client secret. Take a note of the client secret. It is displayed only immediately after creation.

To enable required scopes:

  1. Go to the API Permissions settings page in your Azure App.
  2. Click Add a permission.
  3. Select Microsoft Graph.
  4. Select Delegated Permissions.
  5. Add the following scopes:
    1. offline_access
    2. User.Read
    3. Calendars.ReadWrite (if calendar actions are needed)
    4. Mail.Send (if email actions are needed)

Depending on the type of your Organizational settings in Azure, this last step of enabling scopes may be omitted.

Configure an Outlook calendar action

Before you begin, make sure the following is completed: a Google Cloud administrator has completed the steps in Set up authentication and permissions for Outlook email and provided you with the following:

  • Client ID
  • Client secret
  • Tenant ID (called Instance ID on the API)

Configure Outlook email actions using the API

The following instructions can be used to configure both Outlook email and calendar actions. If you've already configured Outlook email actions, then you don't need to perform these steps again.

To add actions to your app using the API, do the following.

  1. Create an Outlook connector for actions:

    SERVER=https://discoveryengine.googleapis.com
    curl -X POST \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    -H "Content-Type: application/json" \
    -H "X-GFE-SSL: yes" \
    -H "X-Goog-User-Project: PROJECT_NUMBER" \
    "$SERVER/v1alpha/projects/PROJECT_NUMBER/locations/global:setUpDataConnector" \
    -d '{
      "collectionId": "PROJECT_NUMBER",
      "collectionDisplayName": "YOUR_COLLECTION_DISPLAY_NAME",
      "dataConnector": {
        "dataSource": "outlook",
        "params": {
          "instance_id": "INSTANCE_ID",
        "client_id": "CLIENT_ID",
        "client_secret": "CLIENT_SECRET"
        },
        "actionConfig": {
          "isActionConfigured": true,
          "actionParams": {
            "client_id": "CLIENT_ID",
            "client_secret": "CLIENT_SECRET",
            "instance_id": "INSTANCE_ID",      }
        },
        "refreshInterval": "86400s",
        "entities": [
          {
            "entityName": "mail"
          },
          {
            "entityName": "mail-attachment"
          },
    {
            "entityName": "calendar"
          },
      {
            "entityName": "contact"
          }
        ],
        "syncMode": "PERIODIC",
      }
    }'
    
  2. Enable Outlook actions for your assistant.

    You can associate the new data connector with your assistant on the UI. You need the following API command to enable your Outlook actions:

    SERVER=https://discoveryengine.googleapis.com
    PROJECT_NUMBER={YOUR PROJECT_NUMBER}
    ENGINE_ID="{YOUR ENGINE ID}"
    CONNECTOR_ID="{THE CONNECTOR'S COLLECTION ID YOU GENERATED IN PREVIOUS STEP}"
    
    curl -X PATCH \
      -H "Authorization: Bearer $(gcloud auth print-access-token --project "${PROJECT_NUMBER}")" \
      -H "Content-Type: application/json" \
      -H "X-Goog-User-Project: ${PROJECT_NUMBER}" \
      "$SERVER/v1alpha/projects/${PROJECT_NUMBER}/locations/global/collections/default_collection/engines/${ENGINE_ID}/assistants/default_assistant?update_mask=enabledActions" \
      -d '{
        "name": "projects/'"${PROJECT_NUMBER}"'/locations/global/collections/default_collection/engines/'"${ENGINE_ID}"'/assistants/default_assistant",
        "enabledActions": {
          "projects/'"${PROJECT_NUMBER}"'/locations/global/collections/'"${CONNECTOR_ID}"'/dataConnector": {
            "actionInfo": [
              {
                "actionName": "send_email",
                "actionDisplayName": "Send Email"
              },
              {
                "actionName": "create_calendar_event",
                "actionDisplayName": "Create Calendar Event"
              }
            ]
          }
        }
      }'
    

After you add actions, the assistant can perform those actions on behalf of your end users in the app. The first time a user asks the assistant to perform an Outlook action, they are asked to authorize access to their Outlook account. To use the assistant, users must have Agentspace Enterprise Plus licenses.