Search code examples
node.jsexpressslack

Slack dialog doesn't close after form submission


I created a slack dialog/form to collect some information from users; The form renders just fine and I can fill out the form without a problem but it doesn't close after I click Submit, instead it gives an error:

We had some trouble connecting. Try again?

I've already sent back a 200 status OK as in the documentation.

// menu is the end point of my interactive messages
app.post('/menu', (req, res) => {
  console.log('from form submission:', req.body.payload)
  res.sendStatus(200);
})

What could be wrong? I can see the console log for my app, fyi.


Solution

  • Sending a 200 OK is not enough.

    It also has to be empty OR contain a list of input validation errors in the correct format as JSON. If your response contains any other text (e.g. a warning message) it will create this error.

    As it says in the documentation:

    When the submission is without exception, your app must respond with 200 OK with an empty body. This will complete the dialog.