while trying to send invitation to users on slack, i am going though error. i hope i get idea from here. here goes my code:
SLACK_INVITE_URL = 'https://example.slack.com/api/users.admin.invite'
def perform(email)
uri = URI.parse SLACK_INVITE_URL
response = Net::HTTP.post_form(uri, {
email: email,
channels: 'C02G8J689',
token: ENV['token']
})
json_response = JSON.parse response.body
json_response
rescue => e
error = e
end
end
I am going through this error:
{"ok"=>false,
"error"=>"missing_scope",
"needed"=>"client",
"provided"=>"identify,bot,incoming-webhook,channels:read,groups:read,users:read,usergroups:read,channels:write,chat:write:user,chat:write:bot,usergroups:write"}
You are Missing the client
Scope.
You haven't added the client
scope which Slack is telling you in the error.
The client scope "Receives all events from a workspace in realtime" which the users.admin.invite
You can read about it here https://api.slack.com/scopes/client and about users.admin.invite https://github.com/ErikKalkoken/slackApiDoc/blob/master/users.admin.invite.md