question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to retrieve Direct Messages and get the message content and title

See original GitHub issue

How would I get the message content and title from sent DMs using this API? I can send it like this but I have no idea on how to parse the recieved Direct Messages from others?

function sendDM(user, text) {
    // Either gain already gained session
    var session = new Client.Session(device, cookiePath);
    // Or if we cant, create a new session
    var promise = Client.Session.create(device, cookiePath, 'username', 'password');

    promise.then(function(sessionInstance) {
        // Search for the User
        Client.Account.searchForUser(session, user)
         .then(function(accountInstance) {
            var userId = accountInstance.id;

            // Send a DM
            Client.Thread.configureText(session, userId, text)
             .then(function(threads) {
                var thread = threads[0];
                //thread.broadcastText(text);
                console.log(thread.items) // -> see conversation
            });
         });
    });
}

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:14

github_iconTop GitHub Comments

2reactions
huttarichardcommented, Jul 20, 2016

you need to first learn how to debug application in node.js how to use console.log() and inspect properties 😉 it is necessary for any node.js development. Check this out it is a great start https://www.codeschool.com/learn/javascript

1reaction
huttarichardcommented, Mar 4, 2017

@sagardalal21 @Epexa this is really old source and issue, I got rid of Proxy Server because it was nonsense… Make pooling your self it is not hard…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Understand direct messages - Slack
Access your direct messages · Tap the DMs tab to browse all of your DMs. · Tap the Jump to… field to search...
Read more >
How to Direct Message (DM) on Twitter - Twitter Help Center
Under Direct Messages, and next to Receive messages from anyone, check the box to allow anyone to send you Direct Messages. To change...
Read more >
How to read private messages with PRAW? - Stack Overflow
Use message.text to get the content, and message.subject to get the title. Share.
Read more >
Create direct messages and spaces - Android - Google Support
In Chat, you can send a direct message to individuals or groups. Direct messages are private conversations between you and other people. Once...
Read more >
Messaging - Messenger Platform - Meta for Developers
Standard Messaging · User sends a message to the Page · User clicks a call-to-action button like Get Started within a Messenger conversation...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found