Giter Club home page Giter Club logo

Comments (3)

ramtinak avatar ramtinak commented on September 5, 2024 2

Here:

public async void CheckDMSeen()
{
    var inboxResult = await InstaApi.MessagingProcessor.GetDirectInboxAsync(PaginationParameters.MaxPagesToLoad(1));
    if (inboxResult.Succeeded)
    {
        // lets check all threads
        var allThreads = inboxResult.Value.Inbox.Threads;
        // or single thread:
        // var singleThreadResult = await InstaApi.MessagingProcessor.GetDirectInboxThreadAsync(allThreads[0].ThreadId, PaginationParameters.MaxPagesToLoad(1));

        foreach (var thread in allThreads)
        {
            var user = thread.Users.FirstOrDefault().UserName;
            var reversed = thread.Items;
            reversed.Reverse();
            int ix = 0;
            if (thread.LastSeenAt.LastOrDefault() != null)
            {
                var lastSeenAt = thread.LastSeenAt.LastOrDefault();
                var itemId = lastSeenAt.ItemId;
                var single = reversed.FirstOrDefault(a => a.ItemId == itemId);
                var index = reversed.IndexOf(single);
                if (index != -1)
                    ix = thread.Items.Count - (index + 1);
                Console.WriteLine($"{user} has ({ix}) new messages, last message seen at {lastSeenAt.SeenTime}");
                Console.WriteLine();
            }
            else
                Console.WriteLine($"{user} isn't seen any message");
        }
    }
}

from instagramapisharp.

ramtinak avatar ramtinak commented on September 5, 2024 1

Hi,
By default You can't. Instagram doesn't have any official API to detect this.

Bu you can do this by checking some extra values from direct thread. I don't remember what was it ( I don't do programming like before).
I'll search for you and leave a new reply for this.

from instagramapisharp.

MohUnlimited avatar MohUnlimited commented on September 5, 2024

thank you
I'll check it

from instagramapisharp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.