Hi, anyone can help me ?
when i hit api for direct message, it was getting error in my code, but when i hit api for update status it was normal, ouath was same but i got the error,
i use npm twitter for the package
Thanks
Check Permissions in your app configuration https://developer.twitter.com/en/apps to make sure you have Read + Write + DM - you will need to recreate the access token after changing this.
I have do that
I hit that api in postman was successfull
But in my code that get eror , code: 32, could’nt aunt…
What language / library is this in? If it works in Postman but fails in your code on the same machine, i would check your code and make sure the latest version of the library is installed, and the keys and tokens are working, and the system clock in in sync, and SSL certs are also updated.
1 Like
i use nodejs
Here is my code:
const Twitter = require(‘twitter’);
const client = new Twitter({
consumer_key: ‘g…’,
consumer_secret: ‘F…’,
access_token_key: ‘1…’,
access_token_secret: ‘z…’
});
const send = new Promise((resolve, reject) => {
client.post(
‘direct_messages/events/new’,
{
event: {
type: ‘message_create’,
message_create: {
target: {
recipient_id: ‘1201795127938711552’
},
message_data: {
text: ‘aaaaaaaaaaa’
}
}
}
},
(error, event) => {
if (error) {
console.log(error);
reject();
}
console.log(event);
resolve();
}
);
});
system
closed
#6
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.