Skip to content

Add follow-up question support to Teams request action#2398

Merged
ravikiranvm merged 3 commits into
mainfrom
add-follow-up-question-to-teams-request-action
Jul 15, 2026
Merged

Add follow-up question support to Teams request action#2398
ravikiranvm merged 3 commits into
mainfrom
add-follow-up-question-to-teams-request-action

Conversation

@ravikiranvm

@ravikiranvm ravikiranvm commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Part of OPS-4626

Adds an opt-in "follow-up question" capability to the Microsoft Teams Request Action block: any action button can now ask the person a question in the browser before the workflow resumes, and the workflow receives the typed answer.

What's new

Screenshot 2026-07-14 at 6 19 55 PM Screenshot 2026-07-14 at 6
  • Three optional properties per action button:
    • Follow-up question — if set, clicking the button opens a small OpenOps-hosted page asking this question instead of resuming immediately
    • Answer format — Text / Email / Number (validated on the page)
    • No answer option — text for a secondary choice (e.g. "I don't know"); choosing it resumes with an empty answer
  • The answer is surfaced in the step output as parameters.answer (all non-routing resume query params are exposed under parameters)
  • New generic page collect_input.html renders the question (with the card header as the page title), validates the answer, and fires the existing flow-run resume URL with the answer appended

Why

Teams Adaptive Cards sent via the Graph API support only Action.OpenUrl — collecting typed input natively (Action.Submit / Action.Execute / dialogs) requires a bot or Teams app installed in the tenant. This rides the existing capability-URL button mechanism instead: no new permissions, no new endpoints.

Example use case: a notification recipient reports "I'm not the owner of this resource" and provides the correct owner's email, which the workflow then acts on.

Safety

  • Buttons without a follow-up question are untouched (same wrapper page, same output shape plus an empty parameters)
  • The form page only fires same-origin redirect targets matching the flow-run resume path shape
  • Prototype-pollution keys are excluded from parameters
  • Client-side validation is convenience only, consuming workflows should re-validate the answer server-side, since resume URLs are capability URLs

Buttons on the Microsoft Teams Request Action message can now optionally
ask the recipient a follow-up question in the browser before the workflow
resumes. The typed answer is validated by format (text/email/number) and
surfaced in the step output as parameters.answer; an optional no-answer
choice resumes with an empty answer. Buttons without a follow-up question
behave exactly as before.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 14, 2026 13:58
@linear

linear Bot commented Jul 14, 2026

Copy link
Copy Markdown

OPS-4626

Comment thread packages/blocks/microsoft-teams/test/on-action-received.test.ts Fixed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds opt-in “follow-up question” support to the Microsoft Teams Request Action block by routing selected button clicks through a new collect_input.html page that gathers/validates an answer and then resumes the flow run, surfacing non-routing resume query params under parameters in step output.

Changes:

  • Introduces collect_input.html and a buildWrapperUrl() helper to generate either the existing resume wrapper URL or the new input-collection URL.
  • Extends Teams action/button types and the Request Action action props to include follow-up question + answer format + no-answer option.
  • Updates resume handling to expose extra resume query params as parameters (excluding routing and prototype-pollution keys), with new unit tests.

Blocking

  • collect_input.html rejects valid resume URLs generated by the platform due to an overly strict path regex and origin check (breaks follow-up-question flow in common configurations).

Non-blocking

  • Number validation currently treats Infinity as valid numeric input.

Merge recommendation

  • Do not merge

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/react-ui/public/html/collect_input.html New static page to collect/validate an answer and resume the flow run with answer query param.
packages/blocks/microsoft-teams/src/lib/common/build-wrapper-url.ts New helper to build wrapper URLs for either resume-only or follow-up-question flows.
packages/blocks/microsoft-teams/src/lib/actions/request-action-message.ts Adds new optional props per button and uses buildWrapperUrl() when generating button URLs.
packages/blocks/microsoft-teams/src/lib/common/on-action-received.ts Surfaces non-routing resume query params as parameters and excludes prototype-pollution keys.
packages/blocks/microsoft-teams/src/lib/common/generate-message-with-buttons.ts Extends Teams action type to carry follow-up-related optional fields.
packages/blocks/microsoft-teams/test/build-wrapper-url.test.ts New unit tests covering wrapper URL generation for follow-up options.
packages/blocks/microsoft-teams/test/on-action-received.test.ts Updates/extends tests to assert parameters passthrough and pollution-key exclusion.

Comment thread packages/react-ui/public/html/collect_input.html
Comment on lines +192 to +197
const url = new URL(value);
const isSameOrigin = url.origin === window.location.origin;
if (!isSameOrigin || !RESUME_PATH_REGEX.test(url.pathname)) {
return null;
}
return url;
Comment thread packages/react-ui/public/html/collect_input.html
Use a null-prototype object in the prototype-pollution test so suspicious
keys are own properties, matching how query strings are parsed at runtime,
and validate number answers with Number.isFinite to reject infinities.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Comment thread packages/blocks/microsoft-teams/test/on-action-received.test.ts Fixed
Same own-property semantics, but unambiguous to static analysis.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

Comment thread packages/blocks/microsoft-teams/test/on-action-received.test.ts Dismissed
@ravikiranvm
ravikiranvm requested a review from MarceloRGonc July 15, 2026 06:21
@ravikiranvm
ravikiranvm merged commit 485713b into main Jul 15, 2026
21 checks passed
@ravikiranvm
ravikiranvm deleted the add-follow-up-question-to-teams-request-action branch July 15, 2026 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants