slack-ruby-client icon indicating copy to clipboard operation
slack-ruby-client copied to clipboard

invalid_array_arg with users_profile_set when profile is not JSON

Open jaman1020 opened this issue 6 years ago • 1 comments

I'm trying to create a small integration that changes the user status, and am unable to do so. No matter what permutation of users_profile_set I choose, I cannot get around an invalid_array_arg error from slack.

client.users_profile_set( user: user_id, profile: { :status_text=>"anything", :status_emoji=>":house_with_garden:", :status_timeout => 1234 })

I'm positive that the User ID is correct. I can actually use this method to set an individual property, but setting the emoji property clears the status property, and vice versa. Anything involving using the "profile" hash causes the problem

Full Error: Slack::Web::Api::Errors::SlackError: invalid_array_arg from /Users/jon/.rvm/gems/ruby-2.3.3/gems/slack-ruby-client-0.14.1/lib/slack/web/faraday/response/raise_error.rb:11:in 'on_complete'

jaman1020 avatar Mar 10 '19 00:03 jaman1020

I have a whole bot that does that ;)

https://github.com/dblock/slack-moji/blob/master/slack-moji/models/user.rb#L167

The value of profile needs to be JSON. Go figure.

Would appreciate a patch ala https://github.com/slack-ruby/slack-ruby-client/blob/master/lib/slack/web/api/patches/chat.2.attachments-json.patch in this project for the profile APIs so that users don't have to struggle.

dblock avatar Mar 10 '19 13:03 dblock