Microsoft 365

Connect Microsoft 365

m365_connect · Changes data · Markdown

Connects the company's Microsoft 365 through its own app, for the mailboxes the agent may act as.

Free

This tool costs nothing to call.

An example

Connect our Microsoft 365 for support@ only. Here are the app's tenant and client ID.

Your agent callsm365_connectFree

The example business is Hansen & Voss, a restaurant-equipment wholesaler in Hamburg with 60 staff. The reply is the one the tool really gives.

With these arguments
{
  "tenant_id": "hansenvoss.onmicrosoft.com",
  "client_id": "6b1f0c2e-example-app",
  "mailboxes": [
    "support@hansenvoss.example"
  ]
}
What comes back
{
  "link": "https://conecto.chat/api/bots/connect/zVrBJCbAXQ9S54yrqQQH5FkS1WE9jFEGuzxo8tF0-IM",
  "expires_in_minutes": 60,
  "tell_the_owner": "Open this link within the hour, sign in to Conecto and type the Microsoft Entra app's client secret there. It goes to Conecto only; I never see it.",
  "from_a_terminal": "npx @conecto-chat/cli@latest run m365_connect -i '{\"tenant_id\": \"hansenvoss.onmicrosoft.com\", \"client_id\": \"6b1f0c2e-example-app\", \"mailboxes\": [\"support@hansenvoss.example\"]}' -s secret",
  "from_a_terminal_with_curl": "printf %s 'Client secret: '; read -rs v1; echo; curl -sS -H \"Authorization: Bearer $CONECTO_KEY\" --data-urlencode secret@<(printf %s \"$v1\") https://conecto.chat/api/bots/connect/zVrBJCbAXQ9S54yrqQQH5FkS1WE9jFEGuzxo8tF0-IM; unset v1",
  "next": "When the owner types it on the link, account.credential_added (account_events) says so, with what m365_connect answered."
}

Use it when

The company uses Outlook and OneDrive and wants the agent to work in them there.

What it does

Connect the company's own Microsoft 365 so the agent works in its Outlook mail, calendars and OneDrive files, which stay the source of truth. The company registers an app in Microsoft Entra ID with the application permissions Mail.ReadWrite, Mail.Send, Calendars.ReadWrite and Files.ReadWrite.All, and its admin consents. Give its tenant_id and client_id, and the mailboxes the agent may act as (it never acts as anyone else). Called without secret, it answers with a link for the owner, who types the client secret on a Conecto page, so it never passes through the chat (from_a_terminal does the same from a terminal); account.credential_added says when it is connected. Each mailbox is checked before anything is kept. On accounts with an owner, cancelling events and replacing files wait for the owner's approval by default. Free.

What comes back

Without secret: link, a page where the owner or an admin, signed in, types the client secret, with expires_in_minutes, tell_the_owner, from_a_terminal (the CLI), from_a_terminal_with_curl and next. With secret: microsoft365, tenant_id, mailboxes and connected_at; need_approval, the tools that now wait for the owner. Every reply also carries cost_usd and balance_usd.

Inputs

NameTypeWhat it is
tenant_idRequiredstring3 to 120 characters.
client_idRequiredstring3 to 120 characters.
secretstringThe app's client secret. Never shown again. Leave it out to get the link instead. 8 to 2,000 characters.
mailboxesRequiredarray of stringsThe addresses the agent may act as, like support@ and sales@. 1 to 20 items.

The call

Over MCP, call m365_connect on https://api.conecto.chat/mcp/microsoft365. Over REST:

Terminal
curl -X POST https://api.conecto.chat/v1/tools/m365_connect \
  -H "Authorization: Bearer $CONECTO_KEY" \
  -H "Content-Type: application/json" \
  -d '{"tenant_id":"hansenvoss.onmicrosoft.com","client_id":"6b1f0c2e-example-app","mailboxes":["support@hansenvoss.example"]}'

When it refuses

A refused call costs nothing and says what to do next.

CodeWhenWhat to do
invalid_input400A mailbox is not an email address, or none was named.Name 1 to 20 mailboxes.
vendor_rejected502Microsoft refused the tenant, client ID or secret, or a mailbox.Check the app's permissions and the admin's consent.

Give this to your agent.

Set up Conecto from https://conecto.chat/SKILL.md