github slack-go/slack v0.31.0

3 hours ago

Breaking changes

  • ButtonBlockElement is no longer comparable because VisibleToUserIDs is a slice.
    Value comparisons and map keys using it no longer compile; interface comparisons containing button values can panic. Use comparable identifiers as map keys and compare button contents explicitly:

    // Before
    same := a == b
    // After (import "reflect")
    same := reflect.DeepEqual(a, b)
  • If you create these structs without naming their fields, update that code. New fields were added to Block Kit elements, Attachment, File, RemoteFile and Features. Code that supplies values by position now fails to compile. Include the field names, or use the existing New... helper functions where available:

    // Before: values depend on field order.
    element := slack.RichTextSectionBroadcastElement{slack.RTSEBroadcast, "here"}
    // After: each value names its field.
    element := slack.RichTextSectionBroadcastElement{
        Type:  slack.RTSEBroadcast,
        Range: "here",
    }
  • Newly supported rich-text elements decode into concrete types instead of *RichTextSectionUnknownElement. Update type assertions and switches for attachment, workflow, Work Object and message mentions; tags; canvas elements; citations; file and List record references; and Salesforce data fields.

  • Request signature validation is stricter, and mismatch errors have changed. NewSecretsVerifier rejects signatures without the v0= prefix or whose decoded length is not 32 bytes. Update any test fixtures that relied on the previous permissive parsing. SecretsVerifier.Ensure returns ErrInvalidSignature on a mismatch; replace checks of the old error text with errors.Is(err, slack.ErrInvalidSignature).

  • UninstallApp and RotateTokens now use POST, including their Context variants. Update mocks or custom transports that expect GET requests or credentials in the URL to accept form-encoded POST bodies.

  • OptionOnWarning callbacks no longer receive the token parameter in form or query parameter maps. Update callbacks that rely on that field.

Added

  • Add RTMOptionReadLimit and socketmode.OptionReadLimit to limit incoming WebSocket message sizes on every connection, including reconnects. The default remains unlimited; exceeding a configured limit closes the connection and triggers normal reconnect handling. With compression enabled through a custom dialer, the limit counts compressed bytes and does not bound the size after decompression.

  • Block Kit: Add typed Salesforce data fields with record IDs, field metadata, label visibility, and styles. These now decode into RichTextSectionSalesforceDataFieldElement instead of RichTextSectionUnknownElement.

    [!WARNING]
    has_withheld_salesforce_field_names is based on live Slack responses and is absent from the reference and SDK models.

  • Block Kit: Add typed workflow mentions with workflow and trigger IDs, display text, URLs, message locations, and styles. These now decode into RichTextSectionWorkflowMentionElement instead of RichTextSectionUnknownElement.

  • Block Kit: Add typed Work Object mentions with entity and app IDs, display text, URLs, icons, preview settings, product names, and styles. These now decode into RichTextSectionWorkObjectMentionElement instead of RichTextSectionUnknownElement.

  • Block Kit: Add typed attachment mentions with app, entity, icon, message, preview, and product metadata. These now decode into RichTextSectionAttachmentMentionElement instead of RichTextSectionUnknownElement.

  • Block Kit: Add typed rich-text tags with styles and constants for all nine colors. Tags now decode into RichTextSectionTagElement instead of RichTextSectionUnknownElement.

  • Block Kit: Add typed List record references with record and view IDs, display text, URLs, and styles. These now decode into RichTextSectionListRecordElement instead of RichTextSectionUnknownElement.

  • Block Kit: Add typed canvas user mentions and canvas message unfurls, including thread IDs and styles. These now decode into concrete types instead of RichTextSectionUnknownElement.

  • Block Kit: Add typed canvas rich-text elements with labels, section links, title visibility, styles, and skill metadata. These now decode into RichTextSectionCanvasElement instead of RichTextSectionUnknownElement.

  • Block Kit: Add RichTextSectionCitationElement with typed file, external, web, message, and memory details for rich-text citations. Preserve unknown detail variants as raw JSON. Citations now decode into this concrete type instead of RichTextSectionUnknownElement.

  • Block Kit: Add typed file
    and message mention
    rich-text elements, including styles and optional metadata. These now decode into concrete
    types instead of RichTextSectionUnknownElement.

  • Add image alt text, GIF, PDF, 800px and inline thumbnails, audio and transcription metadata, preview truncation, remote file identifiers, canvas and List metadata, title blocks, and sharing and app metadata to File. Preserve sharing and app metadata in RemoteFile responses.

  • Block Kit: Add missing element fields for button accessibility, agent prompts, visibility, conversation selection, rich-text input sizing, and rich-text styles and metadata, including shared emoji URLs.

  • Add IsShare, IsMsgUnfurl and Files to Attachment, so the files of a forwarded message are decoded rather than dropped.

  • Add CreateAgentConversation and ArchiveAgentConversation (plus Context variants) for agents.conversations.create and agents.conversations.archive.

  • Add SetAgentConversationCommands (plus Context variant) and Features.CodeChannels for agent slash commands.

  • Add all 12 Slack Lists API methods, with Context variants and scoped options for lists, access, items, and exports.

  • Block Kit: Add DataTableActionCell for buttons in data_table blocks, with an optional raw_text or raw_number fallback (#1618).

  • Add AdminAppsApprovedList and AdminAppsRestrictedList (plus Context variants) for the admin.apps.approved.list and admin.apps.restricted.list methods, with typed app, scope and pagination responses (#1614).

  • Add AdminAppsRequestsList (plus Context variant) for the admin.apps.requests.list method, with typed request and pagination responses (#1615).

  • File now unmarshals the video fields of the file object: the video thumbnail (ThumbVideo, ThumbVideoW, ThumbVideoH and ThumbVideoTimestamp) and DurationMs, HLS, HLSEmbed, HLSPreview, MediaDisplayType, MP4, MP4Low and VTT.

Fixed

  • RTM: Keep reader errors scoped to their connection and stop the old reader before reconnecting, so stale errors cannot close the next connection.
  • slackevents.ParseEvent returns an error for an event_callback with a missing or null inner event instead of panicking.
  • Release multipart upload writers when a request fails or returns before consuming the request body.

Full Changelog: v0.30.1...v0.31.0

Don't miss a new slack release

NewReleases is sending notifications on new releases.