Skip to main content

How to set up Email Notifications? with Microsoft Exchange

The Microsoft exchange integration allows Flametree AI agents to send and receive emails, enabling automated communication with users via MS-Outlook channels. It uses a specific MS Graph API and benefits from the functionality provided by Microsoft.

How to Configure a Microsoft Exchange Integration

  1. Name

    Enter a unique, descriptive name for the connection.

    Example: Support Email Connector

    Choose a name that clearly reflects the integration’s purpose.

  2. Description

    Briefly describe the purpose of this connector.

    Indicate which department or team owns this integration.

Integration type

  • one-direction

    Use this option if you only want to receive e-mails.

  • two-direction

    If you want to reply to incoming emails using an agent or tool invoked, this option should be used.

Action that should be taken on the Micosoft portal

First, you need to configure your MS Outlook box using MS Entra site https://entra.microsoft.com/#home Go there to App Registrations -> Your aplication (Enfint Graph in our example) and get parameters from there. Please remember your client secret when you create the application, it will be used as an access token. images/image_ms_outlook_1.png Add your webhook URI on the Redirect URIs page. The webhook URL should match the pattern https://portal.flametree.ai/email/`id_of_your_flametree_agent_here`/webhook images/image_ms_outlook_2.png In the API permissions tab you should check at least the following permissions to be set (delegated type is preferrable):

- Mail.Read
- Mail.ReadWrite
- MailboxSettings.Read
- Subscription.Read.All
- User.Read
- User.Read.All

Authentication

  • Access token

  • Client id

  • Tenant id These three parameters are get from MS Entra portal https://entra.microsoft.com/#home where your administrator has to set up the parameters beforehand.

  • User id Here you can provide an user id (you can get it at MS Entra portal) or a valid user email address that will be used for communications.

Subscription Prolongation

On the adapter side you should declare a subscription (it has a limited lifetime) and then your webhook will pass notifications from that subscription and one can handle a message. The message content then can be passed to an agent, which session is invocated by the adapter.The default value of querying a subscription status is 1 day, and subscription is prolongated up to 3 days in the future. To prolongate subscription's expiration time a cron was added to the back-end. Schedule is set in cron format using environmental variable

  • CRON_SUBSCRIPTION_RENEWAL=0 0 * * *

    Environment variable for the agent (a technical value, 60 sec is enough to start all sleeping services)

  • SLEEP_TIME = 60 (sec)

Settings for tools

If you also want your tools to benefit from the integration with the MS Outlook, then the foloowing parameters should be set in the agent as environmental variables:

- EMAIL_API_USER_ID
- EMAIL_API_TENANT_ID
- EMAIL_API_CLIENT_ID
- EMAIL_API_ACCESS_TOKEN
- EMAIL_WEBHOOK_URL