Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions gateway/platforms/bluebubbles.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ async def _api_post(self, path: str, payload: Dict[str, Any]) -> Dict[str, Any]:
# Lifecycle
# ------------------------------------------------------------------

async def connect(self) -> bool:
async def connect(self, *, send_only: bool = False) -> bool:
if not self.server_url or not self.password:
logger.error(
"[bluebubbles] BLUEBUBBLES_SERVER_URL and BLUEBUBBLES_PASSWORD are required"
Expand Down Expand Up @@ -183,6 +183,13 @@ async def connect(self) -> bool:
self.client = None
return False

# send_only=True skips the local webhook server — outbound-only callers
# (standalone cron delivery, send_message_tool) don't need to receive
# inbound events and must not bind a port already held by the gateway.
if send_only:
self._mark_connected()
return True

app = web.Application()
app.router.add_get("/health", lambda _: web.Response(text="ok"))
app.router.add_post(self.webhook_path, self._handle_webhook)
Expand Down Expand Up @@ -910,9 +917,9 @@ async def _handle_webhook(self, request):
self._background_tasks.add(task)
task.add_done_callback(self._background_tasks.discard)


# Fire-and-forget read receipt
if self.send_read_receipts and session_chat_id:
asyncio.create_task(self.mark_read(session_chat_id))

return web.Response(text="ok")

2 changes: 1 addition & 1 deletion tools/send_message_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -1325,7 +1325,7 @@ async def _send_bluebubbles(extra, chat_id, message):
from gateway.config import PlatformConfig
pconfig = PlatformConfig(extra=extra)
adapter = BlueBubblesAdapter(pconfig)
connected = await adapter.connect()
connected = await adapter.connect(send_only=True)
if not connected:
return _error("BlueBubbles: failed to connect to server")
try:
Expand Down