twit icon indicating copy to clipboard operation
twit copied to clipboard

Sorry, that page does not exist when sending DM

Open JasonSowers opened this issue 5 years ago • 4 comments

I am trying to reply to a @mention with a direct message but have had no luck with the following code, In my params2 object I have also tried using id instead of using screen_name I have also tried using both id and screen_name in the params2 object. Is this just not possible?

    var params2 = {
        screen_name: name,
        text: `hello world`
    };

    T.post('direct_messages/new', params2, function(err, data, response) {
        console.log("logging data :", data);
        console.log("logging error :", err);
    });

returns the following error:

code:34
message:"Sorry, that page does not exist."
stack:"Error: Sorry, that page does not exist.\n    at Object.exports.makeTwitError (c:\Source\GitRepos\BITCORNhub-twitter\node_modules\twit\lib\helpers.js:74:13)\n    at onRequestComplete (c:\Source\GitRepos\BITCORNhub-twitter\node_modules\twit\lib\twitter.js:344:25)\n    at Request.<anonymous> (c:\Source\GitRepos\BITCORNhub-twitter\node_modules\twit\lib\twitter.js:364:7)\n    at Request.emit (events.js:187:15)\n    at Gunzip.<anonymous> (c:\Source\GitRepos\BITCORNhub-twitter\node_modules\request\request.js:1083:12)\n    at Object.onceWrapper (events.js:273:13)\n    at Gunzip.emit (events.js:187:15)\n    at endReadableNT (_stream_readable.js:1094:12)\n    at process._tickCallback (internal/process/next_tick.js:63:19)"
statusCode:404

JasonSowers avatar Aug 20 '19 19:08 JasonSowers

I have similar problem. https://github.com/ttezel/twit/issues/514

takuoka avatar Aug 22 '19 08:08 takuoka

Twitter has changed something in its DM. You should follow twitter api and twitter developer accounts on Twitter for upcoming changes. This library is not maintained at the moment so any change in Twitter APIs result in error here.

maziyarpanahi avatar Aug 22 '19 09:08 maziyarpanahi

Thanks for the response.

JasonSowers avatar Aug 23 '19 03:08 JasonSowers

I feel a bit sorry to pick this ticket out of the grave, but I have useful information for people who would land on it like I did earlier today.

I had the same error message

Sorry, that page does not exist

In fact the user id can be so long that it gets truncated if you store it in a variable as a number. e.g: console.log(1144222352743514120)

1144222352743514100

user id can be higher than Number.MAX_SAFE_INTEGER Number documentation on MDN

I've put the value in a string instead, and now it is working fine :+1:

guirip avatar May 07 '20 17:05 guirip