Is there currently no way to write or answer direct messages?

  • darklightxi@lemmy.worldM
    link
    fedilink
    arrow-up
    3
    ·
    4 months ago

    Just wanted to chime in here - I also think having a chat-style widget would also be best for private messages but would be difficult to implement without some workarounds (mainly due to the limitations of the API as you mentioned)!

    But then I discovered that there’s no API call to retrieve your sent messages

    From what I can see in the API, there is a creatorId field that can be specified to grab chats for a given user. This could potentially work by passing in your own account id to retrieve your sent messages (although, this would likely return back your sent messages aggregated across all users so it wouldn’t be ideal)

    It would be a bit of a hack but we could call that API endpoint, and cache the results locally to be used in chats. This adds a layer of complexity since we would need to consider how to keep messages synced up (e.g., if a user edits a message elsewhere, it should be reflected here). There also doesn’t seem to be a way to get a specific private message by id, so that also complicates the issue further 😅

    • AnActOfCreation@programming.dev
      link
      fedilink
      arrow-up
      2
      ·
      4 months ago

      Thanks for the explanation! I just tried the API passing my own user ID as the creator_id and I seem to be getting back all messages. :( If they can add an endpoint or parameter to get a “conversation” (i.e., all messages incoming/outgoing to/from a specific user) then a chat-style interface would be much easier to implement!

      • MentalEdge@sopuli.xyz
        link
        fedilink
        arrow-up
        3
        ·
        edit-2
        4 months ago

        Yeah, this is exactly the problem I’ve been planning to eventually solve. It’s not an ideal way to lay out DMs, so an app that puts in some work to make it nicer to interact with DMs has been on my wish-list for Lemmy.

        I intended to do so essentially either by maintaining a local database of messages as suggested by @darklightxi@lemmy.world, or, by loading one page at a time, and transforming that into the several conversations.

        Then, the “end” of any list (the bottom of the conversation list, or the top of a chat) would have a “load more” button to load more pages, the contents of which would just end up in their respective conversations.

        I hadn’t thought of the fact that DMs can be edited, so the latter option is likely better instead of a local database.

        It would serve 99% of cases where you’re having back and forths with just a couple users, where your most recent DMs would always show up with their most recent messages.