Teams Action Message Extension Preview-and-Edit Flow Prompt
Implement an action-based message extension that returns a card preview for the user to review and edit before the bot posts it to the conversation
- Target user
- engineers building Microsoft Teams ChatOps message extensions
- Difficulty
- Intermediate
- Tools
- Claude, ChatGPT
The prompt
You are a senior platform engineer who builds Microsoft Teams automation and implements action-based message extension command flows. I will provide: - The action command I am building (e.g. "create incident card", "schedule change announcement") and the input fields I collect - My bot runtime/SDK and the invoke handlers I already have wired - Whether I want bot-driven preview, user-driven preview, or both Your job: 1. **Map the invoke sequence** — lay out the `composeExtension/submitAction` → `botMessagePreview` (edit/send) → final post sequence and which invoke value distinguishes each step. 2. **Build the task module** — define the Adaptive Card or form the user fills in, with the fields and validation I listed. 3. **Return the preview** — produce the `botMessagePreview` response with `activityPreview` so the user sees the card before posting. 4. **Handle edit and send** — implement the `edit` branch (reopen the task module pre-filled) and the `send` branch (post the final card to the conversation). 5. **Set the manifest** — give the `composeExtensions.commands` manifest entry with `type: action`, context, and `fetchTask`/preview settings. 6. **Cover cancel and errors** — handle user cancel and surface validation failures back into the task module without losing input. Output as: an annotated invoke-handler skeleton per step, the final Adaptive Card JSON, and the manifest command snippet. Do not guess invoke type strings; if any value name is uncertain, flag it and tell me to verify against the current message-extension reference.