Slack API Opening a New DM (Scopes and Permissions)

99封情书 提交于 2019-12-13 00:34:06

问题


I am attempting to open a DM (Direct Message) with an arbitrary user using the im.open Slack API call. I am sending it a user's user_id that I obtain through their clicking of a consent button in order to begin a series of questions. I am sending data to the Slack API successfully along with receiving data. I am getting the following response...

 {
    "ok": false,
    "error": "missing_scope",
    "needed": "im:write",
    "provided": "identify,incoming-webhook,chat:write:user,files:write:user",
 }

I have went into the application's page and changed the scope of the app (I am not the owner, but have been given collaborator permissions by my team lead (the owner)). These are the current permissions...

I apologize for the poor quality of the image. The scopes are as follows...

  • identify
  • incoming-webhook
  • chat:write:user
  • files:write:user
  • im:write

After this change, I am still getting the same response from the Slack API. The following is what I am sending them (it's my user_id, and I don't mind).

{
    "user": "U94155Z43"
}

Any help is appreciated. Thanks.


回答1:


I needed to use the bot token "xoxb" instead of the user token "xoxp" which I had used for all other slack api calls.



来源:https://stackoverflow.com/questions/50235774/slack-api-opening-a-new-dm-scopes-and-permissions

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!