Files
Aleksander DygońandClaude Opus 5.5 f1357b2057 Tell a Telegram chat with no link how to link it (#12043)
* Tell an unlinked Telegram chat how to link it

A Telegram chat that adds the shared OpenBot bot without the one-use link
from the app has no route, so Signal discarded each update with no reply.
A user who mentioned the bot got silence and no hint.

Signal now sends one notice in such a chat when a direct message, a
mention or a command arrives and the account service answers that no host
has the chat. The text comes from the new status.messaging.telegramNotLinked
key and names the app path: Marketplace > Apps > Telegram > Add to a group
or Open a direct chat.

- The notice is sent only on a real lookup answer with hostId null. A failed
  lookup, a chat linked to an offline host, a chat that a link just routed,
  replies, threads, renames, leaves and button presses get none.
- At most one notice per chat per 24 hours, in a bounded in-memory map. The
  time is kept before the call, a failure is not retried or logged, and the
  call has no reply or thread parameters.
- A link now forgets the cached "no host" lookup of its chat.
- Slack still answers 503 for a team with no host.
- remote/api depends on @openbot/i18n, and the Dockerfile copies it.
- TELEGRAM_TEST_API_ORIGIN (loopback only) points Signal at a fake Bot API
  in scripts/signal-security-e2e.ts, which checks the notice cases.

Fixes #11875

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Keep the Telegram notice out of chats that Signal saw linked

- Skip the notice for a chat that this Signal saw linked, revoked or
  named in a route ticket. A lookup that started before a link and
  answered after it can no longer send the notice.
- Ignore a TELEGRAM_TEST_API_ORIGIN that is not a loopback address,
  instead of turning off Telegram.
- In the Signal E2E, wait for the notice of a later chat before the
  count, so that a second notice cannot come after the assertion.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 14:49:50 +01:00

33 lines
1.5 KiB
Docker

FROM oven/bun:1.4.2-alpine AS dependencies
WORKDIR /app
COPY package.json bun.lock ./
COPY patches ./patches
COPY apps/auth-api/package.json ./apps/auth-api/package.json
COPY packages/ui/package.json ./packages/ui/package.json
COPY packages/brand/package.json ./packages/brand/package.json
COPY packages/contracts/package.json ./packages/contracts/package.json
COPY packages/i18n/package.json ./packages/i18n/package.json
COPY packages/logging/package.json ./packages/logging/package.json
COPY packages/telemetry/package.json ./packages/telemetry/package.json
COPY packages/user-errors/package.json ./packages/user-errors/package.json
COPY packages/team-client/package.json ./packages/team-client/package.json
COPY packages/whatsapp/package.json ./packages/whatsapp/package.json
COPY remote/api/package.json ./remote/api/package.json
RUN bun install --production --ignore-scripts --frozen-lockfile --filter @openbot/remote-api
FROM oven/bun:1.4.2-alpine
WORKDIR /app
ENV NODE_ENV=production
COPY --from=dependencies /app/node_modules ./node_modules
COPY --from=dependencies /app/remote/api/node_modules ./remote/api/node_modules
COPY packages/contracts ./packages/contracts
COPY packages/i18n ./packages/i18n
COPY remote/api ./remote/api
USER bun
WORKDIR /app/remote/api
EXPOSE 8443
HEALTHCHECK --interval=15s --timeout=3s --retries=3 CMD bun -e 'const r=await fetch("http://127.0.0.1:8080/health/ready");process.exit(r.ok?0:1)'
ARG OPENBOT_SOURCE_COMMIT=unknown
ENV OPENBOT_SOURCE_COMMIT=$OPENBOT_SOURCE_COMMIT
ENTRYPOINT ["bun", "src/index.ts"]