I am trying to send Direct Message to a user who I follow and who follows me.
When I first tried to make a POSTMAN request as per the document here I was getting a HTTP 415 response, media type not supported. I looked up the Error code in their document and understood that this was happening because the callback_url
needed to be whitelisted.
So I followed this guide to whitelist the callback_url
and generate the access_request
token , i.e oauth_token
and oauth_secret
here
So, was :
1. Get successfully oauth/request_token
and got the Response: &oauth_callback_confirmed=true
for the callback_url configured my app details. As far as I could tell, that's all I thought, I needed to do to whitelist the callback_url
2. Got oauth_verifier
and final oauth_token
and oauth_token_secret
But, after generating the outh_token
and oauth_token_secret
and using it to make the DM API call, Now I am getting
{ "errors": [ { "code": 32, "message": "Could not authenticate you." } ] }
When I try to make a GET auth/authenticate call as documented here, I get a HTTP 403 with a message
Whoa there!
The request token for this page is invalid. It may have already been used, or expired because it is too old. Please go back to the site or application that sent you here and try again; it was probably just a mistake.
I can see in the Documentation that https://api.twitter.com/1.1/direct_messages/events/new.json
Requires authentication? Yes (user context only)
I think I am missing something. Can anyone please help me point in the right direction as to what I need to be able to send DM to users successfully ?