github slack-go/slack v0.36.0

36 minutes ago

Thanks again to Michal (@akfaew) for another round of fixes in this release.

Breaking changes — read before upgrading

Warning

v0.36.0 includes breaking API, decoding, and serialization changes.

Your code may fail to compile. Code that still compiles may decode or serialize
differently. Events API URL-verification responses now use a different JSON key.

Review every item below before upgrading, including RTM and Events API handlers,
tests that build or compare event payloads, and code that decodes into reused values.

1. RTM group_rename event types have changed

  • slack.GroupRenameEvent gains EventTimestamp. Positional struct literals no
    longer compile. Use keyed literals, such as
    slack.GroupRenameEvent{Type: "group_rename", Group: info, Timestamp: ts}.
    Timestamp keeps its ts JSON key; the new event_ts key is omitted when empty.
  • slack.GroupRenameInfo.Created is now int64. Replace Created: "1360782804"
    with Created: 1360782804. Parse input strings with strconv.ParseInt(value, 10, 64),
    and use strconv.FormatInt(info.Created, 10) where a string is still needed.
    Marshaling now emits a JSON number, and decoding rejects quoted timestamps.

2. URL-verification responses use a lowercase challenge key

slackevents.ChallengeResponse now marshals as {"challenge":"..."} instead of
{"Challenge":"..."}, matching Slack's documented response. Assignments from
untagged anonymous structs no longer compile;
use
slackevents.ChallengeResponse{Challenge: value} instead.

3. slackevents.CallRejectedEvent is flattened

  • Read fields directly from the event. Replace event.Event.CallID with
    event.CallID, and likewise for Type, UserID, ChannelID, and ExternalUniqueID.
  • Envelope fields are removed. Token, TeamID, APIAppID, EventID, and
    AuthedUsers are gone. Decode full callback payloads with slackevents.ParseEvent
    and read envelope metadata from the returned EventsAPIEvent and its
    *EventsAPICallbackEvent data.
  • Type is now call_rejected, not the outer event_callback. Marshaling
    produces the inner event object instead of the complete callback envelope.

4. Decoding into reused values replaces previous contents

  • ActionCallbacks, ContextElements, and BlockObjects replace previous entries
    instead of appending.
    Decoding [A, B] followed by [C] now leaves [C]; [] and
    JSON null clear all entries. The legacy {"elements":null} wrapper remains a no-op
    for ContextElements. To accumulate entries, decode separately and append the slices.
  • Accessory and SlackResponseErrors replace all previous variants on a
    successful decode, instead of retaining fields from earlier decodes. JSON null
    clears accessory variants; it remains a no-op for SlackResponseErrors and for the
    legacy {"accessory":null} wrapper.

A failed decode may clear or partially replace the destination. Do not use it
after a decoding error. To keep the previous value, decode into a separate value and
assign it only after success.

Added

  • Add AdminUsersSetAdmin, AdminUsersSetOwner, and AdminUsersSetRegular, with
    Context variants, to change a user's account type on a workspace or Enterprise org.
    With an org ID, admin.users.setRegular also removes the user's Workspace Owner
    roles (Slack changelog).
    The existing SetRegular still calls the legacy users.admin.setRegular endpoint.
  • Add AdminUsersGetExpiration and AdminUsersSetExpiration, with Context
    variants, to read and set when a guest account is disabled.
    AdminUsersGetExpirationOptionTargetTeam and AdminUsersSetExpirationOptionTeamID
    select a workspace in the org. Slack API reference:
    admin.users.getExpiration,
    admin.users.setExpiration.
  • Add AdminUsersAssign, AdminUsersInvite, and AdminUsersRemove, with Context
    variants and options for guest access, channels, and invite details, to manage
    workspace membership in an Enterprise org. InviteToTeam, InviteGuest, and
    InviteRestricted still call the legacy users.admin.invite endpoint.
  • Add AdminUsersSessionList, AdminUsersSessionReset, AdminUsersSessionResetBulk,
    AdminUsersSessionGetSettings, AdminUsersSessionSetSettings, and
    AdminUsersSessionClearSettings, with Context variants, to list and reset
    member sessions and manage their session settings.
  • Add AdminUsersUnsupportedVersionsExport and its Context variant to have
    Slackbot send a CSV of members on unsupported Slack clients.
  • Add AdminUsersAccessPause and AdminUsersAccessResume, with Context variants
    and a reason option, to queue pausing or resuming org-wide access for frontline
    members. On failed_for_some_users, the returned response lists the rejected
    users in InvalidUsers; Slack still queues the others.

Fixed

  • Expose event_ts in RTM group_rename events as EventTimestamp, preserving
    Timestamp for the separate ts field.
  • Decode numeric creation timestamps in RTM
    group_rename events
    instead of dispatching unmarshalling_error.
  • Use the lowercase challenge JSON key in Events API URL-verification responses.
  • Preserve call and user identifiers when parsing call_rejected Events API events.
  • Replace previous actions, context elements, and composition objects when decoding into reused values.
  • Replace stale accessory and API error variants when decoding into reused values.
  • Stop the Socket Mode handler's event dispatcher when its client returns an error,
    preserving queued events before returning.

Full Changelog: v0.35.0...v0.36.0

Don't miss a new slack release

NewReleases is sending notifications on new releases.