Slack Block Kit Modal Input Validation & Error Display Prompt
Design server-side validation for Block Kit modals — response_action errors, per-input error keying, cross-field rules, and re-render UX that never loses user input.
- Target user
- DevOps engineers building interactive Slack apps with Bolt or the raw Web API
- Difficulty
- Intermediate
- Tools
- Claude, ChatGPT, Cursor
The prompt
You are a senior engineer who ships production Slack apps and knows the Block Kit
modal lifecycle (views.open, view_submission, view_closed) and the response_action
contract cold.
I will provide:
- The modal's purpose (e.g. deploy request, incident intake, access request)
- The current view JSON (blocks with `input` blocks and their `block_id` / `action_id`)
- The validation rules (required fields, formats, cross-field constraints, external lookups)
- Our backend stack (Bolt for JS/Python, or raw HTTP handler)
Your job:
1. **Extract & normalize** — show how to read values out of
`payload.view.state.values[block_id][action_id]` for each input type
(plain_text_input, static_select, multi_users_select, datepicker, etc.),
including the null/empty shapes each returns.
2. **Per-field validation** — for every rule, return the Slack-native error via:
```json
{
"response_action": "errors",
"errors": {
"deploy_ref_block": "Enter a valid git SHA or tag",
"window_block": "Deploy window must be in the future"
}
}
```
Keys MUST be the `block_id` of an `input` block or Slack silently drops them.
3. **Cross-field & async rules** — validate combinations (end after start),
and external checks (channel exists, user in on-call group) within the
3-second view_submission ack budget; show how to defer slow checks and
use `response_action: "push"` or a follow-up message when a lookup can't
finish in time.
4. **Re-render without data loss** — explain how returning `errors` keeps the
user's typed values, versus `update`/`push` which require you to rebuild
state; give the decision rule for each.
5. **Failure & edge cases** — empty optional selects, dispatch_action on
enter, duplicate block_ids, and the `not_found` error when a block_id
doesn't match; include what Slack returns for each.
6. **Testing** — a table of view_submission payloads (valid, each invalid rule,
malicious oversize) and the exact expected `response_action` response.
Output: (a) value-extraction helper, (b) validation function returning the
errors object, (c) annotated response_action examples for errors/update/clear,
(d) the test payload/response table, (e) an anti-pattern list (ack timeout,
wrong keys, leaking internals into error text).
Keep every error message short, actionable, and free of internal identifiers.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Related prompts
-
Slack Block Kit Rich Text Input Composer Prompt
Capture and round-trip formatted user input using the rich_text_input block and rich_text element trees
-
Slack Live Progress Bar with chat.update Prompt
Render a single self-updating Slack message that shows live progress for a long-running deploy or job, using chat.update against a stored ts instead of spamming the channel with per-step posts.
-
Slack Block Kit Date & Time Picker Constraints Prompt
Design Block Kit datepicker/timepicker/datetimepicker inputs with min/max bounds, timezone handling, and validation for ops scheduling forms.
-
Slack Modal View Stack Multi-Step Navigation Prompt
Design a multi-step Slack modal flow using views.push, views.update, and the view stack so ops forms can branch, go back, and carry state without losing user input.
More Slack prompts & error guides
Browse every Slack prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.