WorkflowButton block element missing required action_id property
Packages:
Select all that apply:
- [ ]
@slack/web-api - [ ]
@slack/rtm-api - [ ]
@slack/webhooks - [ ]
@slack/oauth - [ ]
@slack/socket-mode - [x]
@slack/types - [ ] I don't know
Reproducible in:
The Slack SDK version
2.14.0
Node.js runtime version
N/A; I'm running Deno:
$ deno --version
# deno 2.2.2 (stable, release, aarch64-apple-darwin)
# v8 13.4.114.9-rusty
# typescript 5.7.3
OS info
$ sw_vers && uname -v
# ProductName: macOS
# ProductVersion: 14.7.4
# BuildVersion: 23H420
# Darwin Kernel Version 23.6.0: Thu Dec 19 20:47:53 PST 2024; root:xnu-10063.141.1.703.2~1/RELEASE_ARM64_T6030
Steps to reproduce:
Example source code:
import { PlainTextElement, WorkflowButton } from "@slack/types";
export function getAWorkflowButton(triggerUrl: string): WorkflowButton {
return {
type: "workflow_button",
text: {
type: "plain_text",
text: "I am a workflow button",
} as PlainTextElement,
action_id: "action_12345",
workflow: {
trigger: { url: triggerUrl },
},
};
}
Expected result:
deno check passes.
Actual result:
deno check fails with an unknown property error for action_id even though the documented API for a workflow button specifies action_id as a required field:
Check file:///Volumes/<REDACTED>/foo.ts
TS2353 [ERROR]: Object literal may only specify known properties, and 'action_id' does not exist in type 'WorkflowButton'.
action_id: "action_12345",
~~~~~~~~~
at file:///Volumes/<REDACTED>/foo.ts:10:5
error: Type checking failed.
Suspected issue
I believe the exported WorkflowButton type from block-elements.ts is missing extending the Actionable interface.
https://github.com/slackapi/node-slack-sdk/blob/02f9b8743c0d2dc2a551c9c4f9d9e09a87905e52/packages/types/src/block-kit/block-elements.ts#L627
https://github.com/slackapi/node-slack-sdk/blob/02f9b8743c0d2dc2a551c9c4f9d9e09a87905e52/packages/types/src/block-kit/extensions.ts#L8-L18
Spot-checking a handful of other interactive components (eg. Button, Checkboxes, NumberInput, etc.) show that they all extend the Actionable interface:
https://github.com/slackapi/node-slack-sdk/blob/02f9b8743c0d2dc2a551c9c4f9d9e09a87905e52/packages/types/src/block-kit/block-elements.ts#L29
https://github.com/slackapi/node-slack-sdk/blob/02f9b8743c0d2dc2a551c9c4f9d9e09a87905e52/packages/types/src/block-kit/block-elements.ts#L92
https://github.com/slackapi/node-slack-sdk/blob/02f9b8743c0d2dc2a551c9c4f9d9e09a87905e52/packages/types/src/block-kit/block-elements.ts#L486
Hi @fkywong thanks for writing in 💯
This does seem like a potential bug 🤔 the the node-salck-sdk was not intended to be used with the deno runtime
Would you be able to give me more information on your app configuration in order for me to reproduce this?
Hey @WilliamBergamin,
Unfortunately I can't provide a direct link to our app since it's private, which is why I also had to sanitize the example source code and the resultant error message in my bug report, but to give you a bit more context.
This app is actually a workflow-based Slack app (docs.slack.dev), which requires the use of the Deno SDK (and therefore Deno runtime).
One of the simpler, publicly available examples of a workflow-based Slack app is the slack-samples/deno-announcement-bot repository.
Cross-referencing the Slack docs for this sample project, there's a specific part where format the blocks in order to send a message: https://tools.slack.dev/deno-slack-sdk/tutorials/announcement-bot#send-the-announcement
From the code snippets in the doc, they import code from ./blocks.ts, which itself imports @slack/types from Skypack.dev (https://www.skypack.dev/view/@slack/types), but this is really a pointer back to this node-slack-sdk project.
Looking at the source code for blocks.ts, they also have similar exported functions for constructing blocks like I included as an example in bug report.
Let me know if all of this answers your question/helps you reproduce this, or if you need more details.
Thanks!
Thanks for reporting this 💯 we will try to address this in the coming release
👋 It looks like this issue has been open for 30 days with no activity. We'll mark this as stale for now, and wait 10 days for an update or for further comment before closing this issue out. If you think this issue needs to be prioritized, please comment to get the thread going again! Maintainers also review issues marked as stale on a regular basis and comment or adjust status if the issue needs to be reprioritized.