# Surfaces

> Slack and Microsoft Teams for AI employees (M5b, product.md 7.2, 8.2, 11.14): 24 endpoints of the Teemli API.

Source: https://docs.teemli.com/developers/reference/surfaces/

Generated from [`api/openapi.yaml`](/developers/api/) (OpenAPI 3.1). Base URL: `https://api.teemli.com`. Auth: `Authorization: Bearer <token or tml_ API key>`. Errors are `application/problem+json`; writes accept an `Idempotency-Key` header.

Slack and Microsoft Teams for AI employees (M5b, product.md 7.2, 8.2, 11.14). Admins connect a Slack workspace
(OAuth v2) or a Microsoft tenant (Microsoft sign-in) to the organisation, once; a workspace/tenant belongs to one
organisation. People link their Slack/Microsoft account once (never by email). Messages that name an AI employee
shared with the sender start a normal turn in that person's own conversation for the thread; replies and cards are
posted back in the thread as the AI employee, labelled AI. Webhooks are signature/JWT-checked (`/v1/surfaces/*`).

## How an AI employee appears in Slack and Teams

```http
GET /v1/orgs/{org}/agents/{agent}/presence
```

`slack {connected, workspaces[], display_name, how, own_app {app_id, status}|null}`, `teams {connected, display_name, how}`; both null for personal agents (never on Slack/Teams).

**API keys:** needs the `agents:read` scope.

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `agent` (required) | path | string (uuid) |  |

**Responses**

- `200` Presence — object

## Slack workspaces, AI employees' own Slack apps and Teams tenants connected to the organisation

```http
GET /v1/orgs/{org}/integrations
```

`{is_admin, slack {configured, socket_mode, app_id, workspaces[], employee_apps[] (admins), public_events}, teams {configured, app_id, tenants[], messaging_endpoint}, employees[] (admins)}`. Tokens are never returned.

**API keys:** not available (needs a person signed in to the app).

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |

**Responses**

- `200` Integrations — object

## Start connecting a Slack workspace (admins) — returns Slack's OAuth v2 URL

```http
POST /v1/orgs/{org}/integrations/slack/install
```

**API keys:** not available (needs a person signed in to the app).

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |

**Responses**

- `200` {url} — object
- `403` Authenticated but not allowed (e.g. unverified email, not the agent's controller, card routed to someone else) — Problem

## Disconnect a workspace (admins); the bot token is revoked and deleted

```http
DELETE /v1/orgs/{org}/integrations/slack/workspaces/{id}
```

**API keys:** not available (needs a person signed in to the app).

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `id` (required) | path | string (uuid) |  |

**Responses**

- `204` Disconnected

## Save a Slack app configuration token (its refresh token, `xoxe-…`) for AI employees' own apps (admins)

```http
PUT /v1/orgs/{org}/integrations/slack/workspaces/{id}/config-token
```

Rotated at once (proving it works); the pair lives in OpenBao and is rotated before its 12-hour expiry.

**API keys:** not available (needs a person signed in to the app).

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `id` (required) | path | string (uuid) |  |

**Request body** (JSON)

| Field | Type | Description |
|---|---|---|
| `refresh_token` (required) | string |  |

**Responses**

- `200` {config_token, config_expires_at} — object
- `422` Invalid input — Problem

## Create an AI employee's own Slack app with the App Manifest API (admins)

```http
POST /v1/orgs/{org}/integrations/slack/employee-apps
```

**API keys:** not available (needs a person signed in to the app).

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |

**Request body** (JSON)

| Field | Type | Description |
|---|---|---|
| `agent_id` (required) | string (uuid) |  |

**Responses**

- `201` {id, install_url}: a Slack admin approves the app there — object
- `409` Conflicting state (card already answered, duplicate in flight, name taken) — Problem

## Delete an AI employee's own Slack app (apps.manifest.delete)

```http
DELETE /v1/orgs/{org}/integrations/slack/employee-apps/{id}
```

**API keys:** not available (needs a person signed in to the app).

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `id` (required) | path | string (uuid) |  |

**Responses**

- `204` Deleted

## A fresh approval URL for an AI employee's own app

```http
POST /v1/orgs/{org}/integrations/slack/employee-apps/{id}/install-url
```

**API keys:** not available (needs a person signed in to the app).

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `id` (required) | path | string (uuid) |  |

**Responses**

- `200` {install_url} — object

## Start connecting a Microsoft tenant (admins sign in with Microsoft) — returns the sign-in URL

```http
POST /v1/orgs/{org}/integrations/teams/connect
```

**API keys:** not available (needs a person signed in to the app).

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |

**Responses**

- `200` {url} — object

## Disconnect a Microsoft tenant (admins)

```http
DELETE /v1/orgs/{org}/integrations/teams/tenants/{id}
```

**API keys:** not available (needs a person signed in to the app).

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `id` (required) | path | string (uuid) |  |

**Responses**

- `204` Disconnected

## The Teams app package (manifest.json + icons) to upload in Teams (admins)

```http
GET /v1/orgs/{org}/integrations/teams/package.zip
```

**API keys:** not available (needs a person signed in to the app).

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |

**Responses**

- `200` The zip

## My linked Slack/Teams accounts (only mine; admins can't see them)

```http
GET /v1/orgs/{org}/linked-accounts
```

**API keys:** not available (needs a person signed in to the app).

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |

**Responses**

- `200` {accounts[], slack {configured, workspaces[]}, teams {configured, connected}} — object

## Unlink

```http
DELETE /v1/orgs/{org}/linked-accounts/{id}
```

**API keys:** not available (needs a person signed in to the app).

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `id` (required) | path | string (uuid) |  |

**Responses**

- `204` Unlinked

## “Sign in with Slack” (OpenID Connect) — returns Slack's URL; `token` answers the waiting message after linking

```http
POST /v1/orgs/{org}/linked-accounts/slack/start
```

**API keys:** not available (needs a person signed in to the app).

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |

**Request body** (JSON)

| Field | Type | Description |
|---|---|---|
| `token` | string |  |
| `team` | string |  |

**Responses**

- `200` {url} — object

## One-click link from the prompt in Slack

```http
POST /v1/orgs/{org}/linked-accounts/slack/confirm
```

The link can be forwarded, so holding it proves nothing about who is signed in to Teemli.
It links only when that Slack account's confirmed email (`users:read.email`) is the
signed-in person's own; otherwise 403 and the person uses “Sign in with Slack”. Single use.

**API keys:** not available (needs a person signed in to the app).

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |

**Request body** (JSON)

| Field | Type | Description |
|---|---|---|
| `token` (required) | string |  |

**Responses**

- `200` {linked, team_name, answered} — object
- `403` Authenticated but not allowed (e.g. unverified email, not the agent's controller, card routed to someone else) — Problem
- `409` Conflicting state (card already answered, duplicate in flight, name taken) — Problem

## Who a link from Slack/Teams would link, shown before linking (doesn't use the link up)

```http
GET /v1/orgs/{org}/linked-accounts/{surface}/pending
```

**API keys:** not available (needs a person signed in to the app).

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |
| `surface` (required) | path | `slack`, `teams` |  |
| `token` (required) | query | string |  |

**Responses**

- `200` The Slack or Teams user who wrote — object
- `403` Authenticated but not allowed (e.g. unverified email, not the agent's controller, card routed to someone else) — Problem
- `409` Conflicting state (card already answered, duplicate in flight, name taken) — Problem

## “Sign in with Microsoft” to link a Teams account — returns the sign-in URL

```http
POST /v1/orgs/{org}/linked-accounts/teams/start
```

**API keys:** not available (needs a person signed in to the app).

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |

**Request body** (JSON)

| Field | Type | Description |
|---|---|---|
| `token` | string |  |

**Responses**

- `200` {url} — object

## Slack Events API (shared app). Signed with HMAC-SHA256 (X-Slack-Signature, 5-minute window); answers url_verification

```http
POST /v1/surfaces/slack/events
```

**Auth:** none (public endpoint).

**Responses**

- `200` Acknowledged (work happens in the background)
- `401` Bad or stale signature

## Slack Events API for an AI employee's own app (its own signing secret)

```http
POST /v1/surfaces/slack/events/{agent}
```

**Auth:** none (public endpoint).

| Parameter | In | Type | Description |
|---|---|---|---|
| `agent` (required) | path | string (uuid) |  |

**Responses**

- `200` Acknowledged
- `401` Bad signature

## Slack interactivity (button clicks, form-encoded `payload=`), signed like events

```http
POST /v1/surfaces/slack/interactivity
```

**Auth:** none (public endpoint).

**Responses**

- `200` Acknowledged
- `401` Bad signature

## Interactivity for an AI employee's own app

```http
POST /v1/surfaces/slack/interactivity/{agent}
```

**Auth:** none (public endpoint).

| Parameter | In | Type | Description |
|---|---|---|---|
| `agent` (required) | path | string (uuid) |  |

**Responses**

- `200` Acknowledged

## Slack OAuth/OpenID callback (install, link, AI employee app); hands off to the web app

```http
GET /v1/surfaces/slack/oauth/callback
```

Does nothing itself; redirects to `/oauth/finish/slack?…` in the web app, which calls `POST /v1/me/oauth/slack/finish` as the signed-in person.

**Auth:** none (public endpoint).

**Responses**

- `303` Redirect to the web app's /oauth/finish/slack

## Bot Framework activities. Bearer JWT checked against the Bot Framework OpenID keys (iss, aud, exp, serviceUrl, endorsement)

```http
POST /v1/surfaces/teams/messages
```

`invoke` (`adaptiveCard/action`) is answered synchronously with the replaced card.

**Auth:** none (public endpoint).

**Responses**

- `200` Acknowledged, or the invoke response
- `401` Bad or missing token

## Microsoft sign-in callback (connect a tenant, link an account); hands off to the web app

```http
GET /v1/surfaces/teams/oauth/callback
```

Does nothing itself; redirects to `/oauth/finish/teams?…`, finished with `POST /v1/me/oauth/teams/finish`.

**Auth:** none (public endpoint).

**Responses**

- `303` Redirect to the web app's /oauth/finish/teams
