Repository navigation
feat: list and open conversations in Remotes from the API - #654
Merged
xHeaven merged 7 commits intoOct 22, 2026
Merged
Conversation
This was referenced Oct 19, 2026
simonhamp
marked this pull request as ready for review
October 19, 2026 23:44
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Lets the mobile app read Remotes: the inbox, a thread with a person or an org, and marking a thread pulled. It's one of a few small PRs that bring Remotes to the app (NativePHP/dev-null-app) on top of the signed API from #130. Sending messages, reactions, stashing, requests, typing and the settings each have their own PR.
The endpoints use the web's queries (
ConversationsQuery,ConversationThreadQuery) and actions, and copy the web's form requests, so the rules are the same:404while the user has Remotes off, for someone across a block, for themselves, and for an org they aren't in. They also go through the web'sconversationslimiter (300 a minute) on top of the API's 120.Endpoints
All signed, except the image URL, which is signed in its own way (see below).
GET /api/v1/remotes?tab=&q=&before=has_more,unread_countandrequests_countGET /api/v1/remotes/@{username}/messages?after=&before=&reactions_after=dataGET /api/v1/remotes/orgs/{id}/messages?after=&before=&reactions_after=dataPUT /api/v1/remotes/@{username}/readwiththrough204PUT /api/v1/remotes/orgs/{id}/readwiththrough204GET /api/v1/remotes/messages/{id}/link-preview{"link_preview": …}, for a card that was still pendingGET /api/v1/remotes/images/{id}?expires=&user=&signature=tabisopen(the default),stashed, orfetchedwhileremotes.requestsis on.qmatches a name or handle, andbeforeis a conversation id.A conversation in the inbox has
id,kind,name,partner(a user, ornullfor an org),members(for an org),last_message,last_message_at,ahead,partner_read_through_id,partner_read_atandis_archived, the same fields the web gets.A thread has the same fields as the web's poll:
messages,has_older,reactions_version,reaction_changes,read_through_idandaccess. A one-to-one thread addspartner,partner_read_through_id,partner_read_atandpartner_typing. An org addsorg(id,name),members(withroleandread_through_id),typing(usernames) androle. Someone the user hasn't talked to yet gets an empty thread whoseaccesssays whether a first message can go to them.A message has
id,user_id,client_id,body,body_segments,mentions,reply_to_id,reply_to(id,user_id,body,images_count),link_preview,images,reactions,event,subject_idandcreated_at, plususerandsubjectin orgs. Users areUserResources, so they come withlanelike everywhere else in the API.Things to look at
/remotes/images/{id}needs a session, and the app's image views can't sign a request. So each image in a thread comes with a URL signed for the user. It expires at midnight UTC the day after tomorrow, which keeps it the same all day and lets the app cache the image. The endpoint checks that the user in the URL can still see the message, so someone removed from an org loses the image straight away. The signature is relative (signed:relative), so a proxy that changes the scheme or host doesn't break it. The route skips the API's per-IP guest limit, because a thread full of images would hit it. The web's route has no limit either.mentionsis a map of username to id. Here it's the same{username, offset, length}positions that commits use, filtered to the people the message actually links, so the app can reuse its commit renderer./remotes/@xpage marks the thread read when it renders. Here the app callsPUT …/readitself, the way the web's JSON poll works.last_message_atandpartner_read_atcome straight from the queries, in theirtoJSON()format. Messages usetoIso8601ZuluString()like the rest of the API. Happy to normalise them if you'd rather.@varin the resources, since aJsonResourcecan't type its resource.Testing
Everything CI runs passes on this branch locally: Pint, Rector, the JS lint, PHPStan, tsc, type coverage, the JS unit tests, and all 3,279 PHP tests at 100% coverage.