sferik / twitter-ruby

A Ruby interface to the Twitter API.

Home Page:http://www.rubydoc.info/gems/twitter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unexpected behavior with `add_list_member` and `add_list_members`

XanderStrike opened this issue · comments

I'm getting a Twitter::Error::Forbidden but that can't be right.

Given a client that's been initialized using "Read and Write" credentials I get the following:

pry(main)> list = client.create_list("test")
=> #<Twitter::List id=123412341234>
pry(main)> client.add_list_member(list, "xanderstrike")
Twitter::Error::Forbidden: You aren't allowed to add members to this list.
from /Users/pivotal/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/twitter-7.0.0/lib/twitter/rest/request.rb:97:in `fail_or_return_response_body'
pry(main)> client.add_list_members(list.id, ["xanderstrike"])
=> #<Twitter::List id=123412341234>

I can confirm in twitters UI that the list was created, but no users are added.

There's definitely an error here, either I have permission to add to the list but something is wrong with these two methods, or I don't have permission to the list I just created and add_list_members is failing silently.

Thanks!

Looks like the latter might be true, there's a secret undocumented account level rate limit for adding members to lists: https://twittercommunity.com/t/cant-add-members-to-a-list-code-104/25824/15

So I guess this issue becomes add_list_members fails silently on 403s. I spent a while trying to figure that out before I tried to add a single and saw the error.