question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to respond to Modal's view_submission events

See original GitHub issue

Description

The documentation mentions in several places (1, 2, 3) that when a modal is submitted, you get a view_submission payload. But I can’t find anything on how you get the payload - it doesn’t seem to be an app.event() or app.action() based one. I can’t find any example code either.

I’ve tried tons of things like:

app.event('view_submission', async (everything: any) => {
    everything.ack();
    console.log("I'm here");
});

But the callback never triggers. I always get a

[ERROR]  bolt-app An incoming event was not acknowledged within 3 seconds. Ensure that the ack() argument is called in a listener.

Stranger still, the Events API doesn’t contain anything about view_submission either, but the Error confirms it is an event.

So my question is - How are you supposed to respond to a Modal submit using Bolt?

What type of issue is this? (place an x in one of the [ ])

  • bug
  • enhancement (feature request)
  • question
  • documentation related
  • testing related
  • discussion

Requirements (place an x in each of the [ ])

  • I’ve read and understood the Contributing guidelines and have done my best effort to follow them.
  • I’ve read and agree to the Code of Conduct.
  • I’ve searched for any related issues and avoided creating a duplicate issue.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
paragbaxicommented, May 17, 2021

also ran into this. would appreciate it if it was part of javascript bolt docs (or if i missed it, more prominently shown?)

6reactions
dginovkercommented, Jul 21, 2020

THANK YOU!!! The callback_id was the missing piece. For future readers, it’s needed in the first level of the view JSON, i.e. your JSON looks like this:

view: {
  "title": ...,
  "submit": ...,
  "blocks": [...],
  "type": "modal",
  "callback_id": "a_unique_id",
}

Then you can respond to it with:

app.view('a_unique_id', async (everything) => {
  everything.ack();
});
Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I respond to a modal submission event with a message ...
I'm using Bolt JS SDK. I can't find a clear answer to this in the documentation. Maybe it's somehow possible via "ack" method...
Read more >
Using modals in Slack apps
Close the current view. If your app responds to a view_submission event with a basic acknowledgment response — an HTTP 200 response —...
Read more >
Responding to slack view_submission event with error object
I use ASP.NET Core 2.1 to build integration with Slack Here is my modal in json format.
Read more >
Modals - discord.js Guide
Modal submissions can be collected within the scope of the interaction that showed it by utilising an InteractionCollector open in new window, ...
Read more >
Modals | Slack SDK for Java
Respond to the Slack API server with 200 OK as an acknowledgment. "view_submission" requests. When a modal view is submitted, you'll receive a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found