Cod*_*ass 3 actions-on-google dialogflow-es
DialogFlow 代理与 Telegram Bot 成功集成后。我发现双星 **没有将文本格式化为粗体。
我知道在 sendMessage API 中将 parse_mode 设置为 Markdown 可以正确解析文本,但是 DialogFlow 集成在集成时不会显示此类选项。
要格式化 Telegram 消息,您需要发送一个额外的参数parse_mode,您可以将其设置为html您想要的文本格式,例如粗体、斜体、删除线等。
要格式化来自 Dialogflow 的静态 Telegram 消息,您需要设置 Telegram 的自定义负载作为响应,如下图所示
要格式化来自 webhook 的消息,您需要在响应正文中附加 Telegram 的自定义负载,最终如下所示。
{
"fulfillmentText": "",
"fulfillmentMessages": [{
"text": {
"text": [""]
}
}],
"payload": {
"telegram": {
"text": "<b>hello formatted custom telegram text</b>",
"parse_mode": "html"
}
},
"outputContexts": []
Run Code Online (Sandbox Code Playgroud)
}
您可以在此处找到有关 Dialogflow 丰富消息的更多信息: https: //cloud.google.com/dialogflow/docs/intents-rich-messages。
虽然回复晚了,但还是希望能帮到现在有需要的人。
| 归档时间: |
|
| 查看次数: |
2921 次 |
| 最近记录: |