Skip to content

Can't send new direct messages #42

@smithjessk

Description

@smithjessk

I believe that this is an OAuth implementation problem because this task works correctly when done with twitter.

I know that the tokens, etc. are correct because I used them to properly view my direct messages.

Error:

URL [https://api.twitter.com/1.1/direct_messages/new.json?screen_name=jessdawess&text=This%20is%20a%20test]
ERROR: [object Object]
RESPONSE: [object Object]
BODY: {"errors":[{"code":32,"message":"Could not authenticate you."}]}

Source:

var Twitter = require("twitter-node-client").Twitter;

var config = {
    "consumerKey": process.argv[2],
    "consumerSecret": process.argv[3],
    "accessToken": process.argv[4],
    "accessTokenSecret": process.argv[5],
    "callBackUrl": process.argv[6]
};

var twitterClient = new Twitter(config);

twitterClient.postCustomApiCall('/direct_messages/new.json', {
    screen_name: process.argv[7],
    "text": "This is a test"
}, error, success);

function error(error, response, body) {
    console.log("ERROR: " + error);
    console.log("RESPONSE: " + response);
    console.log("BODY: " + body);
}

function success(response) {
    console.log("RESPONSE: " + response);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions