Diverging tweet ids between Ads API endpoint and ads.twitter.com interface

ruby

#1

Hello,

I found that the same tweet has different ids depending if we use the API endpoint for scoped_timeline ( https://dev.twitter.com/ads/reference/get/accounts/%3Aaccount_id/scoped_timeline ) and the id we find if we inspect the element on the twitter ads website when selecting a creative for a twitter campaign.
Example:
Tweet Id from API endpoint: 684734076817911800
Tweet Id in website html: 684734076817911808

I found this error when using the APIs to assign a tweet to a line_item (I think it s https://dev.twitter.com/ads/reference/post/accounts/%3Aaccount_id/promoted_tweets , we are using the ruby library to consume the APIs):

TwitterAds::NotFound (#<TwitterAds::NotFound:0x83782300 code=404 details="[{:code=>“NOT_FOUND”, :message=>“Tweet 684734076817911800 was not found”}]">)


POST promoted_tweets
#2

We found the solution, it was actually fairly tricky. When converting tweet_ids to json, it was rounding the last digits which corrupted them. We recommend to convert tweet_ids to strings before converting them to json data (in order to use them inside a form).


#3

If this is an issue, you can also always make use of id_str too so you won’t have to do the conversion yourself.