Repository navigation
Add follow-up forms to Slack and Teams Request Action buttons - #2702
Conversation
A button in the Slack or Microsoft Teams Request Action step can now open a form with several fields, described by one JSON setting, followUpForm. Each answer returns to the flow as parameters.<field name>. The setting replaces the three single-question settings (follow-up question, answer format, no answer option). Flows that still send those values keep working: they are converted to a one-field form answered as parameters.answer, and links from messages already sent still open. The form travels in the button link. The Slack step fails with a clear error when a link would exceed Slack's 3,000-character limit, instead of Slack rejecting the whole message. Co-Authored-By: Claude Fable 5.2 <[email protected]>
Call parseField through an explicit callback, and use the constructs SonarCloud prefers in the form page (sets, replaceAll, codePointAt, before). Co-Authored-By: Claude Fable 5.2 <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
Valid dropdown selections can be rejected by the free-text length limit, and large encoded answers can trigger HTTP 414 while falsely reporting success and leaving the workflow paused.
2 open issues
What changed in this PR
Adds multi-field follow-up forms to Slack and Microsoft Teams Request Action buttons, using a shared form definition and the existing browser-based workflow resume flow.
Changes:
- Replaces three button settings with one JSON form setting while preserving legacy questions and links.
- Adds five field types, optional fields, hints, skip controls, and field-level validation.
- Adds Slack button-link length checks and tests for parsing, links, rendering, and both integrations.
Blocking: Two required fixes remain.
Non-blocking: None.
Merge recommendation: Do not merge
| File | Description |
|---|---|
packages/react-ui/public/html/collect_input.html |
Renders and validates multi-field forms while supporting legacy links. |
packages/openops/test/follow-up-form.test.ts |
Tests form parsing and legacy button conversion. |
packages/openops/test/collect-input-page.test.ts |
Tests rendering, validation, submission, and compatibility. |
packages/openops/test/build-wrapper-url.test.ts |
Tests encoded form links and title truncation. |
packages/openops/src/lib/follow-up-form.ts |
Defines shared form types, validation, encoding, and button settings. |
packages/openops/src/lib/build-wrapper-url.ts |
Builds form links with encoded definitions. |
packages/openops/src/index.ts |
Exports shared form utilities. |
packages/blocks/slack/test/request-action-message.test.ts |
Tests form buttons, compatibility, and oversized-link rejection. |
packages/blocks/slack/src/lib/common/props.ts |
Exposes the new JSON form setting. |
packages/blocks/slack/src/lib/actions/request-action-message.ts |
Resolves forms and enforces Slack’s button-link limit. |
packages/blocks/microsoft-teams/test/request-action-message.test.ts |
Tests plain, legacy, and form buttons. |
packages/blocks/microsoft-teams/src/lib/common/generate-message-with-buttons.ts |
Uses shared button form types. |
packages/blocks/microsoft-teams/src/lib/actions/request-action-message.ts |
Exposes form settings and generates form links. |
Review effort: Balanced
| Object.entries(answers).forEach(([name, value]) => { | ||
| target.searchParams.set(name, value); | ||
| }); |
There was a problem hiding this comment.
Valid, and the numbers match what I measured: one text area with 1,000 CJK characters makes a request of about 9,200 characters, two make about 18,200, against the 16,384 limit in our nginx templates. With Latin text, 1,000 characters is about 1,200.
Leaving this as is for now. The risk is low and accepted: it needs two text areas filled to the limit with non-Latin text, and no form we plan has more than one text area. It is also one case of a broader, existing limitation, that the page does not check the server's reply before saying the response was recorded. That is better solved as a whole than with a size guard here.
| } | ||
|
|
||
| // The message-button setting in the Slack and Teams "Request Action" steps. | ||
| export const followUpFormProperty = Property.Json({ |
There was a problem hiding this comment.
[RISK] If the JSON in followUpForm doesn't parse, the form is dropped without any error.
- The builder's JSON editor saves invalid JSON as the raw string (
tryParseJson), and the form schema accepts any string. - At run time the engine's
jsonProcessorlogs a warning and returnsundefined. The property isn't required, so validation passes. resolveButtonFormthen treats the setting as empty, and the button resumes the flow without asking anything.
So a typo such as a trailing comma silently disables the form, which contradicts "an invalid form fails the step".
Fix: use a LongText property (or accept a string here) and call JSON.parse inside resolveButtonForm/parseFollowUpForm. On failure, throw Invalid follow-up form: not valid JSON. Add a test for a malformed string.
There was a problem hiding this comment.
Valid as described: unparseable JSON is saved as text by the builder and dropped by the engine, so the button is sent without a form.
Leaving this as is. The risk is low and accepted:
- The builder's JSON editor underlines a syntax error in red when it is typed (checked on staging).
- A full run of the workflow shows the problem at once, because the button resumes the flow without opening a form.
- Forms produced by a code step are objects, not text, so they are not affected.
Switching the setting to plain text would lose the JSON editor and make references inside the form fragile. The cleaner fix is for the engine to fail a step on unparseable JSON in any JSON setting, which is a product-wide change and out of scope here.
Claude PR Review — #2702: Add follow-up forms to Slack and Teams Request Action buttonsAuthor: ravikiranvm | Base: VerdictSHIP WITH CARE — the code is correct and well tested. Follow the deploy order in the description: release the app before or together with the worker. SummaryThis PR replaces the three single-question button settings with one Older setups keep working:
Overall risk is low. The change touches only the two Request Action blocks, the shared helper in What I checked and found sound:
FindingsNo new findings at confidence ≥ 75. Already covered by other reviewers
Testing gapsNone blocking. As the PR states, Slack with interactions enabled was not tested end to end, and neither were the old three values in a live Teams message. |
A dropdown value comes from the configured list and cannot be shortened by the recipient, so a long option was rejected on submit. Co-Authored-By: Claude Fable 5.2 <[email protected]>
|




Part of OPS-5060.
What changes for users
parameters.<field name>.Example:
{ "title": "Why are you dismissing this?", "fields": [ { "name": "reason", "label": "Reason", "type": "select", "options": ["Still in use", "Scheduled for decommissioning", "Other"] }, { "name": "comment", "label": "Comment", "type": "textarea", "required": false, "hint": "Add any details that help us follow up" } ] }Existing flows keep working
parameters.answer.Deployment note
Deploy the app together with or before the worker. New messages use a link format that the previous form page cannot read, so with a new worker and an old app, form buttons show "This link is invalid" until the app is updated.
Alternatives considered
Testing
Docs: openops-cloud/docs#357 (draft until this is released).