Tendkit

Search documentation

Find a docs page

Get Started

Microsoft 365

A shared or user mailbox through Microsoft Graph, scoped to one mailbox.

Install

Terminal
npx shadcn@latest add @tendkit/channel-microsoft365

It lands in lib/support/channels/. Import microsoft365Channel from there.

Set up

  1. Register an app

    Entra admin center → App registrations → New registration (single tenant). Copy the tenant and client ids and add a client secret.

  2. Scope it to one mailbox

    Don't grant Mail.* permissions in Entra: a tenant-wide grant overrides any scoping. Use Exchange RBAC for Applications instead, giving the app Application Mail.ReadWrite and Application Mail.Send on a management scope that contains only the support mailbox. Changes can take up to two hours.

  3. Shared mailboxes

    So replies agents send from Outlook with Send As reach the ticket, run Set-Mailbox support@acme.com -MessageCopyForSentAsEnabled $true -MessageCopyForSendOnBehalfEnabled $true.

  4. Optional push

    Set notificationUrl to the channel's webhook URL and clientState to a long random secret. Run runScheduled() either way: it creates and renews the subscription and sweeps the mailbox, since Graph can drop notifications.

Configure

lib/support/index.ts
microsoft365Channel({
  id: "email",
  tenantId: process.env.MS_TENANT_ID!,
  clientId: process.env.MS_CLIENT_ID!,
  clientSecret: process.env.MS_CLIENT_SECRET!,
  mailbox: "support@acme.com",
  notificationUrl: "https://acme.com/api/webhooks/support/email",
  clientState: process.env.MS_CLIENT_STATE!,
})

Options

NameTypeDescription
id*stringStable channel id, stored on every ticket and used in the webhook URL. Never change it.
tenantId*stringDirectory (tenant) id of the tenant that owns the mailbox.
clientId*stringApplication (client) id.
clientSecret*stringThe app's client secret.
mailbox*stringThe user or shared mailbox to read and send from.
notificationUrlstringPublic webhook URL for change notifications. Omit to poll only.
clientStatestringSecret Graph echoes in every notification. Required with notificationUrl.
baseUrlstringMicrosoft Graph base URL, for national clouds.

Behaviour

  • Replies your team sends from Outlook are recorded on the ticket from Sent Items. Junk Email is never read.
  • Mail goes out as the mailbox itself, so it uses the mailbox's display name rather than fromName.