Hi.
I'm struggling with sending out direct messages. Haven't found any example yet, but figured out that code might looks something like this:
var Request = require('instagram-private-api/client/v1/request.js');
var Helpers = require('instagram-private-api/helpers.js');
var Client = require('instagram-private-api').V1;
var device = new Client.Device('SOME_ID');
var storage = new Client.CookieFileStorage(__dirname + '/cookies/SOME_ID.json');
Client.Session.create(device, storage, '<some_user>', '<some_passowrd>')
.then(function(session) {
return Client.Thread.configureText(session, {user_name:'<another_user>'},"Some Message");
})
However, I keep getting 500 Error from the server. I do believe that the issue is related to the fact that user object has a wrong format, because when I send just an empty object {} instead, the server returns 200.
Any suggestions regarding format or code sample would be great.
Thanks
checkout previous issues... like one from today
@huttarichard thanks. I looked into previous issues. And
Client.Thread.configureText(session, "user_id","Some Message");
solved the problem
@huttarichard I am getting this error.
Unhandled rejection AuthenticationError: Login required to process this request
Can you tell me why?
@rohanoid5 because you need to login to process this request.
i get
Unhandled rejection ParseError: Not possible to parse API response
var Client = require('instagram-private-api').V1;
var device = new Client.Device('myusername');
var storage = new Client.CookieFileStorage(__dirname + '/cookies/myusername.json');
Client.Session.create(device, storage, 'myusername', 'xxx')
.then(function(session) {
return Client.Thread.configureText(session, "other_username","Hello, how are you?");
})
@intergleam
you have to use not other_username but account id
@sblim0126 Hi, what is an account id?
Most helpful comment
@huttarichard thanks. I looked into previous issues. And
solved the problem