Messages

Help

Everything Messages does and how to use it, from your first note to connecting your own scripts and AI assistants.

Getting started

Signing in and out

Messages has no sign-up form of its own. Your account lives on a hosted sign-in page that every HomeLab app shares.

How to

  1. Select Sign in on the home page.
  2. Sign in with your username and password, or with Google when it's offered.
  3. You come back signed in. To sign out, open the menu under your photo in the top right and choose Sign out.

Good to know

  • If you're already signed in to another HomeLab app in this browser, Messages signs you in without asking. Signing out signs you out of those apps too.
  • Accounts are created by invitation. Ask the person who runs this server for one.

The tour

The first time you open Messages in a browser, a short tour shows what each part does, with sample content. Its last step brings you to this page.

Good to know

  • Close it at any time with ✕ or Escape, or with Skip on its first step. It doesn't come back on its own in that browser.
  • Take it again with the Take the tour button at the top of this page.

Messages

Conversations

Talk one to one with anyone in Messages. What you write and send is encrypted on your device: only you and the other person can read it.

How to

  1. Open Messages from the sidebar. It's the first page you see after signing in.
  2. Select the pencil, type the start of someone's handle, and pick them. Their conversation opens; there is only ever one with each person.
  3. Type and press Enter to send. Shift + Enter starts a new line, and Esc cancels a reply or an edit.
  4. Select the paperclip to send a photo, a video, audio, or any file.
  5. To send a voice message, leave the field empty and select the microphone where Send is. Select Send when you're done, or the bin to discard it; Esc discards it too.
  6. To call, select the phone (a voice call) or the camera (a video call) at the top of the conversation. The other person's Messages rings for 30 seconds; when they answer, the call opens full screen. Hang up ends it for both of you.
  7. Open a message's ⋯ menu to reply, copy, edit, or delete it. You can edit and delete only your own messages.

Good to know

  • One tick means sent; two mean the other person has read it. A green dot means they were online in the last two minutes.
  • A file can be up to 25 MB, or 50 MB for a video. A voice message can be up to 15 minutes; it sends itself when it gets there.
  • Calls ring only while Messages is open in a tab; allow notifications to see one when the tab is in the background. Calls work on the home network. A call you miss stays in the conversation as Missed call.
  • Deleting a conversation deletes it for both of you, with every message and file. Deleting a message deletes it for both of you too.
  • New messages and reads show up at once while Messages is open in a tab. Nothing pops up outside the browser.
Open Messages

End-to-end encryption

Your messages and files are encrypted on your devices before they leave them. The server keeps only what it can't read, and never your passphrase.

How to

  1. The first time you sign in, choose an encryption passphrase of at least 10 characters. It's separate from your sign-in password.
  2. Each time you sign in, on any device, Messages asks for it before showing anything. Signing out forgets it on that device.
  3. To choose a new one, open Account and select Change passphrase under Encryption.

Good to know

  • Nobody can recover a forgotten passphrase. Forgot it? on the unlock screen resets encryption: you choose a new passphrase, and your earlier messages stay unreadable to you. The other person can still read them.
  • The server sees who you talk to, when, and how large files are, never what you write or send. Administrators, AI assistants and Assistant can't read your messages either.
  • A message waiting for its key opens once the other person's app is next open: their app shares the key with you.

Your handle

People find you by your handle, such as @ada. Messages picks one from your sign-in the first time; you can change it, and add a status line, on the Account page.

Good to know

  • A handle is 3 to 30 letters, digits, or underscores. Nobody else can have the same one, in any mix of capitals.
  • A status line is up to 120 characters, and shows to the people you talk to.

Notes, files, and AI

Attachments

Keep files with your account: documents, images, audio, video, and archives.

How to

  1. Open Attachments from the sidebar.
  2. Drop a file on the dashed box, or select the box or Upload to browse for one.
  3. Select an image to see it full screen. Escape, ✕, or a click closes it.
  4. Select Download to save a file, or the bin to delete it. Deleting can't be undone.

Good to know

  • Each file can be up to 50 MB, and the server accepts images, PDFs, text, audio, video, and zip archives. Whoever runs the server can change both limits.
  • Files upload one at a time. If you drop several, only the first one is uploaded.
  • Files go straight from your browser to storage, so a large upload doesn't slow the app down.
Open Attachments

Notes

Short text notes, newest first. Each note can be up to 10 000 characters.

How to

  1. Open Notes from the sidebar.
  2. Type in the box at the top and select Add Note, or press ⌘ + Enter (Ctrl + Enter on Windows and Linux).
  3. Select Load more at the bottom of the list to see older notes.
  4. Select Mark as read under a note marked Unread to read it.
  5. Select the bin under a note and confirm to delete it.

Good to know

  • On the web you write, read, summarize, and delete notes. Editing a note and adding photos to it happen in the mobile app.
  • Deleting a note keeps the photos you added to it; they stay in Attachments.
  • The red number on Notes in the sidebar counts your unread notes. A note you write is read from the start; only the daily greeting arrives unread.
Open Notes

Dictation

Speak a note instead of typing it.

How to

  1. On the Notes page, select the microphone in the corner of the text box.
  2. Speak. Your words are added to whatever is already in the box.
  3. Select the microphone again to stop, then save the note as usual.

Good to know

  • Your browser asks for microphone access the first time.
  • Browsers with built-in speech recognition, such as Chrome, Edge, and Safari, write as you speak. Others record your voice and send it to the server's AI when you stop, which needs AI to be set up.
  • If your browser's speech recognition doesn't work, Messages says so, and records your voice instead the next time you select the microphone.
  • The microphone appears only when your browser can do one or the other. Dictation listens in Messages's language.

Voice commands

Tell Messages what to do, out loud or in writing: add a note, open a page, change the look, or ask the AI.

How to

  1. Select the microphone in the header. Messages starts listening.
  2. Say one command, such as “Create a note buy milk” or “Open settings”. When you stop speaking, Messages does it and says what it did.
  3. Or type the command in the box and press Enter. Select an example under the box to start from it.
  4. Select Undo to take back a note you just added or added to. Deleting a note or signing out asks you first.

Good to know

  • Messages knows these without AI: “Create a note …” (or “Note: …”, “Write down …”), “Add … to my last note”, “Summarize my last note”, “Delete my last note”, “How many notes do I have”, “Open …” or “Go to …” followed by Attachments, Notes, Chat, Activity, Account, Settings, or Help, “Switch to dark mode” (light, or system), “Use the Signal design” (or Soft), “Make it blue” (any of the five accents), “Ask the AI …”, “Mark all notifications read”, and “Sign out”.
  • With AI set up on this server, other wording works too, and you can name a note by what it says, such as “delete the note about the trip”. To find that note, the AI sees the opening words of your 20 newest notes.
  • Summaries and Ask the AI need AI on this server, like the same actions elsewhere in Messages.
  • Your browser asks for microphone access the first time. Browsers without built-in speech recognition record your voice and send it to the server's AI when you select Stop.
  • Browsers listen only on a secure (https) address, or when Messages runs on your own computer. Elsewhere, type the command instead.
  • Commands are in English, one action at a time, even when Messages is in another language. The panel listens in English and answers in Messages's language.
  • “Use the Signal design” (or Soft) also turns off Typewriter, Modern, 1904, or Cyberpunk 2226 if one is on.

Voice mode

Talk instead of typing, hands-free: on Notes every pause saves what you said as a note, and in Chat every pause sends it and the reply can be read aloud.

How to

  1. On the Notes or Chat page, select Voice mode at the top. Messages starts listening and keeps listening until you select Stop.
  2. Speak. The words appear under the button as they are heard.
  3. Pause. On Notes, what you said becomes a new note; select Undo on the message that appears to take it back. In Chat, it is sent, and the reply appears as it is written.
  4. Select Send to save or send at once instead of waiting for the pause, or Stop to turn voice mode off.

Good to know

  • Voice mode listens and speaks in Messages's language.
  • In Chat, Read replies aloud reads each reply in your browser's voice before Messages listens again. It's a switch at the top of Chat, kept in this browser.
  • While a reply is being written or read, Messages doesn't listen, so it never hears itself.
  • Browsers without built-in speech recognition record instead: select Send when you have finished speaking.
  • The microphone works only on a secure (https) address, or when Messages runs on your own computer; elsewhere Voice mode says so and stays off. Chat needs AI on this server; notes don't.
  • The mobile app has voice mode too, on Notes and Chat.

Note summaries

A one-click AI summary of any note.

How to

  1. On the Notes page, select Summarize under a note.
  2. The summary appears inside the note.

Good to know

  • Summaries aren't saved. They disappear when you leave the page, and you can ask again at any time.
  • If AI isn't set up on this server, you see a message saying so instead.

Assistant

A conversation with the language model this server uses. Answers appear as they're written.

How to

  1. Open Assistant from the sidebar.
  2. Type a message and press Enter to send it. Shift + Enter starts a new line.
  3. Select Stop to cut an answer short. What arrived so far stays.

Good to know

  • The conversation lives on the page only. Leaving or reloading the page starts a new one.
  • The model sees your 20 most recent messages, so in a long conversation it forgets the beginning.
  • Assistant can't see your notes, files, or messages. To get the gist of a note, use Summarize on the Notes page.
Open Assistant

Activity

Everything you've done, newest first and grouped by day.

How to

  1. Open Activity from the sidebar.
  2. Choose All, Business, or Technical to filter the list.
  3. Select the note, file, or key under an entry to go to it, while it still exists.

Good to know

  • Business is your notes and files. Technical is signing in and out, appearance and photo changes, API keys, AI use, and anything an administrator did to your account.
  • Changes to your notes and files count wherever you make them: the mobile and desktop apps, your scripts, and AI assistants too.
Open Activity

Notifications

The bell in the header tells you when something happens, like a note added or a file uploaded. The number on it is how many you haven't read.

How to

  1. Select the bell to see your latest notifications, newest first.
  2. Select one to mark it read and open what it is about.
  3. Select Mark all read to clear the number.
  4. Select Load more at the bottom of the list for older ones.

Good to know

  • While Messages is open, a new notification appears at once, with a short message at the edge of the window. Nothing pops up outside the browser, or when no Messages tab is open.
  • Note added comes whenever you write a note: on the web, in the mobile or desktop app, from a script, or from an AI assistant.
  • File uploaded comes from the server's background worker once it has handled the upload. Where the server runs no worker or message queue, uploads raise no notification.
  • Notifications are only about your own notes and files. The mobile and desktop apps don't show them; the web app shows the ones they cause.
  • Marking notifications read doesn't appear in your Activity.

Daily notes

Every day at midnight (the server's time), Messages adds a note that greets you with the new date, such as "Hi! Today is Sunday, October 25, 2026.", and at 07:00 a note that says "Good morning".

Good to know

  • The midnight greeting arrives unread: it is marked Unread and counted in the red number on Notes, on the web and in the mobile app, until you select Mark as read or open it in the mobile app.
  • Good morning stands in for a real daily summary and arrives read. Delete either like any other note.
  • The server's background worker writes both. Where the server runs no worker, no daily notes arrive.

Your account

Account and photo

Your profile, your profile photo, your API keys, and how to connect your own scripts, AI assistants, and services.

How to

  1. Open Account from the menu under your photo.
  2. Select Change photo, or the camera on your picture, and choose an image.
  3. Select Remove to go back to the picture from your sign-in provider.

Good to know

  • Messages crops the image to a square and shrinks it before uploading, so a PNG, JPEG, WebP, or GIF of any size works.
  • A photo uploaded here replaces your sign-in provider's picture in every HomeLab app.
  • Your name, email, password, and connected accounts belong to the sign-in service, not to this page.
  • Below your profile are API keys, then API, AI assistants (MCP), and Events (NATS): the first request to try, the command that connects an assistant, and the events other services can react to, with this site's address filled in. See Scripts and AI assistants below.
Open Account

Appearance, size, and language

Choose how Messages looks and reads: a theme, an accent color, light, dark, or system mode, the interface size, and the language — for all your apps at once, or for Messages alone.

How to

  1. Open Settings from the menu under your photo.
  2. Under Settings, choose Global to change your global settings, which every HomeLab app follows, or This app only to give Messages its own here.
  3. Pick a theme: Soft or Signal, or one of the looks Typewriter, Modern, 1904, and Cyberpunk 2226. Each card previews itself.
  4. Pick a mode (Light, Dark, or System) and one of five accents.
  5. Under Interface size, select Smaller or Larger to make text, buttons, and spacing smaller or larger, from 60% to 150%. Reset to 100% puts it back.
  6. Under Language, choose System, English, or Русский.
  7. Select Reset appearance to put the theme, mode, and accent back.

Good to know

  • Changes apply at once. Global settings are saved to your account: your other HomeLab apps follow them — in this browser when you next open their tab, and in the mobile and desktop apps within half a minute of coming back to them — and a new browser picks them up when you sign in there.
  • This app only keeps Messages's settings in this browser; the first time, they start from what you see. Your other apps keep your global settings, and switching back to Global shows them here again.
  • Older HomeLab apps know only Soft and Signal: under a look they show the design system underneath, and they still follow the mode and the accent.
  • Modern keeps its red, 1904 its ink, and Cyberpunk 2226 its neon, whatever the accent. Typewriter takes the accent, like Soft and Signal.
  • Smaller and Larger are also in the menu under your photo, so you can change the size from any page.
  • System follows your browser's language when it is English or Russian, and English otherwise. Messages from the server, the API reference, the component gallery, and voice commands stay in English.
Open Settings

Devices

Every place you're signed in to Messages: browsers, the phone and desktop apps, and AI assistants.

How to

  1. Open Devices from the menu under your photo.
  2. Find a device by its name, kind, and when it was last seen. This device is marked.
  3. Select Rename to give a device a name you'll recognize.
  4. Select Sign out to sign a device out from here.
  5. Select Control on a browser or the desktop app while it's open (Online) to move it from here: open a page or a note, step to the next or previous note, scroll, or go back.

Good to know

  • A browser is signed out at its next request; the phone and desktop apps show their sign-in screen. Signing in on one again brings it back as a new device.
  • An AI assistant you sign out stays out until you select Allow again.
  • Select Forget to take a device you signed out off the list.
  • Scripts and assistants can see the list too: GET /api/devices, or the MCP tool list_devices. Renaming, signing out (POST /api/devices/sign-out) and forgetting a device need you signed in, not an API key.
  • Signing a browser out here doesn't end its sign-in at Logto: for a browser you've lost, change your password too.
  • An open browser or desktop app listens for commands on GET /api/devices/stream; POST /api/devices/command?id= sends one, and the MCP tool control_device does the same. The device says who moved it.
Open Devices

Servers

Messages runs on more than one HomeLab server, such as warsaw and minsk, each with its own accounts, notes, and files. Your list of servers is kept in your account, and the web app and the mobile app switch between them.

How to

  1. Open Settings from the menu under your photo, then Servers. The one you're on is marked This server; the menu under your photo shows it too.
  2. To add one, type a Name and its Address, then select Add server. An IP such as 192.168.1.50 is enough: it becomes Messages's address on that server.
  3. Select the pencil to rename a server or change its address, and the bin to remove it from your list.
  4. Select Switch to open another server and sign in there. Messages then asks whether to add the servers you brought that aren't in your list there yet.

Good to know

  • Each server keeps its own copy of your list, in your account there. Switching merges your list into it: nothing is removed, and the names it already has stay.
  • Switching doesn't move notes or files: each server has its own.
  • This server is always in the list, and only its name can change.
  • A list holds up to 20 servers.
  • In the mobile app the list is in Settings, under Servers. There, switching signs you in on the other server. It can sign in only on a server set up for it.
Open Settings

Other apps

Mobile app

Messages for iPhone and Android, with the same account.

What you can do

  • Notes: write, read, edit, and delete, and add photos to a note. An unread note is marked in red and counted on the Notes tab; opening it reads it.
  • Photos: upload them, and open any photo full screen with zoom.
  • Share text, links, or images from other apps into Messages. They become a note or attachments.
  • AI chat, note summaries, and dictation on the phone itself, and voice mode on Notes and Chat (the waves button), which can read replies aloud.
  • Settings (Account, then the gear): Global or This app only, the six themes, mode, accent, interface size, and language. The app speaks English and Russian, or follows your phone's language.
  • Servers: in Settings, your server list, and switching to another server, which signs you in there.

Desktop app

A native app for macOS and Windows, with the same account.

What you can do

  • Notes: list, write, and delete.
  • Attachments: upload, preview images, download, and delete.
  • Dictation, where the system supports speech recognition.
  • Settings in the sidebar: Global or This app only, the six themes, mode, accent, interface size, and language (English or Russian). The button in the header steps through light, dark, and system.

Good to know

  • AI chat and summaries are on the web and in the mobile app.
  • It doesn't mark unread notes; the web and mobile apps do.

Scripts and AI assistants

API keys

A key lets your own scripts and AI assistants use your notes and files. It acts as you.

How to

  1. Open Account, then API keys.
  2. Name the key after where it will live, and choose when it expires: 30 days, 90 days, 1 year, or never.
  3. Copy the key when it appears. It starts with stk_ and is shown only once.

Good to know

  • You can have up to 10 keys. The list shows when each was last used and when it expires.
  • Keys are created and revoked on the web only.

The API

Every Messages app uses one JSON API, and your key opens it to your scripts. Everything acts on your own data only.

The API lives at https://<this site>/api. Send your key as a Bearer token. Requests and answers are JSON, and an error is { "error": "…" }. Lists come a page at a time: pass the answer's nextCursor back as ?cursor=.

export MESSAGES_KEY=stk_…

# Your notes, newest first
curl -H "Authorization: Bearer $MESSAGES_KEY" https://<this site>/api/notes

# Write one
curl -X POST -H "Authorization: Bearer $MESSAGES_KEY" -H "Content-Type: application/json" \
  -d '{"content":"Hello from curl"}' https://<this site>/api/notes

Every endpoint, with what it takes and answers: the API reference

Files go straight to storage, in three steps:

# 1. Ask for an upload link (it creates a pending file)
curl -X POST -H "Authorization: Bearer $MESSAGES_KEY" -H "Content-Type: application/json" \
  -d '{"name":"report.pdf","size":12345,"mimeType":"application/pdf"}' \
  https://<this site>/api/storage/upload-url
# → { "url": "<upload link>", "id": "<file id>" }

# 2. Send the bytes to the link
curl -X PUT -H "Content-Type: application/pdf" --data-binary @report.pdf "<upload link>"

# 3. Mark the file ready
curl -X PATCH -H "Authorization: Bearer $MESSAGES_KEY" -H "Content-Type: application/json" \
  -d '{"id":"<file id>"}' https://<this site>/api/attachments
WhatEndpoints
Who you areGET /api/auth/session
ProfilesGET, PATCH /api/profile · GET /api/people?q= (by handle) · POST /api/presence (you're online)
EncryptionGET, PUT /api/encryption (your keys, sealed under your passphrase) · GET, POST /api/conversations/keys?id= (a conversation's keys, sealed for each person)
ConversationsGET, POST /api/conversations · GET, DELETE /api/conversations?id= · POST /api/conversations/read?id= · GET /api/conversations/stream (server-sent events)
MessagesGET /api/messages?conversationId= · POST /api/messages · PATCH, DELETE /api/messages?id= · POST /api/message-files?conversationId=&kind=&meta= (the encrypted bytes) · GET /api/message-files?id= — content is encrypted on your devices
CallsGET, POST /api/calls · GET /api/calls?id= · POST /api/calls/answer?id=, /api/calls/decline?id=, /api/calls/cancel?id=, /api/calls/end?id=, /api/calls/beat?id= · GET /api/calls/token?id= (the call's room and a two-minute token to open it) · POST, DELETE /api/devices/ring-token and GET /api/calls/ring-stream (a phone's call listener)
NotesGET, POST /api/notes · GET, PATCH, DELETE /api/notes?id= · GET /api/notes/count (with the unread count) · POST /api/notes/read?id=
FilesGET /api/attachments · POST /api/storage/upload-url → PUT → PATCH /api/attachments · GET /api/storage/download-url?id= · DELETE /api/attachments?id=
Profile photoPOST (the image bytes), DELETE /api/account/avatar
ServersGET, PUT /api/account/servers · POST /api/account/servers/sync (merge a list from another server)
ActivityGET /api/activity (?category=business or technical)
NotificationsGET /api/notifications · PATCH /api/notifications?id= · POST /api/notifications/read-all · GET /api/notifications/stream (server-sent events)
AIGET /api/ai/models · POST /api/ai/chat · POST /api/ai/summarize · POST /api/ai/transcribe (multipart audio)
CommandsPOST /api/commands ({ text } → the action it asks for, which you then call; it changes nothing)
API referenceGET /api/docs/openapi (OpenAPI 3.1) · GET /api/docs/mcp (MCP tools) · GET /api/docs/asyncapi (AsyncAPI 3.0), no key needed
AI assistantsPOST /api/mcp (Streamable HTTP)

400 means bad input; 401 a missing, expired, or revoked key; 404 something that doesn't exist or isn't yours; 503 a feature this server hasn't set up (storage or AI).

Good to know

  • The API reference lists every endpoint with what it takes and answers, and lets you try them in the browser. It has tabs for the MCP tools and the events too, and each one's document for your own tools: OpenAPI, MCP, and AsyncAPI. It's built from Messages's code, so it always matches this server.
Open API reference

AI assistants (MCP)

Connect an AI assistant, such as Claude Code, Cursor, or VS Code, and it can do what you can: read and write notes, upload and read files, see your activity and notifications, and use the AI helpers. Appearance and sharing into the app stay in the apps.

Messages is an MCP server at https://<this site>/api/mcp (Streamable HTTP). Connect with an API key.

Claude Code

claude mcp add --transport http messages https://<this site>/api/mcp \
  --header "Authorization: Bearer stk_…"

Claude Code and other Node-based assistants don't read the system's certificates. When this server's certificate comes from a private CA, as the homelab's does, start them with NODE_EXTRA_CA_CERTS set to that CA's file.

Other assistants (Cursor, VS Code, …)

Give them the URL and an Authorization header. The field names differ a little between apps; most look like this:

{
  "mcpServers": {
    "messages": {
      "url": "https://<this site>/api/mcp",
      "headers": { "Authorization": "Bearer stk_…" }
    }
  }
}

Every tool, with its parameters: the MCP reference

ToolsNames
Accountget_account, set_profile_photo, remove_profile_photo
Profileget_profile, update_profile, find_people
Conversationslist_conversations, start_conversation, mark_conversation_read, delete_conversation (never what a message says)
Callslist_calls (who called whom, when, and how it went)
Activitylist_activity
Deviceslist_devices, control_device
Notificationslist_notifications, mark_notification_read, mark_all_notifications_read
Noteslist_notes, get_note, mark_note_read, create_note, update_note, delete_note
Fileslist_attachments, upload_attachment, read_attachment, get_attachment_download_url, delete_attachment
AIlist_ai_models, ai_chat, summarize_note, transcribe_audio

Files travel through the conversation, so an assistant can send up to 10 MB and read images or text up to 2 MB; for anything larger it gets a download link. Assistants that sign in with OAuth can connect without a key, using your own sign-in; they need this server's MCP client ID from its administrator.

Events (NATS)

Messages announces everything people do, such as a note written, a file uploaded, or a sign-in, on the homelab's NATS message queue. Every app built from this template shares that queue, so other apps and services there can react to it.

Every app on the homelab's message queue publishes under its own name. Messages's events go to the NATS JetStream stream EVENTS_MESSAGES on the subject events.messages.<category>.<type>, as JSON. Business events are notes and files, technical events are everything else, so events.messages.business.> takes Messages's notes and files, and events.*.business.> every app's.

{
  "id": "<event id>",
  "app": "messages",
  "category": "business",
  "type": "note.created",
  "occurredAt": "2026-10-09T08:30:00.000Z",
  "data": { "userId": "<user id>", "noteId": "<note id>" }
}

Events carry ids, never content: read the note or file through the API. The stream keeps them for 7 days. Delivery is at least once and not always in order, so make handling an event twice harmless (its id is unique) and read current state.

Connecting takes a login on the message queue from the person who runs this server. Every app shares one account there, which is how apps integrate. An API key doesn't open it, and anything connected sees every account's events.

Every event's envelope, field by field: the events reference (AsyncAPI)

What Messages publishes

  • events.messages.business.note.created

    A note was written · userId, noteId

  • events.messages.business.note.updated

    A note was edited · userId, noteId

  • events.messages.business.note.deleted

    A note was deleted · userId, noteId

  • events.messages.business.attachment.uploaded

    A file was uploaded; noteId names its note, or is null for a file on its own · userId, attachmentId, noteId

  • events.messages.business.attachment.deleted

    A file was deleted · userId, attachmentId

  • events.messages.business.conversation.started

    Someone started a conversation; conversationId names it, never its content · userId, conversationId

  • events.messages.business.conversation.deleted

    Someone deleted a conversation, for both people in it · userId, conversationId

  • events.messages.business.message.sent

    A message was sent; its content is encrypted and never in the event · userId, conversationId, messageId

  • events.messages.business.message.edited

    A message was edited by its sender · userId, conversationId, messageId

  • events.messages.business.message.deleted

    A message was deleted by its sender · userId, conversationId, messageId

  • events.messages.business.call.started

    Someone rang the other person in a conversation; callId names the call · userId, conversationId, callId

  • events.messages.business.call.answered

    The person called took the call · userId, conversationId, callId

  • events.messages.business.call.ended

    An answered call ended: someone hung up, or both apps went quiet · userId, conversationId, callId

  • events.messages.business.call.declined

    The person called turned the call down · userId, conversationId, callId

  • events.messages.business.call.cancelled

    The caller stopped ringing before anyone answered · userId, conversationId, callId

  • events.messages.business.call.missed

    Nobody answered before the call stopped ringing · userId, conversationId, callId

  • events.messages.technical.user.signed_in

    Someone signed in to the web or admin app · userId, client

  • events.messages.technical.user.signed_out

    Someone signed out of the web or admin app · userId, client

  • events.messages.technical.appearance.updated

    Someone changed the appearance · userId, client

  • events.messages.technical.servers.updated

    Someone changed their server list · userId

  • events.messages.technical.avatar.updated

    Someone set a profile photo · userId

  • events.messages.technical.avatar.removed

    Someone removed their profile photo · userId

  • events.messages.technical.profile.updated

    Someone changed their Messages handle or status · userId

  • events.messages.technical.encryption.set_up

    Someone set up end-to-end encryption · userId

  • events.messages.technical.encryption.changed

    Someone changed their encryption passphrase · userId

  • events.messages.technical.encryption.reset

    Someone reset their encryption: their earlier messages are unreadable to them · userId

  • events.messages.technical.api_key.created

    An API key was created · userId, apiKeyId

  • events.messages.technical.api_key.deleted

    An API key was revoked · userId, apiKeyId

  • events.messages.technical.device.renamed

    A device was renamed · userId, deviceId

  • events.messages.technical.device.signed_out

    A device was signed out from another one · userId, deviceId

  • events.messages.technical.ai.chat_requested

    Someone chatted with AI; model is null when unknown · userId, model

  • events.messages.technical.ai.note_summarized

    A note was summarized with AI · userId, noteId

  • events.messages.technical.ai.audio_transcribed

    Audio was transcribed with AI · userId

  • events.messages.technical.ai.command_interpreted

    A spoken or typed command was understood with AI (built-in phrases aren't announced) · userId

  • events.messages.technical.user.suspended

    An administrator suspended an account · userId, adminId

  • events.messages.technical.user.restored

    An administrator restored an account · userId, adminId

  • events.messages.technical.user.data_deleted

    An administrator deleted an account's notes and files · userId, adminId

What Messages consumes

Messages's worker reacts to its own events, one durable consumer per processor:

  • note-created-logger ← events.messages.business.note.created

    Reads the new note and logs its length: the example of a processor

  • attachment-uploaded-notifier ← events.messages.business.attachment.uploaded

    Tells the file's owner File uploaded: the example of a notification raised from the bus

A consumer to start from

A Node script to copy into your service or another app. It reads any app's events (EVENTS_APP), creates a durable consumer, retries a failed event, and stops cleanly; put your logic in handle().

#!/usr/bin/env node
/**
 * A consumer to start from, for the events of any app built from the Messages
 * template: the smallest service, or the first half of an integration between
 * two apps, that reacts to them. Copy this file into your own service, install
 * its two packages, and put your logic in handle().
 *
 *   npm install @nats-io/transport-node @nats-io/jetstream
 *   NATS_URL=nats://<broker>:4222 NATS_USER=<user> NATS_PASSWORD=<password> \
 *     node events-consumer.mjs
 *
 * In the Messages repo: pnpm events:consume (NATS_* from apps/api/.env).
 *
 * Every app publishes on the homelab's shared NATS account under its own
 * name, events.<app>.<category>.<type>, into its own stream, EVENTS_<APP>.
 *
 *   EVENTS_APP       whose events to read; default messages. Its stream is
 *                    EVENTS_<APP>: upper case, with - as _
 *   EVENTS_FILTER    the subjects to take; default events.<app>.> (all of
 *                    them), events.<app>.business.> for notes and files
 *                    only, or one type such as
 *                    events.messages.technical.user.signed_in
 *   EVENTS_CONSUMER  the durable consumer's name; default events-consumer.
 *                    Every app reading a stream shares its consumer names,
 *                    so name it after your app and its job
 *                    (notes2-note-indexer). It remembers its place, so a
 *                    restart resumes where it stopped. A new name starts at
 *                    the oldest event the stream holds, up to 7 days back.
 *                    Remove one you no longer need with:
 *                    nats consumer rm EVENTS_<APP> <name>
 *
 * Delivery is at least once and not always in order: handling one event
 * twice must be harmless (its id is unique). Events carry ids, never content:
 * read what you need through the publishing app's API, never its database.
 */

import {
    AckPolicy,
    DeliverPolicy,
    JetStreamApiCodes,
    JetStreamApiError,
    jetstream,
    jetstreamManager
} from "@nats-io/jetstream"
import { connect, nanos } from "@nats-io/transport-node"

const APP = process.env.EVENTS_APP || "messages"
const STREAM = `EVENTS_${APP.toUpperCase().replaceAll("-", "_")}`
const FILTER = process.env.EVENTS_FILTER || `events.${APP}.>`
const CONSUMER = process.env.EVENTS_CONSUMER || "events-consumer"
const MAX_DELIVER = 5
const RETRY_DELAY_MS = 10_000

/**
 * Your logic. Throw to have the event delivered again 10 s later, up to 5
 * deliveries in all.
 */
async function handle(event) {
    console.log(`${event.occurredAt} ${event.type}`, JSON.stringify(event.data))
}

/** The event in a message, or null when it isn't one of APP's. */
function readEvent(message) {
    try {
        const event = JSON.parse(message.string())
        return event?.app === APP && typeof event.type === "string"
            ? event
            : null
    } catch {
        return null
    }
}

function isApiError(error, code) {
    return error instanceof JetStreamApiError && error.code === code
}

if (!process.env.NATS_URL) {
    console.error(
        "Set NATS_URL, and NATS_USER and NATS_PASSWORD when the broker asks for a login"
    )
    process.exit(1)
}

// Once connected, it reconnects forever, so a broker restart needs no restart
// here.
const nc = await connect({
    servers: process.env.NATS_URL,
    user: process.env.NATS_USER || undefined,
    pass: process.env.NATS_PASSWORD || undefined,
    name: CONSUMER,
    maxReconnectAttempts: -1
}).catch((error) => {
    console.error(
        `Can't reach NATS at ${process.env.NATS_URL}: ${error.message}`
    )
    process.exit(1)
})

// Create the durable consumer, or point an existing one at FILTER; it keeps
// its place either way.
const jsm = await jetstreamManager(nc)
const settings = {
    filter_subject: FILTER,
    ack_wait: nanos(60_000),
    max_deliver: MAX_DELIVER
}
try {
    await jsm.consumers.info(STREAM, CONSUMER)
    await jsm.consumers.update(STREAM, CONSUMER, settings)
} catch (error) {
    if (isApiError(error, JetStreamApiCodes.StreamNotFound)) {
        console.error(
            `No ${STREAM} stream: ${APP} hasn't published to this broker yet, or this login is for another account`
        )
        await nc.close()
        process.exit(1)
    }
    if (!isApiError(error, JetStreamApiCodes.ConsumerNotFound)) throw error
    await jsm.consumers.add(STREAM, {
        durable_name: CONSUMER,
        ack_policy: AckPolicy.Explicit,
        deliver_policy: DeliverPolicy.All,
        ...settings
    })
}

const consumer = await jetstream(nc).consumers.get(STREAM, CONSUMER)
const messages = await consumer.consume()
for (const signal of ["SIGINT", "SIGTERM"]) {
    process.once(signal, () => messages.close())
}
console.log(`[${CONSUMER}] consuming ${FILTER}; Ctrl+C stops`)

for await (const message of messages) {
    const event = readEvent(message)
    if (!event) {
        console.error(
            `skipped a message on ${message.subject}: not a ${APP} event`
        )
        message.term(`not a ${APP} event`)
        continue
    }

    try {
        await handle(event)
        message.ack()
    } catch (error) {
        const attempt = message.info.deliveryCount
        console.error(
            `${event.id}: attempt ${attempt}/${MAX_DELIVER} failed`,
            error
        )
        if (attempt >= MAX_DELIVER) message.term(`failed ${attempt} times`)
        else message.nak(RETRY_DELAY_MS)
    }
}

await nc.drain()

Keeping keys safe

A key is as powerful as you are on your own data.

Good to know

  • Anyone who has a key can read, change, and delete your notes and files.
  • Keep it in a password manager or your assistant's secret settings, never in shared code.
  • If a key leaks, revoke it on the Account page. It stops working at once.
  • A key can't create or revoke keys, and never reaches the admin app.
  • If your account is suspended, your keys stop working too.

Privacy and limits

Who can see your data

Your notes and files are private from every other account. Administrators can see them.

Good to know

  • People with the Admin role use a separate admin app. They see every account with its notes and files, but they don't edit or delete single notes or files.
  • An administrator can suspend your account. You're locked out of every app, and your keys stop working, until they restore it.
  • An administrator can also delete all of your notes, files, and photo. Your account stays suspended afterwards.
  • Anything an administrator does to your account shows up in your Activity.
  • Administrators can't read your messages or files in conversations: they are encrypted on your devices. They see that conversations exist, with whom, and how many messages.
  • Other apps and services on the homelab's shared message queue see what every account does and when, by id. Events never carry the content of a note or file.

Limits and unavailable features

What this server does and doesn't do.

Good to know

  • AI features (chat, summaries, server transcription, and voice commands in your own words) work only when the server has an AI provider. Without one, they say AI is unavailable, and everything else works, including the voice commands Messages knows by heart.
  • Attachments and profile photos need file storage. Without it, those actions fail with a message, and notes still work.
  • Password reset by email isn't available. Ask the person who runs this server.
  • File uploaded notifications need the server's background worker and message queue. Without them, uploads still work and raise no notification.
  • Messages has no search, no sharing between accounts, and no notifications outside the web app.