Closed noraj closed 12 months ago
I'm not able to replicate. Try adding the 'httplog' gem in your Gemfile to see Twitter's response in greater detail. Also make sure you're using 3-legged OAuth user-context authentication and not app-context authentication.
json = { "text": "ok" }.to_json
client.post("tweets", json)
[...httplog headers omitted]
[httplog] 2023-09-22 16:12:29 -0600 Response: {"data":{"edit_history_tweet_ids":["1705344340552220696"],"id":"1705344340552220696","text":"ok"}}
When I try it again:
client.post("tweets", json)
[httplog] 2023-09-22 16:15:53 -0600 Response: {"detail":"You are not allowed to create a Tweet with duplicate content.","type":"about:blank","title":"Forbidden","status":403}
json = { "text": "ok" }.to_json client.post("tweets", json)
Yeah was just a JSON escaping issue, my bad, I feel so lame.
My code is https://gitlab.com/rawsec/rawsec-inventory-twitter-bot/-/blob/master/xBot.rb
In short (without the unnecessary parts):
And I'm just receiving this error without much details:
PS: That's no credential issues, I had another error (401 or 403) when the credentials were wrong.