intercom
intercom 一个客服平台
intercom 的几个网址
- 管理平台页面
https://app.intercom.io - 文档
https://developers.intercom.com/docs
https://developers.intercom.com/reference - dashboard
https://app.intercom.com/developers/
前端js接入的例子
<html>
<head>
</head>
<body>
<script> window.intercomSettings = { app_id: "lalala", name: "test", // Full name email: "test@test.com", // Email address created_at: 1527337585129, // Signup Date }; </script>
<script>(function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',intercomSettings);}else{var d=document;var i=function(){i.c(arguments)};i.q=[];i.c=function(args){i.q.push(args)};w.Intercom=i;function l(){var s=d.createElement('script');s.type='text/javascript';s.async=true;s.src='https://widget.intercom.io/widget/cfwewwk3';var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);}if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})()</script>
</body>
</html>
intercom dashboard 设置
- 生成 access token(scopes 全都选一下吧)
- webhook: http://118.25.106.132:9000/intercom
secret(随意,只要保证和后面wechat intercom的配置一直就可以):123
测试:
$ curl \
-s https://api.intercom.io/users?user_id=27 \
-H 'Authorization:Bearer access_token' \
-H 'Accept:application/json'
intercom 和微信个人号连接
使用 mojo 微信 和 wechat_itercom
查看大图
.mojo weixin
代码:
github:https://github.com/sjdy521/Mojo-Weixin运行:
sudo docker build -t mogo-weixin .
sudo docker run -it --env MOJO_WEIXIN_LOG_ENCODING=utf8 --env MOJO_WEIXIN_PLUGIN_OPENWX_POST_API=http://111.111.111.111:9000/wechat -p 3000:3000 -v /tmp:/tmp sjdy521/mojo-weixin
mojo weixin 模块接口说明:
https://metacpan.org/pod/distribution/Mojo-Weixin/doc/Weixin.podopenwx 的 api说明:
https://github.com/sjdy521/Mojo-Weixin/blob/master/API.md
wechat itercom
修改setting文件:
HOST = '0.0.0.0'
PORT = 9000
WECHAT_API_BASE_URL = 'http://111.111.111.111:3000/openwx'
INTERCOM_ACCESS_TOKEN = 'NTERCOM_ACCESS_TOKEN'
INTERCOM_WEBHOOK_SECRET = 'INTERCOM_WEBHOOK_SECRET'
INTERCOM_BOT_USER_ID = 'lalala'
- 运行:
sudo docker build -t intercom_wechat
sudo docker run -it -p 9000:9000 intercom_wechat
- 测试:
curl -X POST http://127.0.0.1:9000/webchat
curl -X POST http://127.0.0.1:9000/intercom