> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tetherai.ca/llms.txt
> Use this file to discover all available pages before exploring further.

# Handle Outlook (Microsoft Graph) change notification

> Inbound webhook called by Microsoft Graph when a subscribed mailbox receives a new message. On subscription creation Graph performs a validation handshake by sending a `validationToken` query parameter, which the endpoint echoes back as plain text. Notification payloads are accepted with 202 and processed asynchronously.



## OpenAPI

````yaml /api-reference/openapi.yaml post /api/webhook/email/outlook
openapi: 3.0.3
info:
  title: Tether Relay and Tether API
  version: 1.0.0
  description: >-
    Route-derived OpenAPI contract generated from tether-relay backend sources.
    Regenerate with scripts/sync-openapi-from-backend.mjs.
servers:
  - url: https://your-instance.example.com
    description: Production
  - url: http://localhost:2212
    description: Local API service
security: []
tags:
  - name: AI
  - name: Applications
  - name: Approval
  - name: Auth
  - name: Automations
  - name: Calls
  - name: Campaigns
  - name: Contact Analytics
  - name: Contact Metrics
  - name: Contact Notes
  - name: Contacts
  - name: Conversation Monitor
  - name: Conversations
  - name: Departments
  - name: Email
  - name: Escalation Dashboard
  - name: Event Logs
  - name: Google Sheets
  - name: Marketplace
  - name: Messages
  - name: Notification Sounds
  - name: Notifications
  - name: Org Snapshots
  - name: Organizations
  - name: Outreach
  - name: Outreach Metrics
  - name: Outreach Sources
  - name: Pipelines
  - name: Processes
  - name: Prompts
  - name: Reminders
  - name: Sms
  - name: Templates
  - name: Traces
  - name: Training
  - name: Upload
  - name: User Snapshots
  - name: Users
  - name: Vertical
  - name: Webchats
  - name: Webhook
paths:
  /api/webhook/email/outlook:
    post:
      tags:
        - Webhooks
      summary: Handle Outlook (Microsoft Graph) change notification
      description: >-
        Inbound webhook called by Microsoft Graph when a subscribed mailbox
        receives a new message. On subscription creation Graph performs a
        validation handshake by sending a `validationToken` query parameter,
        which the endpoint echoes back as plain text. Notification payloads are
        accepted with 202 and processed asynchronously.
      operationId: post_webhook_email_outlook
      parameters:
        - in: query
          name: validationToken
          required: false
          schema:
            type: string
          description: >-
            Sent by Microsoft Graph during subscription validation. When present
            the endpoint echoes it back as text/plain and skips notification
            processing.
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OutlookWebhookRequest'
      responses:
        '200':
          description: >-
            Validation handshake — the supplied `validationToken` is echoed back
            as plain text.
          content:
            text/plain:
              schema:
                type: string
              example: A1B2C3D4-E5F6-7890-ABCD-EF1234567890
        '202':
          description: >-
            Notification accepted for async processing. Body is the literal text
            `Accepted`.
          content:
            text/plain:
              schema:
                type: string
              example: Accepted
        '500':
          description: Webhook processing failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebhookErrorResponse'
components:
  schemas:
    OutlookWebhookRequest:
      type: object
      description: Microsoft Graph change notification batch.
      properties:
        value:
          description: >-
            Array of change notifications Microsoft Graph batches into one
            request.
          type: array
          items:
            type: object
            properties:
              subscriptionId:
                type: string
                description: >-
                  Graph subscription this notification originates from; maps to
                  the Tether mailbox connection.
              subscriptionExpirationDateTime:
                type: string
                description: >-
                  ISO-8601 timestamp when the Graph subscription expires — used
                  to trigger renewal.
              changeType:
                type: string
                description: Type of change, e.g. `created`, `updated`, `deleted`.
              resource:
                type: string
                description: >-
                  Graph resource path for the changed item (e.g.
                  `Users/{id}/Messages/{id}`).
              resourceData:
                description: >-
                  Lightweight pointer to the changed entity (id + @odata.type);
                  the full message is fetched separately via Graph.
                type: object
                additionalProperties: true
              clientState:
                type: string
                description: >-
                  Opaque token supplied at subscription time and echoed back to
                  verify the notification is genuine.
              tenantId:
                type: string
                description: Azure AD tenant id the mailbox belongs to.
            additionalProperties: true
      additionalProperties: true
      example:
        value:
          - subscriptionId: 7f4b2c1d-9e0a-4b3c-8d5e-6f7a8b9c0d1e
            subscriptionExpirationDateTime: '2026-05-20T15:04:01.135Z'
            changeType: created
            resource: Users/ops@acme.example/Messages/AAMkAGI2T..==
            resourceData:
              '@odata.type': '#Microsoft.Graph.Message'
              '@odata.id': Users/ops@acme.example/Messages/AAMkAGI2T..==
              id: AAMkAGI2T..==
            clientState: tether-outlook-secret
            tenantId: 5f7b1c2e-8a1d-4e00-12c3-b4a55f7b1c2e
    WebhookErrorResponse:
      type: object
      description: >-
        Error envelope used across provider webhook routes. Most failures only
        carry `error`; a few (ElevenLabs tool errors, ingress validation) add
        `success:false`, `message`, or a `code`. Many of these endpoints respond
        200 with `success:false` for recoverable cases (especially the
        ElevenLabs server tools) — only hard failures use 4xx/5xx.
      properties:
        error:
          type: string
        message:
          type: string
        success:
          type: boolean
          enum:
            - false
        code:
          type: string
        details:
          description: Optional diagnostic detail (stack snippet, validation issues, etc.).
      additionalProperties: true
      example:
        error: Webhook processing failed

````