2017-07-04 51 views
0

我想让我的python slack bot工作。我想要获取使用users.identity API尝试进行API调用的用户的信息。但是,我无法使其工作。slack API users.identity不工作

任何提示和想法为什么?

这是我得到的错误。

this is the error i get

在此先感谢。

回答

1

它不会在https://api.slack.com/methods/users.identity/test上工作。但是,如果您创建了一个“应用/脚本”,您可以在其中进行身份验证,然后请求https://slack.com/api/users.identity?token=xxx,您将获得有效登录身份的响应。与用户名,用户ID和团队ID

+0

我正在使用slackclient。你可以更多地指定认证吗?我在浏览器上尝试https://slack.com/api/users.identity?token= 无法正常工作,并且我还试图在python上使用slack_client.api_call(“users.identity”,token =“...”))不会工作 –

+0

这是我得到的信息'u'needed':u'identity.basic',u'provided':u'identify,read,post,client,apps',u'ok':False,u'错误“:u'missing_scope'}' –

+0

您需要执行此步骤https://api.slack.com/docs/oauth才能获取访问令牌。在https://api.slack.com/docs/oauth#appending_scopes中,您需要将此范围添加到oauth请求users.identity中。 – Hartsner