Repository navigation
fix(slack): mirror Telegram photos/files instead of the no-text placeholder - #93
Merged
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 hadtext: ""andupdate.channel_post.photowith 5 sizes. The update came in asrelay--1003188609266-81, a relay of the bot's ownsendPhoto._post_telegram_formatonly reads text/caption, so it posted the placeholder.Fix
telegram_formatnow mirrors the attachment:getFile. It usestelegram_connection_idif set, otherwise the connection of thedata.hooktelegram 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.imageblock (slack_file) under the caption. The image post is retried oninvalid_blockswhile Slack processes the file.files:write: the live Au-Tomator token getsmissing_scopetoday, confirmed with a probe to a non-existent channel that published nothing. In that case a photo falls back to animageblock with the public t.me preview image (t.me/<chan>/<id>?embed=1). So post 81 would show up as the picture.📎 *name*line (or the caption), with the file uploaded into the post's thread.skipped: true). The placeholder text is gone.Tests
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.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:writeto 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.