Anyone manage to successfully post a status to Twitter/X using their older Oauth 1.0a API? I tried oauther
which seems to have lost it’s maintainer but it appears to still work, and I’m getting a 403
when attempting to POST to statuses/update
I’ve confirmed that I have Read, Write and DM permissions enabled, have indicated that my app is a bot with a backend and then after that I revoked and regenerated the consumer keys and access keys. This is from advisement from various posts on X’s development community.
Or is there a better tool out there now?
here is my iex log:
iex(14)> creds = OAuther.credentials(consumer_key: "my_consumer_key", consumer_secret: "my_consumer_secret", token: "my_token", token_secret: "my_token_secret")
%OAuther.Credentials{
consumer_key: "my_consumer_key",
consumer_secret: "my_consumer_secret",
token: "my_token",
token_secret: "my_token_secret",
method: :hmac_sha1
}
## Should I use "post" here?
iex(15)> params = OAuther.sign("post", "https://api.twitter.com/1.1/statuses/update.json", [{"status", "a test status"}], creds)
[
{"oauth_signature", "0ii5DrkWeIDx39KN2OD20AospOE="},
{"oauth_consumer_key", "my_consumer_key"},
{"oauth_nonce", "dNU7BJgpree9ym4F43ffMpiFHRnvI0Tp"},
{"oauth_signature_method", "HMAC-SHA1"},
{"oauth_timestamp", 1706679860},
{"oauth_version", "1.0"},
{"oauth_token", "my_token"},
{"status", "a test status"}
]
iex(16)> {header, req_params} = OAuther.header(params)
{{"Authorization",
"OAuth oauth_signature=\"0ii5DrkWeIDx39KN2OD20AospOE%3D\", oauth_consumer_key=\"my_consumer_key\", oauth_nonce=\"dNU7BJgpree9ym4F43ffMpiFHRnvI0Tp\", oauth_signature_method=\"HMAC-SHA1\", oauth_timestamp=\"1706679860\", oauth_version=\"1.0\", oauth_token=\"my_token\""},
[{"status", "a test status"}]}
iex(17)> :hackney.post("https://api.twitter.com/1.1/statuses/update.json", [header], {:form, req_params})
## 403 error
{:ok, 403,
[
{"perf", "7469935968"},
{"content-type", "application/json;charset=utf-8"},
{"cache-control", "no-cache, no-store, max-age=0"},
{"content-length", "311"},
{"x-transaction-id", "80f718cad47dede4"},
{"x-response-time", "3"},
{"x-connection-hash",
"8ebe492896cb27c4fcdfa8c34cfc739ac96a5a52138223760234f05add6d8466"},
{"date", "Wed, 31 Jan 2024 05:44:31 GMT"},
{"server", "tsa_b"}
], #Reference<0.2839908345.1444675585.60472>}
iex(18)>
Regards,
Michael