Stream statuses/filter with follow only works with id_str?

api

#1

Hi there,

I am learning to use the twitter APIs at the moment and am struggling with receiving tweets from the streaming API using the follow filter, I have tried two different npms (https://www.npmjs.com/package/twit and https://www.npmjs.com/package/twitter), and they both connect (I do not get any errors and the twit npm emits the ‘connected’ event), but do not receive updates when I tweet using the user.id as the follow value. I do however receive updates when using user.id_str. I have just spent quite some time figuring this out as the documentation for follow says user ID and the user object I received for my account from the REST API only differs fro id and id_str by one number:
user inspect: {"id":823861503992483800,"id_str":"823861503992483840","name":"testiii" ...
It would be great if the docs (https://dev.twitter.com/streaming/overview/request-parameters#follow) would explicitely state to only use the id_str for follow.

Can you also help me understand why id and id_str are two different numbers, that only differ by one character? The docs say that id_str is just the stringified version of id.

Thanks a lot!


#2

There’s more information on why there are string representations of the IDs in the API overview section. In this case, because you are using Javascript, the language cannot handle the large Snowflake ids being used. You should always use the _str version.

Apologies that you hit this confusion when investigating the streaming API documentation.

Finally, I just want to clarify that you’re using the public streaming API, not site streams (which is a closed beta product).