提交表单后,松弛对话框不会关闭 [英] 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?
我已经按照文档中的状态发送了200信息.>
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.
推荐答案
仅发送200 OK是不够的.
Sending a 200 OK is not enough.
它也必须为空,或者包含正确格式的输入验证错误列表,如JSON.如果您的回复中包含其他任何文字(例如警告消息),则会产生此错误.
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.
如文档中所述:
提交内容无一例外时,您的应用必须以 200 OK,身体空了.这将完成对话框.
When the submission is without exception, your app must respond with 200 OK with an empty body. This will complete the dialog.
这篇关于提交表单后,松弛对话框不会关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!