如何在网络聊天中回显 Rich cards 中单击的按钮文本
How to echo clicked button text from Rich cards in web chat
我们开发了一个机器人,正在向客户发送丰富的卡片。当用户通过网络聊天连接到我们的 bot 并单击这些丰富卡片中的按钮时,用户单击的按钮文本不会回显到聊天 window 中,就好像用户自己输入一样,这与例如信使。
问题在于,如果用户在对话中向上滚动,他看到的只是机器人编写的文本,这让他很难看到自己做出了什么选择(点击了哪些按钮),并且因此,什么机器人的答案对应什么选择。
确保 CardAction
(您的按钮)的 Type
设置为 imBack
。然后在 Value
属性 中填写您想要在聊天中显示的文本。
根据 documentation:
CardAction.Type: imBack
CardAction.Value: Text of the message to send
to the bot (from the user who clicked the button or tapped the card).
This message (from user to bot) will be visible to all conversation
participants via the client application that is hosting the
conversation.
我们开发了一个机器人,正在向客户发送丰富的卡片。当用户通过网络聊天连接到我们的 bot 并单击这些丰富卡片中的按钮时,用户单击的按钮文本不会回显到聊天 window 中,就好像用户自己输入一样,这与例如信使。
问题在于,如果用户在对话中向上滚动,他看到的只是机器人编写的文本,这让他很难看到自己做出了什么选择(点击了哪些按钮),并且因此,什么机器人的答案对应什么选择。
确保 CardAction
(您的按钮)的 Type
设置为 imBack
。然后在 Value
属性 中填写您想要在聊天中显示的文本。
根据 documentation:
CardAction.Type: imBack
CardAction.Value: Text of the message to send to the bot (from the user who clicked the button or tapped the card). This message (from user to bot) will be visible to all conversation participants via the client application that is hosting the conversation.