Skip to content

Allow empty text parameter in chatPostMessage when using metadata without warningsย #1535

@heli-os

Description

@heli-os

When using chatPostMessage API with work objects pattern (metadata-only messages), the SDK generates warning logs requesting text parameter even though the message intentionally contains only metadata. This creates unnecessary noise in application logs.

ctx.client().chatPostMessage { req ->
    req
        .channel(ctx.requestUserId)
        .text("____") // unnecessary
        .metadataAsString(gson.toJson(metaData))
}

Current Behavior

When sending metadata-only messages using the work objects pattern, the SDK generates warnings even though text is intentionally omitted:

ctx.client().chatPostMessage { req ->
    req
        .channel(ctx.requestUserId)
        .metadataAsString(gson.toJson(metaData))
}

This produces warning logs like: "text parameter is missing" or similar, which clutters application logs when this pattern is used frequently.

Expected Behavior

The SDK should either:

  1. Provide an explicit option to suppress text validation warnings when metadata is present
  2. Automatically skip text validation warnings when metadata or metadataAsString is provided
  3. Change the default behavior to not generate warnings for metadata-only messages

Proposed Solution

Add a parameter like suppressTextWarning or automatically detect when metadata is present and skip the text validation warning in that case.

Use Case

Work objects pattern is a valid Slack API pattern where messages contain only metadata for application-to-application communication without user-visible text. Generating warnings for this intentional usage creates log pollution and makes it harder to identify genuine issues.

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 make sure if this topic is specific to this SDK. For general questions/issues about Slack API platform or its server-side, could you submit questions at https://my.slack.com/help/requests/new instead. ๐Ÿ™‡

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions