desmondmorris / node-twitter

Client library for the Twitter REST and Streaming API's.
https://www.npmjs.com/package/twitter
MIT License
1.27k stars 238 forks source link

"Could not authenticate you." Direct Message Twitter #315

Open DDeploy opened 5 years ago

DDeploy commented 5 years ago

Hi, i'm trying to send direct message and i have this error : {"code":32,"message":"Could not authenticate you."}

here it is my code :

 client.post('direct_messages/events/new', {
    type: 'message_create',
    message_create: {
        target: {
        recipient_id: "4...",
            message_data: {
                text: "hi"
            }
        }
    }
}) 

I have surely activated the access level for enabling Direct Messages but still ....

dandv commented 5 years ago

Was there a ! character anywhere in the payload? We fixed that problem in twitter-lite and now DMs can send any characters.

MarcGodard commented 5 years ago

Same problem. but your message_data should be moved up a level, same level as target.

ibrokemycomputer commented 5 years ago

I switched to https://www.npmjs.com/package/twit and it worked like a charm. The switch took about 45 seconds lol. Probably a header issue but ¯_(ツ)_/¯

MarcGodard commented 5 years ago

I also switched. I think this repo is dead.

icodeforlove commented 4 years ago

Repo is dead, thanks.