javascript - 代表用户在对讲机上发送消息

标签 javascript reactjs intercom.js

有谁知道如何代表用户从对讲机 ( https://www.intercom.com/ ) 发送消息?我需要设置一个事件监听器,打开对讲机聊天窗口并在单击某个按钮时发送消息。

如果有帮助,我正在使用 React 版本的对讲机。

将非常感谢任何提示。

最佳答案

如果您使用的是 Intercom 聊天小部件,您可以像这样代表用户在小部件中预填充自定义消息

const myCustomMessage = 'Hi there!'

window.Intercom('showNewMessage', myCustomMessage)

当然,用户仍然必须实际发送消息。这可能不是您想要的,但如果您想完全自动化除发送消息的决定(在很多情况下这是正确的用户体验)之外的所有事情,它是一种替代方案。

Documentation is here.

关于javascript - 代表用户在对讲机上发送消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41120564/

相关文章:

javascript - 为什么 'delete(arg)' 不会在函数中引发任何错误并给出输出 'myVar' ?

javascript - 数组 jsx 中没有迭代项目

reactjs - 找不到模块 : Can't resolve 'react-leaflet'

javascript - 使用 intercom.js 在单独的窗口上触发功能

javascript - 如何在 vue.js 和 laravel 中显示数组响应?

javascript - 为什么 If 语句为 hashTable 返回 undefined?

javascript - 将数组从 PHP 返回到 JavaScript,无需 JSON

javascript - nextjs : Warning: Prop `className` did not match. 服务器: "x"客户端: "y"

node.js - 使用 Intercom API 上传图像