简体   繁体   English

Dialogflow:从 webhook 向用户打印 JSON 响应

[英]Dialogflow: Print JSON response from webhook to user

I want to print the fulfilment response that I am getting from the webhook back to the user.我想打印我从 webhook 返回给用户的履行响应。

Using an open API for Cryptocompare as the webhook, i am receiving the JSON response i need, however I do not know how to print the response for the user (also translate from JSON to text)使用 Cryptocompare 的开放 API 作为 webhook,我收到了我需要的 JSON 响应,但是我不知道如何为用户打印响应(也从 JSON 转换为文本)

Fulfilment Response:履行响应:

{
  "BTC": 0.03181,
  "USD": 199.25,
  "EUR": 171.74
}

Fulfillment Status: Webhook execution successful履行状态:Webhook 执行成功

I'm assuming i need to some how echo/print it under the custom payload tab.我假设我需要在自定义有效负载选项卡下回显/打印它。

You might need to convert the JSON response to string in order to print it out.您可能需要将 JSON 响应转换为字符串以将其打印出来。 JSON.stringify() could the the job, put your return data inside the bracket. JSON.stringify()可以完成这项工作,将您的返回数据放在括号内。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM