react-native-twitter
react-native-twitter copied to clipboard
unable to send direct message
Hello, I am unable to send a direct message. I have the direct message permission enabled in the developer console & the recipient has direct messages enabled from any user. The error I receive is not much help so any insight would be appreciated. Thank you!
I am using:
"react": "16.4.1",
"react-native": "0.56.0",
"react-native-twitter": "^0.2.1",
error:
err Error at request.js:60 at tryCatch (es6-promise.js:409) at invokeCallback (es6-promise.js:424) at es6-promise.js:176 at MessagePort.flush (es6-promise.js:128)
code:
const data = {
"event": {
"type": "message_create",
"message_create": {
"target": {
"recipient_id": TWITTER_USER_ID_STR
},
"message_data": {
"text": "Hi",
}
}
}
};
const parsedTokens = (JSON.parse(tokens));
const { rest } = twitter(parsedTokens);
rest.post('direct_messages/events/new', data ).then((resp) => {
console.log('resp', resp);
dispatch(updateProfileLoading(false));
}).catch((err) => {
console.log('err', err);
dispatch(updateProfileLoading(false));
});```