Skip to content

fix(slack): mirror Telegram photos/files instead of the no-text placeholder - #93

Merged
alexeygrigorev merged 1 commit into
mainfrom
fix/telegram-crosspost-media
Nov 20, 2026
Merged

alexeygrigorev merged 1 commit into
mainfrom
fix/telegram-crosspost-media

Conversation

@alexeygrigorev

Copy link
Copy Markdown
Member

Problem

In #course-ai-dev-tools-zoomcamp, Au-Tomator posted «no text in this post, see Telegram for the attachment» for https://t.me/aidevtoolszoomcamp/81. That post is a photo (1440×810, no caption).

Run telegram-crosspost:automator-telegram-b2caee5de36d4530 (2026-11-20 20:58 UTC) shows the event had text: "" and update.channel_post.photo with 5 sizes. The update came in as relay--1003188609266-81, a relay of the bot's own sendPhoto. _post_telegram_format only reads text/caption, so it posted the placeholder.

Fix

telegram_format now mirrors the attachment:

  • The trigger's own bot downloads the file with getFile. It uses telegram_connection_id if set, otherwise the connection of the data.hook telegram trigger, because a file_id only works for the bot that received it. For a photo it takes the largest size. Errors never include the bot token.
  • Photo, or image sent as a file: the file is uploaded to Slack (getUploadURLExternal → POST → completeUploadExternal, not shared to a channel). The channel post then shows it as an image block (slack_file) under the caption. The image post is retried on invalid_blocks while Slack processes the file.
  • No files:write: the live Au-Tomator token gets missing_scope today, confirmed with a probe to a non-existent channel that published nothing. In that case a photo falls back to an image block with the public t.me preview image (t.me/<chan>/<id>?embed=1). So post 81 would show up as the picture.
  • Other files: a 📎 *name* line (or the caption), with the file uploaded into the post's thread.
  • No text and nothing to show: the post is skipped (skipped: true). The placeholder text is gone.
  • Text-only posts are unchanged.

Tests

  • New plugins/slack/tests/test_slack_telegram_media.py (13 tests). It covers a replica of post 81, caption above the image, the missing_scope fallback to the preview, the invalid_blocks retry, skipping, token redaction, documents in the thread, and text posts staying unchanged.
  • In plugins/telegram/tests/test_telegram.py, the placeholder test is replaced by a skip test.
  • make test: 5028 passed, 2 skipped.

Follow-up for the Slack admin: add files:write to the Au-Tomator app and reinstall. Photos then go through a real Slack upload, and non-image files get mirrored too. Until then photos use the t.me preview.

…holder

t.me/aidevtoolszoomcamp/81 was a photo with no caption. The telegram
crosspost only looked at text/caption, so Slack got "no text in this post,
see Telegram for the attachment" and nothing else.

telegram_format now downloads the attachment with the trigger's own bot
(getFile; telegram_connection_id or the event hook's connection), uploads it
to Slack and shows a photo as an image block in the channel post under its
caption. Without files:write (the Au-Tomator token lacks it today) a photo
falls back to the public t.me preview image. Other files go into the post's
thread. A post with nothing to show is skipped; the placeholder is gone.
@alexeygrigorev
alexeygrigorev merged commit 365e3dc into main Nov 20, 2026
14 checks passed
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.

1 participant