Feature: External Submission
User Need
Pages that live outside the Teams app — a feedback widget, a contact form, an external form of any kind — need a way to drop a message into a Teams inbox without their visitors ever opening Teams.
These callers run on a different origin and authenticate against a different issuer than the Teams app itself. Some submissions should be attributed to the person who sent them; others should be anonymous even though the visitor was signed in; others carry contact details the visitor typed about themselves. The inbox that collects submissions is a triage inbox owned by a small group — not something the submitter is a member of.
This feature is the API capability that makes that possible, safely. It generalizes the existing in-app Feedback Submission bypass from a single hard-coded inbox to an allowlist of inboxes reachable from trusted external origins.
User Stories
- As a presentation viewer, I want to send feedback from the slides page without signing into Teams, and choose whether my name is attached.
- As a site owner embedding a contact form, I want submissions to land in a designated Teams inbox using one general capability, not a bespoke endpoint.
- As a triage-team member, I want external submissions to appear as normal threads in my inbox, with whatever context the caller chose to include.
- As an operator, I want to opt specific inboxes into external submission per environment, and keep the feature dormant everywhere I have not.
- As a security-conscious operator, I want the endpoint to require a real token from a trusted issuer — never just a trusted origin — and to be rate-limited.
Concrete Scenarios
Scenario A — Anonymous feedback: A viewer on the presentations site rates a deck and types a comment with the "send anonymously" toggle on (the default). The widget already has the viewer signed in via Keycloak, so the request carries a valid token. Teams accepts it, sees from: null, and creates an unattributed thread in the triage inbox. The triage team sees the rating and comment but no author.
Scenario B — Attributed feedback: The same viewer turns the toggle off. The widget omits from. Teams derives the author's email and display name from the token claims (not from the request body) and attributes the thread to them.
Scenario C — Contact form with self-declared sender: A visitor fills in a contact form (name, email, message). The page posts with a client-credentials token from a trusted issuer — there is no signed-in user — and includes from: { displayName, email } carrying what the visitor typed. Teams stores it as a declared, unverified contact (never as an OX identity), so the triage team can reply but the thread is clearly badged as external/unverified. No user scope is required.
Scenario D — Feature disabled: In a deployment where no inbox has been opted into external submission, the endpoint rejects every submission. Nothing is routed anywhere by default.
Scenario E — Abuse attempt: A script hammers the endpoint with a valid token. After the per-principal limit is exceeded (default 2/minute) the endpoint returns 429, and oversized subjects/messages are rejected by the schema before any insert.
Design
Endpoint and contract
POST /api/threads/:inboxId/submissions with body:
- subject — required, ≤ 200 chars
- message — required, Markdown, ≤ 5000 chars of source. Rendered to HTML server-side (
markdown-it, raw HTML disabled); inline images and attachments are deferred to a later feature - from — optional, three modes (see Attribution below): omitted → attribute from the authenticated principal;
null→ anonymous;{ displayName, email }→ the submitter's self-declared contact (unverified). In declared modeemailis optional and may be empty (not validated).id/contextare never accepted.
Structured caller context (rating, slug, title) is not part of v1 — there is no place to display it in the Teams app yet, so callers put any such context in message. A typed context field can follow once it has a consumer.
Authentication, not just origin
The request must carry a valid token from a trusted issuer. This is the only security boundary; a trusted origin (CORS) is not — any non-browser client can forge an origin header. Both a user token (e.g. presentations' PKCE public client) and an application token are accepted. Unlike the rest of the API, this route does not require OX user claims (userId/contextId) or a Teams session — external principals have neither; the token only needs to be valid and from a trusted issuer. When configured, the token's client (azp/aud) must be on the accepted-client allowlist. See ADR-0021.
Untrusted content
A message from an external page is untrusted input, and the comment view renders it via v-html. It is Markdown, rendered to HTML server-side with markdown-it configured with raw HTML disabled — so any HTML in the source is escaped rather than emitted, and a submission cannot inject script that runs when the triage team opens the thread. Inline images and attachments are deferred to a later feature, keeping the v1 surface small.
Inbox allowlist
A submission is only accepted for an inbox the operator has opted in, and that inbox must exist. All other inboxes continue to enforce membership; this bypass is scoped to the allowlist only.
Attribution decoupled from auth
Whether and how a thread is attributed is the caller's choice, independent of the fact that the request was authenticated. The key distinction is OX identity (id/context, never accepted from a client — that would be impersonation) vs. contact info (free-text name/email, just content like an email From: line). Three modes:
- authenticated (
fromomitted) — author email + display name derived from the token; marked verified. - anonymous (
from: null) — no contact; a language-neutral sentinel is stored and the UI localizes the "Anonymous" label. - declared (
from: { displayName, email }) — the submitter's self-provided contact, stored as unverified and badged as external in the UI. This is the contact-form case.
Acceptance Criteria
- When no inbox is opted into external submission, every submission is rejected.
- A submission with a valid trusted-issuer token to an allowlisted, existing inbox creates a thread (
201). from: nullcreates an anonymous thread (no author attribution);fromomitted attributes the thread from the token claims (verified);from: { displayName, email }stores a declared, unverified contact badged as external. In every mode, bodyid/contextare stripped and never persisted.- A request without a valid token is rejected (
401); a valid token whose client is not allowed, or whose target inbox is not allowlisted, is rejected (403); an allowlisted but non-existent inbox returns404. - The
userscope is not required; application/client-credentials tokens from a trusted issuer are accepted. - Subject and message length caps are enforced; oversized input is rejected (
400) before any DB write. messageis rendered from Markdown to HTML; raw HTML in the source is escaped.- Repeated submissions beyond the configured rate are rejected (
429). - Author identity is always derived server-side or anonymized — client-supplied
id/contextare never persisted. - Anonymous threads display a localized "Anonymous" label in the Teams UI.
Edge Cases
- Token from an untrusted issuer: rejected by global JWT verification before the route runs.
- Inbox opted in but deleted: returns
404; nothing is silently mis-routed. - Metadata over the size cap: rejected by the schema (
400). - Raw HTML in
message: escaped by the Markdown renderer (not emitted); the thread is still created from the rendered content. - Whitespace-only subject/message: trimmed and treated as empty →
400. - Client behind ingress: rate limiting uses the forwarded client IP (requires
trustProxy).
Out of Scope
- A UI in Teams for this endpoint (callers bring their own page/widget).
- Email notifications to the triage team (they see new threads normally).
- Follow-up conversation back to the external submitter.
- Structured caller context / metadata (deferred until it has a UI consumer; callers fold context into
messagefor now). - Inline images and file attachments (planned as a later, dedicated attachments feature; v1
messageis Markdown text only).
Configuration
| Variable | Purpose |
|---|---|
EXTERNAL_SUBMISSION_INBOX_IDS | Comma-separated inbox ids that accept external submissions. Unset = dormant. |
EXTERNAL_SUBMISSION_CLIENTS | Optional accepted token azp/client_id allowlist. |
ISSUER_ALLOWLIST | Operator adds the external issuer so its tokens validate. |
ORIGINS | Should be a real allowlist (not *) when this feature is enabled. |
The existing in-app feedback path keeps its own FEEDBACK_INBOX_ID for now. It is a special case of this capability and is a candidate to fold into this endpoint in a later refactor.
Related
- ADR-0021: External Submission Endpoint
- Feedback Submission — the in-app path this generalizes

