Skip to content

feat: push messages in Remotes from the API - #665

Merged
xHeaven merged 9 commits into
dev-null-sh:productionfrom
simonhamp:feat/api-remotes-messages
Oct 22, 2026
Merged

xHeaven merged 9 commits into
dev-null-sh:productionfrom
simonhamp:feat/api-remotes-messages

Conversation

@simonhamp

Copy link
Copy Markdown
Contributor

Lets the mobile app push messages in Remotes, the way the web's composer does. 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.

This one is stacked on #654, because it answers with that PR's MessageResource. Until #654 merges, the diff here shows its commit too. Only the last commit, "feat: push messages in Remotes from the API", belongs to this PR.

Endpoints

Signed, through the web's messages limiter (30 a minute).

Request Answer
POST /api/v1/remotes/@{username}/messages 201 with the message in data, the way a thread shows it
POST /api/v1/remotes/orgs/{id}/messages The same

The body takes the web's fields:

  • body, up to 2,000 characters
  • client_id, a UUID the app makes
  • optional reply_to_id
  • optional link_preview_url, one of the body's links, or "" for no card

Sending the same client_id again, as a retry does, answers 200 with the message already created, so it's never stored twice. A first message to someone starts the conversation, which opens for them or lands in Fetched, as on the web.

Rules kept from the web

The form requests copy the web's and reuse CreateConversationMessageRequest::messageRules(), and the actions are the web's own (CreateConversation, CreateMessage).

  • A message that can't go yet is a 403 with the web's own sentence for each case: merge the partner's request first, the user's own request is still waiting, the partner doesn't follow them while requests are off, or the partner has Remotes off.
  • It's a 404 while the user has Remotes off, for themselves, across a block, and for an org they aren't in.
  • Emoji shortcodes, mentions, link cards and unstashing all happen in CreateMessage, as on the web.

Images

messageRules() already takes images and image_descriptions, but a signed request can't carry files yet. Signed bodies have to be JSON. The commit images PR adds multipart signing to SignedRequests for every signed endpoint, so images work here as soon as that lands. Nothing in this PR depends on it.

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,300 PHP tests at 100% coverage.

@simonhamp
simonhamp marked this pull request as ready for review October 20, 2026 00:24
@xHeaven
xHeaven merged commit 3806984 into dev-null-sh:production Oct 22, 2026
5 checks passed
@simonhamp
simonhamp deleted the feat/api-remotes-messages branch October 22, 2026 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants