-
Notifications
You must be signed in to change notification settings - Fork 399
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add types of state.values on modal submission #497
Comments
As I mentioned here: #404 (comment), I'm always happy to provide more types for TypeScript users. @stevengill @aoberoi |
I love it! One suggestion: we could add the type definitions for the outputs of the actions closer to the definitions of the action blocks/elements themselves if they were put in the |
This sounds like a neat idea, but I don't think I completely understand. It sounds like you want to validate the action payload you receive from Slack fits a schema you have in your application, is that right? If so, I'm not sure how this would help in an application, but maybe you can walk me through it. I can see some value in a simplified mapping that works across all action block/element types. One benefit would be that you could deal with all actions is some generic way, which would allow you to have more code reuse. The biggest challenge I see is modeling the selection values. For example, a |
Description
I am currently working on validating modal submissions from Slack. Somewhat unfortunately all block types carry their value under different keys (e.g. rather than all having a
value
key there areselected_users
,selected_channel
,selected_options
and more).So far I have been unable to find documentation about the variety of response type structures that input blocks can have on modal submission.
I noticed there is a TODO comment here:
bolt-js/src/types/view/index.ts
Line 87 in 2ab6467
I am happy to submit a PR with a union type for this response if someone can point me to docs on what is available from the API. For my own bot, I have had to step through with a debugger to introspect the responses.
As a follow up, it would be amazing if there was a way to get simplified response schema from the slack's response (e.g. get a
block_id: value
mapping or some relative equivalent that includes theaction_id
). This would make it much easier to quickly write any schema validation using tools like https://github.com/jquense/yup or https://hapi.dev/module/joi/ without having to massage the data into a flatter form.Describe your issue here.
What type of issue is this? (place an
x
in one of the[ ]
)Requirements (place an
x
in each of the[ ]
)The text was updated successfully, but these errors were encountered: