表单提交后 Slack 对话框不会关闭 [英] Slack dialog doesn't close after form submission
问题描述
我创建了一个 slack 对话框/表单来收集用户的一些信息;表单呈现得很好,我可以毫无问题地填写表单,但在我单击提交后它不会关闭,而是出现错误:
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 状态 OK.
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.
这篇关于表单提交后 Slack 对话框不会关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!