Skip to content

Conversation

vegeris
Copy link

@vegeris vegeris commented Oct 7, 2025

This PR adds the following support for work objects:

  • Defines the schema for work object metadata
  • Updates the inputs for chat.unfurl or chat.postMessage to accept entity metadata
  • Adds the entity_details_requested event
  • Adds the entity.presentDetails API method
  • Updates the view_submission event to include work object related properties

Category (place an x in each of the [ ])

  • bolt (Bolt for Java)
  • bolt-{sub modules} (Bolt for Java - optional modules)
  • slack-api-client (Slack API Clients)
  • slack-api-model (Slack API Data Models)
  • slack-api-*-kotlin-extension (Kotlin Extensions for Slack API Clients)
  • slack-app-backend (The primitive layer of Bolt for Java)

Requirements

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you agree to those rules.

@vegeris vegeris force-pushed the feat-work-objects branch 2 times, most recently from 4d45e21 to 0c5ae6a Compare October 8, 2025 00:07
@vegeris vegeris force-pushed the feat-work-objects branch from 0c5ae6a to 8be1e14 Compare October 8, 2025 02:59
Copy link

codecov bot commented Oct 17, 2025

Codecov Report

❌ Patch coverage is 5.88235% with 80 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.66%. Comparing base (e3f79e0) to head (8ea0ffc).

Files with missing lines Patch % Lines
...java/com/slack/api/methods/RequestFormBuilder.java 6.32% 72 Missing and 2 partials ⚠️
...slack/api/methods/impl/AsyncMethodsClientImpl.java 0.00% 2 Missing ⚠️
.../com/slack/api/methods/impl/MethodsClientImpl.java 0.00% 2 Missing ⚠️
.../events/handler/EntityDetailsRequestedHandler.java 0.00% 2 Missing ⚠️

❌ Your patch check has failed because the patch coverage (5.88%) is below the target coverage (30.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1512      +/-   ##
============================================
- Coverage     73.02%   72.66%   -0.36%     
  Complexity     4381     4381              
============================================
  Files           475      476       +1     
  Lines         14222    14293      +71     
  Branches       1447     1456       +9     
============================================
+ Hits          10385    10386       +1     
- Misses         2980     3046      +66     
- Partials        857      861       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@vegeris vegeris marked this pull request as ready for review October 17, 2025 20:24
.threadTs(req.getPayload().getMessage().getThreadTs())
.text("OK, I will generate numbers for you!")
.metadata(new Message.Metadata("assistant-generate-numbers", eventPayload))
.metadata(Message.Metadata.builder().eventType("assistant-generate-numbers").eventPayload(eventPayload).build())
Copy link
Author

@vegeris vegeris Oct 17, 2025

Choose a reason for hiding this comment

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

Similar to node-slack-sdk, I originally updated the Message.Metadata object that was previously event-metadata-only. Planning on updating this PR to use a separate EntityAndEventMessageMetadata object as well

cc: @zimeg and @mwbrooks to sanity check this; any apps calling chat.postMessage and construction the Message.Metadata object will need to update that type to Message.EntityAndEventMessageMetadata

Copy link
Member

Choose a reason for hiding this comment

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

🤔 @vegeris This is so interesting! Thank you for calling it out 🙏 ✨

If I'm understanding this right, changing the metadata type from Message.Metadata might error during compilation of app code for this:

Message.Metadata metadata = message.getMetadata();

It makes sense that this argument can be either metadata type for the API but I'm wondering if we workaround changing this in the SDK for now with an additional argument for the method input and generous javadoc too?:

/**
 * Metadata of entities attached to a message. Used instead of the "metadata" attribute, which sends event-based message metadata. In an upcoming major version, the "metadata" attribute will accept both types of metadata.
 */ 
private Message.EntityMessageMetadata entityMessageMetadata;

IIRC we have logic to parse various cases of metadata that can be extended in meantimes-

Copy link
Member

@zimeg zimeg left a comment

Choose a reason for hiding this comment

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

🌟 @vegeris Praises all throughout these changes! I tried to keep comments focused to thoughts and suggestions. This is looking solid!

The metadata typings you've called out caught my attention and I left some rambles on a workaround to avoid changing the existing types. I'm not sure if it's a good idea but I wonder if some changes might be left as TODO for now?

So curious about what you think! I plan to test this more after updates to metadata typings that might be in progress at the moment too 🫡

Comment on lines +1176 to +1177
// and the Conversations API will become available to classic Slack apps over
// the coming months.
Copy link
Member

Choose a reason for hiding this comment

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

🪬 note: TIL!

Comment on lines +2728 to +2730
// ------------------------------
// work object entities
// ------------------------------
Copy link
Member

Choose a reason for hiding this comment

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

🧮 quibble: This method might've been renamed in recent times. Can I request a realphabeticalization before merge?

Comment on lines +734 to +739

// ------------------------------
// work object entities
// ------------------------------

public static final String ENTITY_PRESENT_DETAILSs = "entity.presentDetails";
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// ------------------------------
// work object entities
// ------------------------------
public static final String ENTITY_PRESENT_DETAILSs = "entity.presentDetails";

🪓 suggestion(blocking): This might be alright to remove in favor of less plural before?

import com.slack.api.methods.response.workflows.WorkflowsStepFailedResponse;
import com.slack.api.methods.response.workflows.WorkflowsUpdateStepResponse;

import java.io.IOException;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
import java.io.IOException;

🪓 question: Is this safe to remove?

CompletableFuture<WorkflowsUpdateStepResponse> workflowsUpdateStep(RequestConfigurator<WorkflowsUpdateStepRequest.WorkflowsUpdateStepRequestBuilder> req);

// ------------------------------
// work object entities
Copy link
Member

Choose a reason for hiding this comment

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

👁️‍🗨️ nit: Kind request to trail emoji methods for this section too?

// https://docs.slack.dev/changelog/2021-08-changes-to-unfurls
private String source;

private String rawMetadata;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
private String rawMetadata;
private String metadataAsString;

🔍 suggestion: To match chat.postMessage formats!

Copy link
Member

Choose a reason for hiding this comment

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

📚 suggestion: Adding similar javadoc might be nice too?

.threadTs(req.getPayload().getMessage().getThreadTs())
.text("OK, I will generate numbers for you!")
.metadata(new Message.Metadata("assistant-generate-numbers", eventPayload))
.metadata(Message.Metadata.builder().eventType("assistant-generate-numbers").eventPayload(eventPayload).build())
Copy link
Member

Choose a reason for hiding this comment

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

🤔 @vegeris This is so interesting! Thank you for calling it out 🙏 ✨

If I'm understanding this right, changing the metadata type from Message.Metadata might error during compilation of app code for this:

Message.Metadata metadata = message.getMetadata();

It makes sense that this argument can be either metadata type for the API but I'm wondering if we workaround changing this in the SDK for now with an additional argument for the method input and generous javadoc too?:

/**
 * Metadata of entities attached to a message. Used instead of the "metadata" attribute, which sends event-based message metadata. In an upcoming major version, the "metadata" attribute will accept both types of metadata.
 */ 
private Message.EntityMessageMetadata entityMessageMetadata;

IIRC we have logic to parse various cases of metadata that can be extended in meantimes-

return form;
}

public static FormBody.Builder toForm(EntityPresentDetailsRequest req) {
Copy link
Member

Choose a reason for hiding this comment

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

🔐 quibble: Can these parsings be alphabetized earlier in the file?

* JSON object containing the data that will be displayed in the flexpane for
* the entity.
*/
private String rawMetadata;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
private String rawMetadata;
private String metadataAsString;

🧵 suggestion: To match another comment, but I also think duplicating the javadoc for the more explicit typings that follow might be solid too for reference generation? I haven't experimented with such edge-

private String mimetype;
private String url;
private AttachmentMetadata metadata;
private Object workObjectEntity;
Copy link
Member

Choose a reason for hiding this comment

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

👾 question: Is this particular to a specific Object import, or can it be cast to something else? IIRC adjustments to these models are common if fields are adjusted, but having such type might make accessing easier?

@zimeg zimeg added enhancement M-T: A feature request for new functionality project:slack-api-client project:slack-api-client project:slack-api-model project:slack-api-model project:slack-app-backend labels Oct 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement M-T: A feature request for new functionality project:slack-api-client project:slack-api-client project:slack-api-model project:slack-api-model project:slack-app-backend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants