Rasa中文对话机器人🤖部署-下篇
0x01. Rasa中文天气对话机器人部署到Slack
0x02. 参考资料
内容紧接着上篇
0x01 Slack部署对话机器人
1. Slack官网
2. 创建一个workspaces
3. 启动Slack
4. Slack部署Rasa的文档
5. 创建一个Slack APP
6. 增加APP权限
需要添加一下权限
- app_mentions:read,
- channels:history,
- chat:write,
- groups:history,
- im:history,
- mpim:history and
- reactions:write
更多选项可以在slack文档中查看
7. 安装App到你的Workspace
8. 获取到Slack Token
将Slack Token
填写到WeatherBot的credentials.yml
中
在Slack
页面的Basic Information
中找到Signing Secret
复制signing secret
到credentials.yml
的 slack_signing_secret
选项中
9. 在slack
中创建channel
需要通过浏览器访问Slack查看CHANNEL_ID
slack:// channel?team = {TEAM_ID}&id = {CHANNEL_ID}
更新credentials.yml
到slack_channel
选项中
10 Request URL配置
1. 有公网IP
如果你是带有公网IP的服务器,那就直接运行rasa run
,然后将url按如下格式https://<host>/webhooks/slack/webhook
填写到Event Subscriptions
中
2. 无公网IP
需要使用到ngrok
工具,将我们本地localhost
的url
映射到外网能访问的url
使用十分简单,只需要注册,下载工具包,运行,自行查看文档
现在ngrok
配置是ok了,需要将rasa的5005端口映射出去
在一个Terminal
中启动如下命令,讲生成外网url
tools/ngrok http 5005
打开另外一个Terminal
启动Rasa
rasa run actions
在event-subscriptions中配置url,格式如下https://<host>/webhooks/slack/webhook
如果你的服务启动成功,并且Request URL Verified
那就ok了,如果是没有challenge
的参数,那就说明该url请求失败,有可能是url拼错了,或者rasa服务没启动。
11. 配置event-subscriptions权限
- message.channels,
- message.groups,
- message.im and
- message.mpim.
将
apps
加入到channels
12. 成功实现Slack连接
0x02 参考
关注公众号,持续更新哟~