I am trying to upload media in direct messages.By referring this documentation https://dev.twitter.com/rest/direct-messages/attaching-media, I generated mediaId by setting media_category as dm_image and I constructed header using this https://api.twitter.com/1.1/direct_messages/events/new.json endpoint.
And then I triggered POST request with end point - https://api.twitter.com/1.1/direct_messages/events/new.json
Content-Type - application/json
content - {"event": {"type": "message_create","message_create": {"target": {"recipient_id": "4211191093"},"message_data": {"text": "Hello World!","attachment": {"type": "media","media": {"id": "859337626066833414"}}}}}}
and Content-Length
But I am getting 215 error message
{"errors":[{"code":215,"message":"Bad Authentication data."}]}
I can’t able to find out what is missing in this request.Can anyone plz help me in this.
Thanks!