问题描述
webhook调用失败,如何查看详细日志?
解决方法
testing webhooks页描述了错误已放入output.webhook_error.<result_variable>
中。例如,如果您的结果变量为webhook_result_1
,则输出为output.webhook_error.webhook_result_1
。
如文档中所述,如果发生错误,则在对话框节点编辑器的“助手响应”部分中,应使用“如果助手可以识别” anything_else
,则可以在其中放置{{ 1}}。
这将显示更多信息。例如,如果我配置一个API引发错误,我将返回:
The callout generated this error: <? output.webhook_error.webhook_result_1 ?>.
如果在实时使用Bot时发生此错误,则将在日志中捕获Webhook响应正文。如果您在用户界面中使用“试用”面板,则会不捕获日志。
在“分析”选项卡中“技能”的助手UI中,显示了对话。在用户界面的“用户对话”部分中,捕获了对话的文本,但是,如果您如上所述添加输出,则只会看到webhooks错误。
该API可用于获取工作区或技能的日志,其中包括webhook错误详细信息。参见List Log Events in a Workspace。如果您使用的是技能,则可以从助手UI中找到要使用的URL。在“技能”列表页面上的特定技能上,单击The callout generated this error: {"response_code":400,"message":"Webhook call was not successful. Response code is [400].","response_body":{"code":"cff11d18150e8018d5e304ac3fc35c94","error":"There was an error processing your request."},"content_type":"application/json"}.
菜单,然后选择“查看API详细信息”。 ...
显示要使用的工作区ID。
例如,如果Legacy v1 workspace URL:
为Legacy v1 workspace URL:
,则用于获取日志的URL为https://gateway.watsonplatform.net/assistant/api/v1/workspaces/ce13f844-c3a7-4f36-97c6-a0ac704024a6/message
在工作区日志中,将显示https://gateway.watsonplatform.net/assistant/api/v1/workspaces/ce13f844-c3a7-4f36-97c6-a0ac704024a6/logs?version=2020-04-01
中发生webhook错误的用户对话的详细信息:
webhook_error