Skip to content

Deliver Telegram photos and voice notes in linked DMs - #2138

Merged
elie222 merged 2 commits into
elie222:mainfrom
princejain756:telegram-dm-attachments
Oct 25, 2026
Merged

elie222 merged 2 commits into
elie222:mainfrom
princejain756:telegram-dm-attachments

Conversation

@princejain756

Copy link
Copy Markdown
Contributor

Why

Photos, voice notes and files sent to a Telegram-linked bot in DM were ignored: the adapter builds those attachments with fetchData (a bot-credential download) and no url, so content and mediaUrl came out empty and the "no text" gate dropped the event. With a caption, only the caption reached the bot. Closes #2038.

What changed

  • handleDirectEvent treats event.attachments as content: a media-only message no longer hits the empty-text return in either the linked or the open-signup branch.
  • New storeInboundMedia downloads provider-held files into thread artifacts via a storeAttachment dep (same signature the TeamChat bridge uses), capped at ATTACHMENT_MAX_COUNT, nonces messaging-attachment:<provider>:<handle>:<i> so webhook retries replay. The DM message now carries image/file blocks plus the caption, and promptTextForAttachments builds the prompt.
  • A failed download leaves a [file: name (unavailable)] line so the bot still learns something arrived.
  • wakeMessageRoutines adds a files list to the untrusted delivery payload so a media-only event is not blank for message-trigger routines.
  • app.ts wires storeAttachment to storeInboundAttachment (same wiring the bridge already had).

How tested

pnpm vitest run apps/api/src/messaging-inbound.test.ts passes (52 tests, incl. new cases: photo-only DM stored as an image artifact, caption+file delivered together, failed download falls back to a note, routine payload lists files, truly empty DM still ignored). pnpm --filter @rakazo/api check clean. Not exercised against a live Telegram bot.

A caption-less photo or voice note died silently: Telegram attachments
only carry a fetchData download, so content and mediaUrl were empty and
the 'no text' gate dropped the event before the bot saw anything. Direct
messages now store those files as thread artifacts through the same
storeAttachment path team chat uses, render them as image/file blocks,
and still deliver a '[file: name (unavailable)]' note when the download
fails. Routine wakes get a files list so a media-only event is not
blank.
@vercel

vercel Bot commented Oct 25, 2026

Copy link
Copy Markdown

@princejain756 is attempting to deploy a commit to the Inbox Zero Team on Vercel.

A member of the Team first needs to authorize it.

@greptile-apps

greptile-apps Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new actionable issues were found.

Summary

Linked DMs now store provider-held attachments and send image or file blocks alongside captions.

  • Linked messaging DMs now deliver their attachments to the bot.
  • Message-trigger routines now receive incoming files.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Incoming DM] --> B{Linked sender or text signup?}
  B -->|No| C[Ignore]
  B -->|Yes| D[Store attachments within shared deadline]
  D --> E{Message routines configured?}
  E -->|Yes| F[Deliver routine text and attachment blocks]
  E -->|No| G[Deliver caption and attachment blocks]
  F --> H[Queue agent work]
  G --> H
Loading

Reviews (2) · Last reviewed commit: "Attach inbound media to message routine ..." · Reviewed by Greptile

Comment thread apps/api/src/messaging-inbound.ts Resolved
@elie222
elie222 merged commit 14991ec into elie222:main Oct 25, 2026
26 of 27 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

Playwright screenshots

No new feature frames; gallery is suite-vs-main drift.

Open screenshot gallery · Dashboard · CI run

Updated for commit c45bf5b.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Photos and voice notes sent to a Telegram-linked bot are ignored

2 participants