Instagram-private-api: How to send a direct message using this library?

Created on 8 Sep 2017  路  11Comments  路  Source: dilame/instagram-private-api

How can I DM another user using this?

Most helpful comment

Simple as that :)

Client.Thread.configureText(session, '6042842778', '袛邪 蟹写褉邪胁褋褌胁褍械褌 锌褟褌薪懈褔薪褘泄 写械锌谢芯泄')

All 11 comments

U can find in thread.js and function configureText

How do I use the function though?

const Client = require('instagram-private-api').V1;
const device = new Client.Device('user');
const storage = new Client.CookieFileStorage(__dirname + '/cookies/user.json');

Client.Session.create(device, storage, 'user', 'password')

what now? How do I send the message "hey there" to the user other?

Client.Session.create(device, storage, 'user', 'password')
  .then((session) => { 
    return [session, Client.Account.searchForUser(session, `other`)];
  })
  .spread((session, account) => {
        return Client.Thread.configureText(session, account.id, `hey there`);
  });

i think maybe it work

Thank you, I can't test it for 6 hours unfortunately but will get back to you when I do.

Out of interest, I notice you are using the new template strings most of the time; why? You're the first person I've seen who does this, is it becoming standard or just a personal preference?

You can said string template in other and hey there ?
it just represent your parameter in code

Okay, never mind. I just tested it and it worked perfectly, thank you so much for your help!

Simple as that :)

Client.Thread.configureText(session, '6042842778', '袛邪 蟹写褉邪胁褋褌胁褍械褌 锌褟褌薪懈褔薪褘泄 写械锌谢芯泄')

I don't understand. What values do we substitute in for 'user'? When I run the code it keeps saying user.json does not exist on my computer. How do I create this json file correctly?

@jblewdv just give your username and password to Client.Session.create()
And create the path to cookie file in your computer. On first running of the code, cookies json file is created.

can we send photos and videos?

Videos not yet but photos are supported

Was this page helpful?
0 / 5 - 0 ratings

Related issues

350d picture 350d  路  53Comments

zalkanorr picture zalkanorr  路  12Comments

delmotte picture delmotte  路  61Comments

sagardalal21 picture sagardalal21  路  39Comments

ciolt picture ciolt  路  35Comments