I would like to send message , I don't see any clear instruction on how to send message to a instagram user?
Thanks
No they aren't reason for this is lack of time to write documentation. What type of message? Direct / Comment? If direct, what is exactly what you need to send, just a text or?
Hi, Direct message just what we do using instagram app would be great I think. However, still this repo is great .
So first you need to gain session, than you need to decide if you want to reply to existing thread or create new one (Im guessing that you are looking for new thread)
Try this:
// var session -> use Session.create to get one
// import Client.V1 as Client
var userId = 1234567; // or multiple ids[] max 15 to create thread with multiple users
// You can get user ID with Account class
Client.Thread.configureText(session, userId, "first text you want to configure")
.then(function(thread) {
thread.broadcastText("second text you can send directly from thread instance");
console.log(thread.items) // -> see conversation
});
Hi , Thank you but I am having this error -->
Unhandled rejection TypeError: thread.broadcastText is not a function
I exactly did this as your showed.
Awww, sorry man, I did not realize that Client.Thread.configureText return an array of threads instead of one thread, try again
// var session -> use Session.create to get one
// import Client.V1 as Client
var userId = 1234567; // or multiple ids[] max 15 to create thread with multiple users
// You can get user ID with Account class
Client.Thread.configureText(session, userId, "first text you want to configure")
.then(function(threads) {
var thread = threads[0];
thread.broadcastText("second text you can send directly from thread instance");
console.log(thread.items) // -> see conversation
});
ProxyClient actually returns one thread, but client/v1 will return multiple threads...
BTW here is working example:
https://github.com/huttarichard/instagram-private-api/blob/master/proxy/controllers/v1/threads.js#L109
Appreciated for your quick response, Here is another error ->
Unhandled rejection ReferenceError: _ is not defined
I change the example bit later, since I did realize that you probably don't have an underscore library imported. _.first() is same as threads[0] ;)
Thanks, I just got it now. I will import underscore
And it is working as expected. Thanks a lot
@ambross no problem :P