Appearance
Chat
Who: listener on a registered device (sessions must be bound to a device); system for offline push and key fan-out.
What goes inside the encrypted envelopes (keys, padding, content JSON, attachments, sender keys, acknowledging) is in Chat content, the canonical client contract.
Entry points
| Kind | Entry |
|---|---|
| REST (keys) | PUT /messaging/keys/devices/me, PUT …/devices/me/signed-prekey, POST …/devices/me/prekeys, GET …/devices/me/prekeys/count, GET /messaging/keys/users/:userId/devices, POST /messaging/keys/users/:userId/bundles |
| REST (chats) | GET/PATCH /messaging/settings, GET /messaging/presence, GET /messaging/conversations, GET …/conversations/search, POST …/conversations/direct, POST …/conversations/groups, GET/PATCH …/conversations/:id, PATCH …/:id/state, PUT …/:id/disappearing, POST …/:id/request, members, invites, join requests, POST /messaging/invites/:code/join |
| REST (messages) | POST /messaging/messages, `PATCH/DELETE /messaging/messages/:id?scope=me |
Socket /chat | message:send, message:edit, message:delete, message:delivered, message:seen, message:played, message:react, typing:start, typing:stop, envelope:sync, senderkey:distribute, senderkey:ack, presence:ping, presence:get |
| Deep link | chat (chat/:id), chatInvite (chat/invite/:code) |
| Push | message.received (no content, collapsed per chat) |
Flow
- Keys: on first sign-in per device
PUT /messaging/keys/devices/me(identity key), signed prekey, one-time prekeys. Low stock (< 20) →keys:low→ upload more. A new identity key →messaging.keys.identity_changed→messaging.key-change-fanout→keys:changedto everyone sharing a chat. - Start a chat:
POST /messaging/conversations/direct { userId }. The recipient'swhoCanMessage(everyone, followers, mutuals, nobody) decides: allowed → normal chat; otherwise a message request in theirrequestsfolder;nobody→MESSAGING_CHAT_DISABLED. Groups:POST …/groupswith roles, invite links and join requests. - Send: fetch bundles
POST /messaging/keys/users/:userId/bundles, encrypt per device (sender keys in groups),message:send { conversationId, clientMessageId, kind, envelopes[] }. Eventmessaging.message.sent; devices online getmessage:new; offline devices getmessage.receivedviamessaging.offline-pushafter a short delay. - Request decision: recipient
POST /messaging/conversations/:id/request { accept | decline }→chat:state.requestState; eventmessaging.request.decided. Declined → sender getsMESSAGING_REQUEST_DECLINEDon send. - Receipts:
message:delivered,message:seen { upToMessageId },message:played→message:statusto the sender (subject to read-receipt visibility settings). Typing is never stored. - Delete for everyone:
message:delete { messageIds, scope: "everyone" }within the window →message:deletedto members, eventmessaging.message.deleted.scope: "me"only hides it locally. - Catch-up:
envelope:sync(orGET /messaging/devices/me/envelopes) then ack. Undelivered envelopes drop after 30 days (messaging.maintenance).
Group names and invite links
- A group always has a name. It is required on create (1–100 characters, trimmed), and the database enforces it. Renaming follows the "only admins edit info" setting and posts a
title_changeditem. - Each group has one primary link (
GET …/invites/primary).- Rotate gives it a new code; the old code stops working immediately.
- Reset revokes every link and returns a fresh primary.
- Admins can also make extra links with an expiry, a use limit and their own approval setting.
- Tapping
https://spread.plemuz.com/chat/invite/<code>(links.chatInvite) opens the guest-safe preview: name, avatar, member count and whether approval is needed, but no member list. - Joining needs sign-in; a guest is sent to sign in with a deep link back to the invite. The result is joined, or a join request when approval applies.
- A revoked, expired or used-up link gets a calm error that suggests asking an admin for a new link.
Exit states
| State | Code | Actions | Client next |
|---|---|---|---|
| Delivered | — | — | Show ticks from message:status |
| Device not bound | MESSAGING_DEVICE_REQUIRED | sign_in | Sign in again on this device |
| Recipient has no keys | MESSAGING_DEVICE_KEYS_MISSING | update_app | — |
| Device list changed | MESSAGING_DEVICE_MISMATCH | retry | Refetch bundles, re-encrypt |
| Sender key missing | MESSAGING_SENDER_KEY_MISSING | — | Distribute, resend |
| Blocked / disabled / declined | MESSAGING_BLOCKED, MESSAGING_CHAT_DISABLED, MESSAGING_REQUEST_DECLINED | — | Show the title |
| Not allowed to add | MESSAGING_ADD_NOT_ALLOWED | — | — |
| Windows | MESSAGING_EDIT_WINDOW_CLOSED, MESSAGING_DELETE_WINDOW_CLOSED | — | Offer delete for me |
| Limits | MESSAGING_MEMBER_LIMIT, MESSAGING_PIN_LIMIT, MESSAGING_FORWARD_LIMIT, MESSAGING_PREKEY_LIMIT | — | — |
| Invite | MESSAGING_INVITE_INVALID, MESSAGING_INVITE_EXPIRED, MESSAGING_JOIN_REQUEST_PENDING (wait) | as listed | — |
Notifications
message.received only. Requests and their decisions send nothing.