Closed UnbanTwin closed 7 years ago
https://github.com/huttarichard/instagram-private-api/blob/master/client/v1/thread.js#L232
Client.V1.Thread.configureText(session, userId, "text you would love to send").then((t) => console.log(t))
sorry did not read title
Client.Feed.Inbox
how to work with feeds checkout readme...
this will provide you list of threads, every thread has .configureText
or . configureMediaShare
hastag etc ... for more checkout source
Thanks! Do you mind if I keep this issue open, just in case I have any other problems to do with this?
sure
How far off am I? I have currently got the following code: ` var feed = new Client.Feed.Inbox(session);
Promise.map(_.range(0, 20), function() {
return feed.get();
})
.then(function(results) {
// result should be Media[][]
var media = _.flatten(results);
var urls = _.map(media, function(medium) {
return _.last(medium.configureText)
});
console.log(urls);
})`
However it justs returns an array of undefined
I realise all that will do is list the DMs I am still can't work out how to send one (to an existing group)
do you have an valid session?
var feed = new Client.Feed.Inbox(session, 100);
feed.all().then(function(threads) {
if (threads.length > 0)
throw new Error("..... no messeges in inbox ....")
return threads[0].configureText("text to someone")
})
.then(function(){
console.log("text sended!")
})
Sorry, I feel kinda stupid for asking all this questions, so thanks again for taking time to help me. From there how do I declare what group im sending it too, is there like group IDs or something
you need to iterate over inbox, find conversation you want to reply and then you broadcast.
threads
coming from inbox is an array [Thread]
of classes which is holding all info about thread, if you are looking for group conversation, you can inspect thread.params.title
or what ever is in thread.params
(you will find title
property and others). Once you get right thread you can just use thread.broadcast<Text, Hashtag, Profile, Medium>
and send what ever you want... Just take a look on source of thread class, it is not that complicated.
With your example:
Client.Session.create(device, storage, 'user', 'Passoword') .then(function(session) { var feed = new Client.Feed.Inbox(session, 100); feed.all().then(function(threads) { if (threads.length > 0) throw new Error("..... no messeges in inbox ...."); return threads[0].configureText("text to someone"); }) .then(function(){ console.log("text sent!") }); });
It throws the error, ......No messages in inbox......
Even though there is. However if I comment that out, it throws thread[0].configureText is not a function
Crap I just put the password to tes the account in that, I have edited it now, but I realise the email notifying you about the post will have it in :/
@wizardsambolton you just got pwned :D
im going to investigate what is going on hold on
Thanks!
@wizardsambolton I actually try this with your account, but got checkpoint since you we are using different ip. However with my account it is working... So, try npm update
library should be at version 0.5.1
, then try different account, must be sure there are some threads conversation in inbox. Also try Thread.approveAll()
.
Ok will do.
and if nothing helps try to run git clone on repository ... run npm test
and insert credentials when it ask you..
Thanks!
Well it did not work, so I am going to try doing what you said!
Ok from that I got 1 failed test
put it here, but I just try it with your account and got all threads, first one s group conversation, of mar.fmf,sophia_c_sprenkel,loulee.jones,helena_cookies,tbh.lozzer,hopefoxhope, feel free to tell me if I should delete it...
you are doing something wrong...
Strange :/ I have no clue what im doing wrong though :/ (Also it would be nice for you to delete it, but not yet, as it may be useful to help xD)
no I mean, delete the names I mentioned...., your account is safe with me because you are going to change password as soon as you get what you working on ...
put the failiture you got from tests...
Yeah, you dont need to delete the names its fine dw.
Ok will do one sec
Unhandled rejection AssertionError: expected '340282366841710300949128132075360282508' not to be '340282366841710300949128132075360282508' (false negative fail)
at Assertion.fail (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/should/lib/assertion.js:92:17)
at Assertion.Object.defineProperty.value (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/should/lib/assertion.js:174:17)
at /Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/tests/cases/feeds/inbox.js:73:43
at tryCatcher (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/promise.js:510:31)
at Promise._settlePromise (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/promise.js:567:18)
at Promise._settlePromise0 (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/promise.js:612:10)
at Promise._settlePromises (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/promise.js:691:18)
at Promise._fulfill (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/promise.js:636:18)
at Promise._resolveCallback (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/promise.js:431:57)
at Promise._settlePromiseFromHandler (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/promise.js:522:17)
at Promise._settlePromise (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/promise.js:567:18)
at Promise._settlePromise0 (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/promise.js:612:10)
at Promise._settlePromises (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/promise.js:691:18)
at Promise._fulfill (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/promise.js:636:18)
at Promise._settlePromise (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/promise.js:580:21)
at Promise._settlePromise0 (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/promise.js:612:10)
at Promise._settlePromises (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/promise.js:691:18)
at Promise._fulfill (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/promise.js:636:18)
at Promise._settlePromise (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/promise.js:580:21)
at Promise._settlePromise0 (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/promise.js:612:10)
at Promise._settlePromises (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/promise.js:691:18)
at Promise._fulfill (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/promise.js:636:18)
at Promise._settlePromise (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/promise.js:580:21)
at Promise._settlePromise0 (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/promise.js:612:10)
at Promise._settlePromises (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/promise.js:691:18)
at Promise._fulfill (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/promise.js:636:18)
at Promise._settlePromise (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/promise.js:580:21)
at Promise._settlePromise0 (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/promise.js:612:10)
at Promise._settlePromises (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/promise.js:691:18)
at Promise._fulfill (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/promise.js:636:18)
at Promise._resolveCallback (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/promise.js:431:57)
at Promise._settlePromiseFromHandler (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/promise.js:522:17)
at Promise._settlePromise (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/promise.js:567:18)
at Promise._settlePromise0 (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/promise.js:612:10)
at Promise._settlePromises (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/promise.js:691:18)
at Promise._fulfill (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/promise.js:636:18)
at Promise._resolveCallback (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/promise.js:431:57)
at Promise._settlePromiseFromHandler (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/promise.js:522:17)
at Promise._settlePromise (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/promise.js:567:18)
at Promise._settlePromise0 (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/promise.js:612:10)
at Promise._settlePromises (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/promise.js:691:18)
at Promise._fulfill (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/promise.js:636:18)
at Promise._resolveCallback (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/promise.js:431:57)
at Promise._settlePromiseFromHandler (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/promise.js:522:17)
at Promise._settlePromise (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/promise.js:567:18)
at Promise._settlePromise0 (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/promise.js:612:10)
at Promise._settlePromises (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/promise.js:691:18)
at Promise._fulfill (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/promise.js:636:18)
at PromiseArray._resolve (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/promise_array.js:125:19)
at PromiseArray._promiseFulfilled (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/promise_array.js:143:14)
at Promise._settlePromise (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/promise.js:572:26)
at Promise._settlePromise0 (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/promise.js:612:10)
at Promise._settlePromises (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/promise.js:691:18)
at Async._drainQueue (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/async.js:138:16)
at Async._drainQueues (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/async.js:148:10)
at Immediate.Async.drainQueues [as _onImmediate] (/Users/sambolton/Documents/Github1/InstagramPCDM/test/instagram-private-api/node_modules/bluebird/js/release/async.js:17:14)
at processImmediate [as _immediateCallback] (timers.js:383:17)
1) should not be problem to get threads
Ok test is failing because you have only 4 conversations in inbox... which leads to failiture ... should be repaired, but it is not an bug in library...
run suite again but put console.log in it, you will find what is going on, how to respond to thread...
Sory feel like im being stupid, but put console.log where?
@huttarichard
tests directory, there is describe block with Inbox class
specs so start over there...
I am so sorry to keep bothering you :/ however I added cnsole.log to the top of the describe block, however when I ran it I got tons of errors, so I removed it, and ran it again, and I am still getting the errors
I know that starting with programming can be hard, but if you do it by yourself, it is much easier then. Learn, inspect try more, this library is great source of learning. Good luck.
and google a lot man, for example you can start with promises and then continue to mocha
I am sorry to open a new issue, however your documentation on this part of the API is limited. Would it be possible to give me an example? Sorry to cause you hassle.