Listen to a modal view submission in slack/bolt?
See original GitHub issueDescription
Hello, currently i am using “@slack/bolt”: “^2.0.1” package to create a bot for Slack. I want to add some interaction to user, when he types a command a dialog modal will open and he has to fill some data and submit those data.
Here is the command invocation and sending of a view modal…
app.command('/test-zenbot', async ({ ack, body, context }) => {
// Acknowledge the command request
await ack();
try {
const result = await app.client.views.open({
token: context.botToken,
// Pass a valid trigger_id within 3 seconds of receiving it
trigger_id: body.trigger_id,
// View payload
view: createTicketModal()
});
console.log(result);
}
catch (error) {
console.error(error);
}
});
Now, my question is, how should i listen to form/view/modal data submission?
All the time i am getting this error on modal the moment i click the submit:
We had some trouble connecting. Try again?
I am trying to listen to modal/form submission through the bolt view method
app.view(‘bot_create_ticket’, async ({ ack, body, view, context }) => {
await ack(); });
But, to no avail. Any help on this?
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
How to listen for Modal submission on Slack Bolt?
Then, to listen to submissions on the above Modal, use this: app.view('YOUR_CALLBACK_ID', optionalMiddleWareFunction, async ({ payload }) ...
Read more >Using modals in Slack apps
The app handles the view submission and responds by clearing the view stack. ... Upon submission of a modal view, an interaction payload...
Read more >Bolt for Python - Slack Platform Developer Tools
Actions, commands, shortcuts, options requests, and view submissions must always be ... The open_modal shortcut listens to a shortcut with the callback_id ...
Read more >Triggering Modals | Tasks App | Slack Platform - YouTube
Modals provide focused spaces ideal for requesting and collecting data from users, or temporarily displaying dynamic and interactive ...
Read more >slack-bolt - PyPI
The Bolt Framework for Python. ... pip install slack-bolt ... Listen for view_submission modal events app.view(callback_id)(fn) # Listen for options ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
For me, my modal didn’t have a
callback_id
property which was needed forapp.view(/my_callback_id/, ...
to listen for the submission event. Alternatively, you can listen with the event type, i.e.app.view({ type: "view_submission" }, ...
I found out that in order for app.view to work i have to set the request URL in Interactivity and Shortcuts in Slack App Management UI to: /slack/events instead of /slack/actions as was previously.
Now, it works. The only thing i wonder is after the user submits the view/modal/form how can i check in app.view() which channel id he sent the view/modal/form. In app.messages() we have the say() function where you write back to the channel, but in app.view() i cannot find a way to get the channel informations.