feat(slack): add Send and Wait for Response component#3093
Open
nenadilic84 wants to merge 11 commits intosuperplanehq:mainfrom
Open
feat(slack): add Send and Wait for Response component#3093nenadilic84 wants to merge 11 commits intosuperplanehq:mainfrom
nenadilic84 wants to merge 11 commits intosuperplanehq:mainfrom
Conversation
5 tasks
91356da to
e23d895
Compare
e23d895 to
aedb2ab
Compare
92c94c4 to
a3615fe
Compare
Author
|
Demo video coming shortly — recording the end-to-end flow (integration setup + sending a message with buttons and receiving a user response). |
6c8f5f7 to
e1051f4
Compare
1a34853 to
77d94f4
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
Signed-off-by: Nenad Ilic <nenadilic84@gmail.com>
…uperplanehq#3111) Signed-off-by: Lucas Pinheiro <lucas@superplane.com> Signed-off-by: Nenad Ilic <nenadilic84@gmail.com>
Implement the Slack "Send and Wait for Response" component that sends a message with configurable buttons to a channel and pauses the workflow until a user clicks a button or the timeout expires. Key changes: - New SendAndWait component implementing IntegrationComponent interface - Implement handleInteractivity() to route Slack block_actions to subscribed components via the subscription mechanism - Add chat.update client method for updating messages after interaction - Frontend mapper with custom state handling (waiting/received/timed_out) - Comprehensive test coverage for setup, execute, actions, and queue processing Closes superplanehq#2338 Signed-off-by: Nenad Ilic <nenadilic84@gmail.com>
- Propagate FindExecutionByKV errors instead of silently dequeuing, allowing the framework to retry on transient failures - Fix float-to-Duration conversion to preserve fractional seconds Signed-off-by: Nenad Ilic <nenadilic84@gmail.com>
Signed-off-by: Nenad Ilic <nenadilic84@gmail.com>
Replace shorthand {color, label} with full EventStateStyle interface
properties (icon, textColor, backgroundColor, badgeColor, label) for
the waiting and timed_out states in the sendAndWait event state map.
Signed-off-by: Nenad Ilic <nenadilic84@gmail.com>
Signed-off-by: Nenad Ilic <nenadilic84@gmail.com>
- Replace manual prefix check with magic number in isSuperplaneInteraction with strings.HasPrefix for clarity and safety - Add "Received" label to the received state entry in sendAndWait event state map to fix display inconsistency with other labeled states Signed-off-by: Nenad Ilic <nenadilic84@gmail.com>
Reorder the getState function to check for framework-level states (error, cancellation) before metadata-driven states (waiting, timed_out, received). This prevents cancelled or errored executions from incorrectly displaying as "Waiting" in the UI when the Cancel method doesn't update metadata. Follows the same pattern used by the Approval component's approvalStateFunction. Signed-off-by: Nenad Ilic <nenadilic84@gmail.com>
Extract identical sendAndWaitEventSections and sendTextMessageEventSections into a shared slackEventSections helper in base.ts. Both functions had byte-for-byte identical logic for building event sections, creating a maintenance risk if one copy were updated without the other. Signed-off-by: Nenad Ilic <nenadilic84@gmail.com>
abb8963 to
51e05af
Compare
The deduplication of slackEventSections into base.ts and the corresponding update to send_text_message.ts introduced formatting that did not match Prettier's style. This fixes the CI format check failure. Signed-off-by: Nenad Ilic <nenadilic84@users.noreply.github.com> Signed-off-by: Nenad Ilic <nenadilic84@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
slack.sendAndWait) that sends a message with configurable buttons to a Slack channel and pauses the workflow until a user clicks a button or an optional timeout expireshandleInteractivity()in the Slack integration to route button click payloads from Slack to subscribed components via the existing subscription mechanismchat.updateclient method for updating messages after interaction (showing which button was clicked, or indicating timeout)waiting,received,timed_out)Architecture
The component follows the established async execution pattern (similar to the Approval component):
Execute()sends a Block Kit message with buttons viachat.postMessage, stores the message timestamp as a KV for correlation, optionally schedules a timeout action, and returnsnilwithout emitting — leaving the execution in a waiting statehandleInteractivity()(new) parses Slack's form-urlencoded interaction payload, lists subscriptions matchinginteractivityTypes, and routes the payload viaSendMessage()OnIntegrationMessage()receives the interaction and emits it as an event for the node's queueProcessQueueItem()finds the waiting execution viaFindExecutionByKV("message_ts", ...)and completes it by emitting on thereceivedchannelHandleAction("timeout")completes the execution on thetimeoutchannel if no response arrives in timeConfiguration
name(label) andvalueOutput Channels
valueanduserinfoFiles Changed
New files:
pkg/integrations/slack/send_and_wait.go— Core component implementationpkg/integrations/slack/send_and_wait_test.go— Tests for setup, execute, actions, queue processing, and helperspkg/integrations/slack/example_output_send_and_wait.json— Example outputweb_src/src/pages/workflowv2/mappers/slack/send_and_wait.ts— Frontend mapperModified files:
pkg/integrations/slack/slack.go— Register component, implementhandleInteractivity(), extendSubscriptionConfigurationpkg/integrations/slack/client.go— AddUpdateMessagemethodpkg/integrations/slack/example.go— AddExampleOutput()for SendAndWaitweb_src/src/pages/workflowv2/mappers/slack/index.ts— Register mapper and state registryTest plan
Closes #2338