Slack dialog doesn't close after form submission

你。 提交于 2019-12-17 14:57:13

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/48714834/slack-dialog-doesnt-close-after-form-submission

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!