-
Notifications
You must be signed in to change notification settings - Fork 8
Direct Messaging
Rahil khan edited this page Mar 14, 2024
·
2 revisions
This library supports direct messaging with mobile authentication. This means you will need a bearer token to use this. Let us explore some of the methods:
First of all, get a thread
DirectMessaging dm = insta.directMessaging();
Thread thread = dm.getThread("threadID");
thread.sendMessage("Hello world", true);
thread.unsend("messageID");
thread.markSeen();
and then do whatever you want.
List<Thread> threads = dm.listThreads(numberOfThreads,numberOfMsgPerThread);
List<Message> messages = thread.getMessages(50);
This method follows auto pagination, which means, that every call of this method will return you the next messages from the thread.
You can now get all the info about the message like this,
String message = messages.get(0).message;
Note: If the itemType
is media, then the message will be the download link of that media, text otherwise.
That's all you need to know about the direct messaging of JxInsta.