Skip to content

Add slackFile field to element-level Image for Slack-hosted file references - #473

Merged
kbasutkar-hubspot merged 4 commits into
masterfrom
kbasutkar/add-slack-file-to-image-element
Sep 25, 2026
Merged

kbasutkar-hubspot merged 4 commits into
masterfrom
kbasutkar/add-slack-file-to-image-element

Conversation

@kbasutkar-hubspot

Copy link
Copy Markdown
Contributor

Summary

Adds Optional<SlackFileObject> getSlackFile() to the element-level ImageIF (com.hubspot.slack.client.models.blocks.elements.ImageIF).

Problem

Slack's API supports slack_file (file ID) on image elements, allowing images uploaded to Slack to be referenced by ID instead of a URL. The top-level Image block already has this field, but the element-level Image (used by Card.heroImage, Section.accessory, etc.) does not.

Change

One field added to elements/ImageIF.java:

Optional<SlackFileObject> getSlackFile();

Matches the pattern already used by the top-level ImageIF block.

Use case

The Slack integration team needs to reference Slack-uploaded screenshots in Card.heroImage for Breeze artifact preview cards. Without this field, we have to host images ourselves instead of letting Slack handle storage.

…rences

Slack's API supports slack_file (file ID) on image elements, allowing
images uploaded to Slack to be referenced by ID instead of a URL. This
is needed for Card hero_image to reference Slack-hosted screenshots.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@@ -23,4 +25,6 @@ default String getType() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this is optional now and we need to update it to allow providing an object without url, but this could be used in different repos, so please make sure that this change is safe.

kbasutkar-hubspot and others added 3 commits September 25, 2026 13:30
Matches the pattern used by the top-level Image block where imageUrl
is Optional<String>. When using slackFile (Slack-hosted file reference),
imageUrl is not needed. Callers providing a URL should wrap it in
Optional.of().

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Update CardBlockTest assertions and Image.of() calls to work with
Optional<String> imageUrl. Apply spotless formatting.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@kbasutkar-hubspot
kbasutkar-hubspot merged commit 5b8806a into master Sep 25, 2026
2 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.

2 participants