PLhery / node-twitter-api-v2

Strongly typed, full-featured, light, versatile yet powerful Twitter API v1.1 and v2 client for Node.js.
https://www.npmjs.com/package/twitter-api-v2
Apache License 2.0
1.29k stars 176 forks source link

[bug] Unable to send direct messages #434

Closed subhash279 closed 1 year ago

subhash279 commented 1 year ago

Describe the bug Thanks for the library. I am trying to send a direct message but I keep getting an error saying 403 "Forbidden".

error: {
      title: 'Forbidden',
      type: 'about:blank',
      status: 403,
      detail: 'Forbidden'    }

To Reproduce

await client.v2.sendDmToParticipant("123", {
                    text: "hello",
                    attachments: [],
                });

I have authenticated using OAuth2 PKCE with scopes: follows.read offline.access tweet.write users.read tweet.read I am able to tweet etc but unable to send a direct message.

Expected behavior Send direct message.

Version

Additional context Do I need any additional scopes as I couldn't find any in this lib documentation or even twitter docs.

subhash279 commented 1 year ago

Closing this. Found out for DM, scopes are dm.read and dm.write