如何从Slack到机器人服务获取用户ID [英] How to get the user id from Slack to bot service

查看:78
本文介绍了如何从Slack到机器人服务获取用户ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Azure LUIS创建一个简单的机器人,这是我的第一个机器人.经过研究后,我取得了不错的进步,现在也与Slack集成在一起作为测试它的渠道.

I am creating a simple bot using Azure LUIS and this is my first one. I made some decent progress after doing some research and also now integrated with Slack as channel to test it.

该bot功能正常运行,但我希望识别用户.这样我就可以对机器人对话进行个性化设置,并从他的个人资料表中提取用户特定的信息.

The bot functionality is working fine, but I am looking to identify the user. So that I can personalize the bot conversation and also to pull the user specific information from his profile table.

无论如何,我是否可以获得闲置用户的UID或任何参考ID,因此可以将其与用户个人资料一起存储在我的用户表中?

Is there anyway, that I can get a UID or any reference ID of the slack user and so I can store that in my user table along with user profile?

因此,下一次,当用户向该机器人打招呼时,该机器人可以说你好, John ".而不是只说你好".

So next time, when the user greets the bot, the bot can say "Hello, John." instead of justing say "Hello."

谢谢!

推荐答案

我找到了解决方案,方法是对整个会话对象进行调试,该对象具有所有必需的信息.这可能与上面Dana提到的相同,但是在调试之后,这种修改变得简单而无需进行任何更改.

I found the solution by priting the whole session object, which is having all the required informaiton. This could be same as mentioned by Dana above, but after debugging, this follwing made simple without making any changes.

var slackID = session.message.address.user.id

通过上面的操作,我可以识别用户.

With above, I am able to identify the user.

谢谢.

这篇关于如何从Slack到机器人服务获取用户ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆