Migration
Upgrading to 4.0.0
All ten implementations move to 4.0.0 together. Supported language and runtime minimums remain unchanged; see Compatibility. The frozen 3.2.0 documentation describes the previous release. Update your package dependency to 4.0.0 and test the complete payloads your application sends, including blocks composed into messages and attachments.
Go module path
Replace every github.com/nicklambourne/slackblocks/go/v3 import with
github.com/nicklambourne/slackblocks/go/v4, including tests and separate example
modules. Then run:
go get github.com/nicklambourne/slackblocks/go/v4@v4.0.0
go mod tidy
go test ./...
Go 1.22 and the default slack-go v0.17.3 dependency remain supported. The separately tested SDK v0.23.1 profile still requires Go 1.25; SDK v0.35.0 requires Go 1.26. Upgrading Slackblocks does not select the newer SDK or backport its security fixes. See the SDK selection guide.
Sparse table settings and public types
Every implementation now preserves skipped positions in column_settings.
For example, [null, {"align": "right"}] configures the second column without
shifting it into the first position. Null entries count toward the 20-entry
maximum; omitted settings and shorter leading-column lists remain valid.
| Language | Upgrade guidance |
|---|---|
| Python | column_settings can contain None; handle optional entries when reading the list. |
| TypeScript | Handle null when reading nullable column-setting entries. Existing non-null inputs remain valid. |
| Go | Pass nil to preserve a skipped column; migrate the module path as above. |
| Java | Getters now expose List<@Nullable ColumnSettings>; check entries before dereferencing. Builders accept null entries. |
| C# | Getters now expose IReadOnlyList<ColumnSettings?>; handle nullable entries. Existing non-null inputs remain valid. |
| Ruby | Settings lists may contain nil; update consumers that assumed every entry was a setting object. |
| Rust | TableBlock::column_settings() changes from Option<&[ColumnSettings]> to Option<&[Option<ColumnSettings>]>. Handle each inner Option; setters still accept ordinary settings. |
| PHP | Settings arrays can contain null; handle nullable entries in readers. |
| Elixir | Settings lists may contain nil; account for it when matching or traversing the list. |
| Haskell | tableBlockColumnSettings changes from Maybe [ColumnSettings] to Maybe [Maybe ColumnSettings]. Wrap existing entries in Just, and use Nothing for a skipped column. |
For example, Haskell's old Just [settings] becomes Just [Just settings];
Just [Nothing, Just settings] leaves the first column at its default. In Rust,
preserve the outer omission distinction and match each inner option rather than
flattening the list, which would change column positions.
Slack's reference permits null entries, but the stress workspace's
blocks.validate endpoint rejected them on 14 November 2026. It accepted default
objects such as [{}, {"align": "right"}]. Use native default ColumnSettings
objects in place of nulls when the receiving path rejects the documented sparse
form. These structural probes do not establish message delivery or rendering.
See Table Block for all ten native examples.
Numeric cells and stricter validation
Plain tables now accept RawNumber cells. Existing exhaustive Rust/Haskell
matches over table-cell variants must also handle the new numeric variant.
Provide both a finite numeric value for sorting and non-empty displayed text.
Empty numeric display labels are now rejected in both plain and data tables;
Python also rejects NaN and infinities while retaining arbitrary-size integers.
Plain-table displayed text is now limited to 10,000 Unicode code points per table and across all plain tables in a message, including attachments, containers and layout fallbacks. Raw text, rich-text text/link labels and numeric display text consume the budget; sorting numbers, URLs and metadata do not. Data-table and Markdown budgets remain separate. Previously accepted oversized payloads now fail local validation: shorten the displayed text or split it across messages.
Ragged plain-table rows remain valid. The change does not impose data-table rectangular-row rules on ordinary tables. Supported runtime floors, SDK profile minimums and unrelated construction defaults remain unchanged.
Upgrading to 3.0.0
All nine implementations move to 3.0.0 together. Minimum supported language and runtime versions are unchanged; see Compatibility.
For applications that construct ordinary messages and buttons with valid inputs, the main upgrade is the dependency version, plus the import-path change for Go. Review the specific cases below if you use number-input bounds, explicit response visibility or inputs that the earlier validation accepted. The new Slackbot button prompt fields are optional and require no changes to existing buttons.
- Number-input bounds now serialize and read back as strings. Numeric constructor and builder conveniences remain, but callers using numeric getters, C# constructor reflection, Elixir direct struct edits or numeric JSON bounds must migrate. See number-input bounds below.
- Go imports move from
github.com/nicklambourne/slackblocks/go/v2togithub.com/nicklambourne/slackblocks/go/v3. Rungo get github.com/nicklambourne/slackblocks/go/v3@v3.0.0, update imports, then rungo mod tidyand your tests. Go 1.22 and the default slack-go v0.17.3 dependency remain supported; choosing the separately tested v0.23.1 SDK still requires Go 1.25. - Validation now rejects previously accepted invalid inputs, including explicit external-multiselect focus, inverted input bounds, malformed date/time shapes and more than two message charts (including attachments). Review the language changelog and test your final payloads.
- Python callers passing
ephemeral=Falsenow explicitly requestin_channel; omit the option to retain the wire default.
The frozen 2.8.0 docs remain available in the version selector. The older migration notes below describe their named releases.
Upgrading Python from 1.x to 2.x
slackblocks 2.0 is a major version bump that focuses on cleaning up internal
correctness issues, modernising the type-annotation surface, and adding several
ergonomic helpers. The good news: for almost all users, upgrading is a
no-op beyond changing the Python version pin.
This page covers what actually changes for you and what's worth adopting once you've upgraded.
Quick checklist
| Step | Action |
|---|---|
| 1 | Confirm you are on Python 3.10 or newer. If not, stay on slackblocks ~= 1.2. |
| 2 | Bump your dependency pin to slackblocks ~= 2.0 (or >=2,<3). |
| 3 | Run your test suite. Existing code should continue to work unchanged. |
| 4 | Optionally adopt the new conveniences below. |
Truly breaking changes
There is exactly one breaking change you might trip over:
Python 3.8 and 3.9 are no longer supported
Both reached upstream end of life (3.8 EOL Oct 2024, 3.9 EOL Oct 2025) and are not receiving security patches.
If you are still on either:
- Stay on the
1.xline until you can upgrade Python. The 1.x line is maintained on a best-effort basis for bugfixes; see the Compatibility page. - Pin via your package manager:
- pip (`requirements.txt`)
- poetry (`pyproject.toml`)
- uv (`pyproject.toml`)
slackblocks>=1,<2
slackblocks = "^1"
"slackblocks>=1,<2"
That's it for breaking changes. Nothing else in the public API was removed or renamed.
What's not breaking, but worth adopting
PlainText and Markdown instead of Text(type_=...)
Before:
from slackblocks import Text, TextType
heading = Text("Welcome", type_=TextType.PLAINTEXT, emoji=True)
body = Text("**bold**", type_=TextType.MARKDOWN, verbatim=True)
After:
from slackblocks import PlainText, Markdown
heading = PlainText("Welcome", emoji=True)
body = Markdown("**bold**", verbatim=True)
PlainText and Markdown are subclasses of Text, so anywhere a Text or
TextLike was accepted before still accepts the new types. The rendered
JSON is byte-identical to the equivalent Text calls.
Workflow.from_url(...) instead of nested Workflow(trigger=Trigger(...))
Before:
from slackblocks import Workflow, Trigger, InputParameter
workflow = Workflow(
trigger=Trigger(
url="https://slack.com/shortcuts/...",
customizable_input_parameters=[
InputParameter(name="env", value="prod"),
InputParameter(name="retries", value="3"),
],
),
)
After:
from slackblocks import Workflow
workflow = Workflow.from_url(
"https://slack.com/shortcuts/...",
env="prod",
retries="3",
)
The verbose form continues to work, so you do not have to migrate.
block_kit_builder_url(...) for browser preview
New helper that turns any block, list of blocks, message, view, or raw dict into a Block Kit Builder URL. Open the URL in your browser to see exactly what Slack will render before you ship.
from slackblocks import SectionBlock, block_kit_builder_url
print(block_kit_builder_url(SectionBlock("Hi")))
# https://app.slack.com/block-kit-builder/#%7B%22blocks%22%3A%5B...%5D%7D
Pass team_id="T0123ABCD" for a workspace-specific URL.
Typed exceptions for finer-grained error handling
InvalidUsageError now has five subclasses, raised in well-defined
situations:
| Subclass | Raised when |
|---|---|
LengthError | A string or list violates a min/max-length constraint. |
RangeError | A numeric value violates a min/max-value constraint. |
TypeMismatchError | Wrong type or unexpected discrete value. |
MutualExclusivityError | Two args that must not both be set were both set. |
MissingRequiredError | At least one of a set of args was required. |
from slackblocks import Button, LengthError
try:
Button(text="x" * 100, action_id="b")
except LengthError as e:
# specifically a length violation
handle_length(e)
Existing except InvalidUsageError blocks continue to catch every
subclass — no change required to upgrade. The new subclasses are purely
additive.
Round-tripping incoming Slack JSON with from_dict
If your app receives Slack interactivity payloads or events and wants to
inspect the blocks, you can now parse them back into slackblocks objects:
import json
from slackblocks import Block
incoming = json.loads(slack_request_body)
block = Block.from_dict(incoming["blocks"][0])
print(block.text.text) # for a SectionBlock, etc.
Block.from_dict is a partial parser. Use the canonical parsing capability inventory for the supported types, unsupported nested shapes and other languages’ entry points. Unknown future fields can be dropped; keep the original JSON when forwarding or archiving it.
Two new block types
Slack added these in 2024; they're now available:
from slackblocks import MarkdownBlock, VideoBlock
# Slack's GitHub-flavored markdown block (richer than SectionBlock mrkdwn).
MarkdownBlock(text="# Heading\n\n- item 1\n- item 2")
# Embed a video from a Slack-supported provider.
VideoBlock(
alt_text="Demo",
thumbnail_url="https://example.com/thumb.png",
title="Getting Started",
video_url="https://example.com/video.mp4",
)
Type-checking improvements
The 2.x series ships with substantially tighter type signatures. If you type-check your code with mypy, pyright, or Pyre, expect that:
Text.to_text("hi")is now correctly typed asText(was previouslyText | None). Code that didassert text is not Noneafterto_textcalls can drop the assertion.Button(style="warning")is now flagged at type-check time —styleisLiteral["primary", "danger"] | ButtonStyle | None.ColumnSettings(align="LEFT")is similarly flagged at type-check time.ConversationFilter(include=["bogus"])is flagged.
These constraints already existed at runtime; the difference is that mypy now agrees with the runtime behaviour.
Internal changes you might notice
The _resolve() method on every block, element, and composition object was
refactored to use a shared slackblocks._core.resolve() walker. This is
strictly internal — JSON output is byte-identical to 1.x — but if you have
been subclassing internal classes you may notice the _resolve bodies are
much shorter.
If you are extending slackblocks with custom classes:
- If your custom class has a
_resolvemethod that follows the existing pattern (manualif self.x is not None: out["x"] = self.x._resolve()), it continues to work in 2.x without modification. - If you want, you can switch to using the new
slackblocks._core.resolve/omit_nonehelpers; doing so guarantees recursion into nested_resolveoutputs and is much more concise.
Reporting issues
If you hit a real upgrade problem, please open an issue on
GitHub — include
your Python version, your slackblocks version (old and new), and a
minimal repro.
See Installation and the TypeScript API reference for supported versions and native conventions. This page's historical release-line discussion applies to Python.
See Installation and the Go API reference for supported versions and native conventions. This page's historical release-line discussion applies to Python.
See Installation and the Java API reference for supported versions and native conventions. This page's historical release-line discussion applies to Python.
See Installation and the C# API reference for supported versions and native conventions. This page's historical release-line discussion applies to Python.
See Installation and the Ruby API reference for supported versions and native conventions. This page's historical release-line discussion applies to Python.
Moving to the Rust API
Rust support starts in 2.6.0; there is no previous Rust package API to migrate. When porting code from another implementation:
- Use consuming snake_case builders and handle
build()with?ormatch. - Use
SelectOption,SelectOptionGroupandConfirmationDialogue; names avoid colliding with Rust'sOptionand describe their Slack roles. - Getters borrow values. Use
clone().into_builder()to edit a copy, or move the value into its builder when the old value is no longer needed. - Use concrete values and
Fromconversions into role enums; strings coerce only in text fields. Typed markdown is rejected in plain-only fields at compile time. - Serialize with Serde. HTTP clients and async runtimes stay in the application.
- Block IDs are omitted unless supplied.
MessageResponsefollows shared model defaults, and parsing preserves absent optional fields. Useclear_*()to remove defaults explicitly. - Python's deprecated attachment
Fieldand historical aliases are not copied; the Rust API implements the shared model and documented helper inventory.
See Quick Start, Compatibility, and the Rust API reference for complete signatures and error behavior.
Adopting the PHP API
There is no earlier Slackblocks PHP release to migrate from. Existing raw arrays
can enter through MessagePayload::fromArray() or fromJson(); choose fromJson()
when preserving empty JSON objects matters. Unknown fields become immutable
JsonObject extensions. Modeled names and type cannot be overridden.
From slack-php/slack-php-block-kit, replace mutable/fluent construction with
named constructors and with(). These are separate packages with different APIs;
objects are not interchangeable. Use JSON at the boundary. From Laravel's Slack
notification builder, keep delivery and routing in Laravel and bridge validated
blocks through usingBlockKitTemplate() as shown in Sending Messages.
<?php
declare(strict_types=1);
require 'vendor/autoload.php';
use Slackblocks as S;
$original = S\SectionBlock::fromJson('{"type":"section","text":{"type":"mrkdwn","text":"Original"}}');
$edited = $original->with(text: 'Updated');
assert($original->text->getText() === 'Original');
echo $edited->toJson();
Construct typed children directly for new code. PlainText and MarkdownText
are distinct classes; text parameters also accept strings with the field's
native plain-text or mrkdwn default. Enums use cases such as
ButtonStyle::Primary, not unchecked strings. Optional constructor null omits
a field; explicit null inside a JsonObject is preserved.
Starting with Elixir
2.8.0 was the first Elixir release, so there is no older Elixir API to migrate.
Use native constructors, lists and atom enums rather than translating another
language's builder chains. Names use Slack's wire snake_case.
alias Slackblocks.{Blocks.Section, Objects.MarkdownText}
original = Section.new!(text: "Before")
{:ok, updated} = Section.change(original, text: "After", block_id: "status")
%MarkdownText{text: "Before"} = original.text
%MarkdownText{text: "After"} = updated.text
Slackblocks.to_map!(updated)
Constructor binaries are converted to the correct text object. Direct struct
edits require the actual typed value and are checked on output. change/2
retains unspecified fields and validates an edit atomically. Explicit nil
clears optional fields; it cannot clear a required field.
Parsing preserves absent optional fields as nil, while construction applies
declared defaults. Message defaults to text: "" and mrkdwn: true;
block IDs are never generated. Use checked decode/2 for known model/role JSON.
Arbitrary Slack event payloads belong to your application's event decoder.
When adding slackblocks to an existing application, rebuild Jason's optional Decimal support as described in Installation. Keep application locks and recompile dependencies/protocols before producing an OTP release.
Starting with Haskell
3.1.0 was the first Haskell package release; there is no earlier Haskell API to migrate. Examples from another language are behavioral references, not constructor syntax to translate mechanically.
Use plainText/markdownText, build checked values, and explicitly convert them
to allowed roles such as markdownTextAsText or sectionBlockAsBlock. Fields use
namespaced record selectors to avoid ambiguous names. TextObject, SelectOption,
SelectOptionGroup and ConfirmationDialogue avoid collisions with common types.
Use buildPlanTask for a pending task inside a plan. PlanTask cannot enter the
Block role. buildTaskCardBlock handles standalone cards and rejects pending.
Number-input bounds are Text; use decimalText for an exact numeric convenience.
inspect… gives editable fields; call build… again after changes. Handle
Result with pattern matching or Either composition. Avoid error or partial
pattern matches in production. The package has no legacy attachment Field
alias: use typed section fields and the supported attachment API. See the
compiler support table and native reference.
Number-input bounds in spec 1.3.0
Slack's number-input reference
requires min_value and max_value to be JSON strings. Earlier packages emitted
numbers, which ordinary Slack modal writes rejected. The native APIs now emit
strings and compare the bounds numerically, rejecting inverted ranges, invalid
strings, and nonfinite numeric values. Omitted bounds remain omitted.
Numeric construction remains available: Python, TypeScript, Go, Ruby, PHP and Elixir
accept a numeric convenience argument or a string; Java has string and numeric
builder overloads; Rust setters accept a displayable numeric value or string.
C# uses the public NumberInputBound scalar with implicit string, integer,
double, nullable-double and decimal conversions. Existing ordinary numeric
constructor calls still work. C# callers using reflection must account for the
new parameter type. This scalar belongs to the elements.number_input
capability and is exercised by its constructor and conformance tests.
Getters and serialized values now expose strings in every language. In
particular, Java's getMinValue/getMaxValue now return Optional<String>,
C# properties return string?, and Rust getters return Option<&str>.
Elixir struct fields contain binary() | nil; keyword constructors and change/2 retain numeric conveniences, while parsed maps and direct struct edits must use strings. This is
a deliberate source/wire contract correction: callers that inspect numeric
getters or JSON numbers must migrate. Pass strings when decimal spelling or
integer precision matters. This does not normalize initial_value or establish
a trailing-zero prohibition; that separate Slack runtime discrepancy remains
documented in troubleshooting. These API changes ship in coordinated release 3.0.0.
Bounds use signed ASCII decimal/scientific strings (for example -1.25, .5, 2. or 1e-3). Whitespace, underscores, hex and nonfinite spellings are rejected. Comparisons preserve precision beyond floating point, including long fractions and integers above 2^53. Equivalent strings such as 0.1000 and 1e-1 remain unchanged on the wire. The library accepts mathematically finite strings such as 1e309; this does not establish Slack delivery support for every magnitude.
Recorded views.open probes on 2026-10-13 rejected bound strings 1e2, 1e309, +10, .5, 0x10, 1_0, 10 and 1., although blocks.validate accepted them. For ordinary delivery, use conventional decimal strings such as "0", "12.5" and "100"; the preserved scientific/alternate forms remain library inputs rather than a Slack delivery guarantee. Native numeric convenience conversions may also produce scientific notation for very large or small values. Applications targeting those magnitudes should test their final native payload against the receiving Slack API.
External multi-select focus
Slack's external-data multi-select field table does not support focus_on_load. Omit the parameter, including an explicit false, when constructing an external multi-select. The compatibility parameter remains callable but now raises invalid-usage; it is not silently ignored. This restriction does not apply to the other selector types whose Slack field tables include focus. Python's default changes from false to None so omission can be distinguished from an explicitly supplied false value.