Skip to content

Implement external_select block kit for Slack#397

Merged
dancer merged 6 commits into
vercel:mainfrom
Franz1241:main
Apr 21, 2026
Merged

Implement external_select block kit for Slack#397
dancer merged 6 commits into
vercel:mainfrom
Franz1241:main

Conversation

@Franz1241
Copy link
Copy Markdown
Contributor

@Franz1241 Franz1241 commented Apr 17, 2026

external_select as per Slack Docs

Summary

  • Adds <ExternalSelect> modal element backed by Slack's external_select block, so modals can populate dropdowns from a remote/large data source instead of being limited to static <Select> options
  • Adds onOptionsLoad(actionId, handler) for registering loaders. Handlers receive {actionId, query, user, adapter, raw} and return normalized {label, value}[]. Specific action IDs run before catch-all handlers; per-handler errors are isolated
  • Slack adapter now handles block_suggestion interactive payloads, calls chat.processOptionsLoad, and converts results into Slack option objects (capped at 100, per Slack's limit).
  • Loader execution is capped at 2.5s to stay inside Slack's 3s response budget — on timeout the adapter still returns 200 with an empty options array and logs a warning, rather than failing the request or leaving Slack hanging.
  • Documentation

Test plan

-pnpm validate runs 16/16

Closes #398

- block_suggestion handler for slack webgook
- new <ExternalSelect/> to chat modal jsx
- new .onOptionsLoad()
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Apr 17, 2026

@Franz1241 is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

@Franz1241
Copy link
Copy Markdown
Contributor Author

Hey @dancer hope its okay to tag you. I noticed youve worked on some Slack-related PRs recently and thought you might be the right person to review this
Id appreciate it if you could take a look when you have time
This ft would help unblock my work

@dancer
Copy link
Copy Markdown
Collaborator

dancer commented Apr 18, 2026

ping me anytime and will take a look later today

@Franz1241
Copy link
Copy Markdown
Contributor Author

Tysm

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Apr 21, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
chat Ready Ready Preview, 💬 10 unresolved, Open in v0 Apr 21, 2026 0:47am
chat-sdk-nextjs-chat Ready Ready Preview, Comment Apr 21, 2026 0:47am

@dancer
Copy link
Copy Markdown
Collaborator

dancer commented Apr 21, 2026

perfect this is great thank you so much @Franz1241 sorry for getting to it a bit late

will be on the next release cc: @bensabic

@dancer
Copy link
Copy Markdown
Collaborator

dancer commented Apr 21, 2026

also ping me anytime ❤️ will make a follow up to this pr as i see 2 things e.g. initial_option & option_groups

@dancer dancer merged commit a179b29 into vercel:main Apr 21, 2026
7 checks passed
@Franz1241
Copy link
Copy Markdown
Contributor Author

Awesome, thanks a lot 🙌

grundmanise pushed a commit to grundmanise/vercel-chat-sdk that referenced this pull request Apr 22, 2026
* feat(slack): external_select's block kit implementation

- block_suggestion handler for slack webgook
- new <ExternalSelect/> to chat modal jsx
- new .onOptionsLoad()

* feat: add tests for new external_selec implementation

* feat(docs): Slack externa_select docs

* chore: changeset

* chore: remove docs from changeset

---------

Co-authored-by: dancer <josh@afterima.ge>
dancer added a commit that referenced this pull request Apr 30, 2026
* feat(slack): external_select's block kit implementation

- block_suggestion handler for slack webgook
- new <ExternalSelect/> to chat modal jsx
- new .onOptionsLoad()

* feat: add tests for new external_selec implementation

* feat(docs): Slack externa_select docs

* chore: changeset

* chore: remove docs from changeset

---------

Co-authored-by: dancer <josh@afterima.ge>
patrick-chinchill added a commit to Chinchill-AI/chat-sdk-python that referenced this pull request May 11, 2026
, #397) (#84)

* feat(externalselect): add initialOption + option_groups (vercel/chat#410, #397)

Ports two upstream PRs that together complete ExternalSelect support:

- vercel/chat#397 introduced ExternalSelectElement and the
  block_suggestion / onOptionsLoad runtime; the runtime half landed
  here in #66 but the modal element type was deferred. This PR adds
  the missing ExternalSelectElement TypedDict + ExternalSelect builder
  and wires up _external_select_to_block in the Slack modal renderer.
- vercel/chat#410 adds two new optional fields on top: initialOption
  (pre-selected option object) and option_groups (labeled sections,
  Slack max 100 groups x 100 options, label max 75 chars). The
  handler return type widens to OptionsLoadResult = list[options] |
  list[OptionsLoadGroup]; the Slack adapter detects grouped form by
  the presence of an "options" key on the first entry and emits
  Slack's option_groups response (mutually exclusive with options
  per Slack's spec).

Hazard #1 (truthiness): min_query_length=0 is preserved (0 means
"fire on every keystroke"); not silently dropped by an `or` fallback.

Hazard #7 (omit vs None): unset initial_option / placeholder /
min_query_length are omitted from the rendered Block Kit element,
not serialized as null.

https://claude.ai/code/session_01FyMxQn2BEAzmwKS1GZczKj

* fix(slack): use is-not-None guard for initial_option in external_select renderer

Address review on PR #84 (modals.py:209). The TS expression
``if (select.initialOption)`` only filters null/undefined since ``{}`` is
truthy in JS. Python ``if initial_option:`` falsely drops a
hand-constructed ``initial_option={}`` because empty dicts are falsy.
Switch to ``is not None`` for parity with TS and consistency with the
``min_query_length is not None`` check three lines above.

Adds test_external_select_initial_option_empty_dict_renders regression
test that fails before the fix.

https://claude.ai/code/session_01FyMxQn2BEAzmwKS1GZczKj

---------

Co-authored-by: Claude <noreply@anthropic.com>
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.

Implement external_select block kit for Slack

2 participants