src/server/services/bot/platforms/imessage/protocol-spec.md
Authoritative references:
LobeHub does not speak to Apple's iMessage service directly. Operators host BlueBubbles Server on a Mac signed into Messages. The LobeHub Desktop app runs a loopback webhook bridge on that Mac and keeps the BlueBubbles REST URL and password local.
iMessage -> macOS Messages -> BlueBubbles -> 127.0.0.1 LobeHub Desktop bridge
Desktop bridge -> /api/agent/webhooks/imessage/:applicationId -> LobeHub bot router
LobeHub bot reply -> Device Gateway tool call -> Desktop bridge -> BlueBubbles REST API
Cloud bot provider:
| Field | Source | Notes |
|---|---|---|
applicationId | Operator-chosen LobeHub identifier | Shared by the cloud provider and Desktop bridge. |
desktopDeviceId | LobeHub Desktop Gateway settings | Identifies the Desktop device that can reach BlueBubbles locally. |
webhookSecret | Operator-generated | Desktop forwards BlueBubbles events to LobeHub with ?secret=<value> because BlueBubbles does not sign. |
Desktop-only bridge config:
| Field | Source | Notes |
|---|---|---|
applicationId | Same as cloud provider | Selects which cloud bot receives forwarded events. |
blueBubblesServerUrl | Local BlueBubbles base URL | Usually http://127.0.0.1:<port>. No public URL is required. |
blueBubblesPassword | BlueBubbles Server password | Stored only in Desktop local settings. |
webhookSecret | Same as cloud provider | Used by the Desktop loopback URL and the cloud forwarding URL. |
127.0.0.1.new-message webhook pointing to
http://127.0.0.1:<port>/webhooks/bluebubbles/:applicationId?secret=....{ "type": "new-message", "data": <message> } locally.GET /api/v1/message/:guid?with=chats,attachments when possible./api/agent/webhooks/imessage/:applicationId?secret=....isFromMe messages to avoid loops and
dispatches inbound messages as imessage:<chatGuid>.The server never calls BlueBubbles directly. It uses the existing Device Gateway tool-call channel to ask the configured Desktop device to execute iMessage bridge actions:
imessage.pingimessage.sendTextimessage.sendAttachmentimessage.startTypingimessage.downloadAttachmentimessage.getChatimessage.getChatMessagesimessage.queryMessagesimessage.queryChatsPOST /api/v1/message/textPOST /api/v1/message/attachmentGET /api/v1/attachment/:guid/downloadGET /api/v1/chat/:guid/messagePOST /api/v1/message/queryGET /api/v1/chat/:guidTyping indicators call POST /api/v1/chat/:guid/typing, which requires
BlueBubbles Private API. Failures are logged and ignored.
@bot mentions.