我在 Dialogflow CX webhook 响应的响应中收到以下错误
[
{
code: 3,
message: 'Failed to parse webhook response: [{"fulfillment_response":{"messages":[{"text":"text here"}],"merge_behavior":"REPLACE"}}]'
}
]
我们可以做什么来解决这个错误?
最佳答案
根据您提供的错误消息,您从 Webhook 服务返回的 Webhook 响应如下:
[{
"fulfillment_response": {
"messages": [{
"text": "text here"
}],
"merge_behavior": "REPLACE"
}
}]
“消息”下的文本字段应该有一个文本响应,其中应包含一组要返回给用户的文本消息。
Webhook 响应的示例如下:
{
“fulfillment_response”: {
“messages”: [{
“text”: {
“text”: [
“text here”
]
}
}],
“merge_behavior”: “REPLACE”
}
}
有关 Webhook 响应的更多信息,请参阅此处:https://cloud.google.com/dialogflow/cx/docs/reference/rpc/google.cloud.dialogflow.cx.v3beta1#webhookresponse
关于dialogflow-cx - 无法解析 webhook JSON 响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63746647/