Skip to main content

Troubleshooting & FAQ

Practical answers to common questions, gotchas, and validation errors.

See Validation boundaries for the distinction between local checks, Slack structural validation and application-owned date rules. See Using Blocks for ownership, editing and omitted values, plus native helper and numeric examples.

Why is my message body coming through with literal *asterisks* instead of bold?​

Slack supports two text types: mrkdwn (a Slack-flavoured markdown) and plain_text. slackblocks uses mrkdwn by default for SectionBlock text, but HeaderBlock, button labels, modal titles, input labels, and tab and select/overflow option labels are forced to plain_text by Slack — markdown syntax in those fields is rendered literally.

If you need bold/italic styling in those places, you can't get it. If you need it elsewhere and aren't getting it, double-check you're not accidentally constructing a Text(type_=TextType.PLAINTEXT, ...).

Why does my message say text is required?​

Slack will warn (or in some cases reject) messages that have blocks but no text fallback. The text field is used for:

  • Desktop and mobile push notifications.
  • Accessibility readers.
  • Clients that don't render Block Kit (rare, but they exist).

Always pass a short text= summary alongside blocks=:

Message(
channel="#general",
text="Build #482 passed", # fallback
blocks=[HeaderBlock("Build #482 passed :white_check_mark:"), ...],
)

What is block_id for? Should I set it?​

block_id is a stable identifier for a block. Slack echoes it back to you in interaction payloads (button clicks, modal submits) so you can correlate which block produced the event.

  • For non-interactive messages, you can leave it unset — slackblocks generates a random UUID.

  • For interactive messages and modals, set explicit block_ids so your handlers can look up state reliably:

    ActionsBlock(
    block_id="approval:req-123",
    elements=[Button(text="Approve", action_id="approve", value="req-123")],
    )

The same applies to action_id for elements.

What does InvalidUsageError: ... exceeds limit of N characters mean?​

Slack imposes hard character limits on most fields. slackblocks validates these at construction time so you find out before hitting Slack. Common limits:

FieldLimit (chars)
SectionBlock.text3,000
SectionBlock.fields[i]2,000
HeaderBlock.text (plain_text)150
Button.text75
Button.value2,000
Button.url3,000
Modal.title / submit / close24
action_id255
private_metadata3,000
Option.url3,000

If a field exceeds its limit, truncate or split the content.

How many blocks can a single message have?​

  • Channel messages: 50 blocks (Slack-side limit).
  • Modals and home tabs: 100 blocks.
  • ContextBlock: max 10 elements.
  • ActionsBlock: max 25 elements.
  • SectionBlock.fields: max 10 items.
  • TableBlock: max 100 rows × 20 columns.

My buttons / selects don't do anything when clicked.​

slackblocks only constructs the outgoing payload. Handling button clicks, menu selections, and modal submissions requires:

  1. Either a public HTTPS Interactivity & Shortcuts Request URL, or a Socket Mode connection. Socket Mode does not require a public HTTP endpoint.
  2. An interaction handler that processes and acknowledges the payload received through the chosen HTTP or Socket Mode transport.

The slack-bolt framework is the easiest way to wire this up.

Why doesn't markdown work inside a HeaderBlock?​

By design — Slack only allows plain_text in headers. Use a SectionBlock (which supports mrkdwn) followed by a DividerBlock if you want bold or styled text as a heading.

How do I preview a message without actually sending it?​

Use Slack's Block Kit Builder and paste the JSON output from message.json():

print(message.json())

How do I send a slackblocks.Message with requests?​

Message renders to a dict, so:

import os
import requests

from slackblocks import Message, SectionBlock

message = Message(channel="C0123456", text="Hi!", blocks=SectionBlock("Hi!"))

response = requests.post(
"https://slack.com/api/chat.postMessage",
json=message.to_dict(),
headers={"Authorization": f"Bearer {os.environ['SLACK_API_TOKEN']}"},
timeout=30,
)
response.raise_for_status()
result = response.json()
if result.get("ok") is not True:
raise RuntimeError(f"Slack rejected the message: {result.get('error')}")

Can I use slackblocks with async code?​

Yes — slackblocks itself is synchronous and side-effect-free, so Message(...) construction works identically inside async def functions. Use the async WebClient from slack_sdk.web.async_client to actually send:

from slack_sdk.web.async_client import AsyncWebClient
from slackblocks import Message, SectionBlock

async def notify():
client = AsyncWebClient(token=...)
message = Message(channel="#general", blocks=SectionBlock("Hi!"))
await client.chat_postMessage(**message)

How does slackblocks compare to the block classes in slack-sdk?​

slack-sdk ships its own Block / SectionBlock / etc. classes. slackblocks predates them and offers:

  • A more concise API (e.g. SectionBlock("Hi!") vs SectionBlock(text=MarkdownTextObject(text="Hi!"))).
  • Stricter up-front validation with informative InvalidUsageError messages.
  • Independent release cadence — usable with the legacy slackclient or no SDK at all.

Use whichever you find more ergonomic; they produce equivalent JSON.

I'm getting a pytest error from a Python DeprecationWarning.​

slackblocks' own test suite turns warnings into errors via pyproject.toml. That setting only affects this project's CI — it doesn't propagate to your application. If you're seeing it, it's because you're running the slackblocks test suite as part of contributing.

Where do I report bugs / request features?​

Use GitHub Issues.

Option text depends on the parent​

Select, multi-select and overflow option labels require plain_text. Checkbox and radio-button options also accept mrkdwn; this is a parent-specific rule, not a rule that every option label is plain text. See Slack’s option object.

submit_disabled on ordinary modals​

Slack reserves submit_disabled for workflow configuration modals. An ordinary views.open or views.push request should omit the field. On the wire, explicit false still supplies an unsupported field. Python’s legacy serializer currently omits false values for this field; other APIs can preserve explicit false. Leave the option unspecified in every language rather than depending on normalization. The general modal constructor retains the field because configuration views use the same wire type, and cannot infer the receiving workflow from the value alone.

LanguageOrdinary-modal construction
PythonLeave submit_disabled unspecified on Modal.
TypeScriptDo not call .submitDisabled(...) on Modal().
GoDo not call .SubmitDisabled(...) on NewModal().
JavaDo not call .submitDisabled(...) on ModalView.builder().
C#Leave submitDisabled unspecified on new ModalView(...).
RubyLeave submit_disabled: unspecified on Slackblocks::ModalView.new.
RustDo not call .submit_disabled(...) on ModalView::builder().
PHPLeave submitDisabled: unspecified on new ModalView(...).
ElixirLeave submit_disabled: unspecified on Slackblocks.Views.Modal.new/1 or new!/1; nil also omits it.
HaskellKeep modalViewSubmitDisabled = Nothing on the modalView fields record.

The shared views/modal_with_blocks and views/modal_without_blocks fixtures exercise ordinary modal omission through every native conformance consumer. Slack's configuration-modal link now redirects to the legacy Steps from Apps retirement notice. Keeping this field preserves the documented wire API; it does not establish that a configuration workflow is currently available. Configuration-specific delivery remains unverified.

Decimal input values rejected only when opening a view​

Slack documents number-input initial_value as a string. Six paired minimal native Python modals on 13 October 2026 isolated a receiving-path discrepancy: blocks.validate accepted 42.50, 42.5, 42.00, 42, 0.50, and 0.5, while fresh views.open requests accepted only 42.5, 42, and 0.5. The trailing-zero forms received initial_value errors. These otherwise identical controls contained no bounds, file input, or configuration-only fields. Structural validation alone does not prove that a view can be opened.

As an application compatibility workaround, explicitly supply a decimal string without redundant fractional zeros, such as "42.5" instead of "42.50" or "42" instead of "42.00". Keep a zero before the decimal point ("0.5"). Use the native initial_value argument in Python/Ruby/Rust/Elixir, initialValue in TypeScript/Java/C#/PHP, InitialValue in Go, or numberInputInitialValue = Just "42.5" in Haskell. No JSON editing is required.

This is not a normative formatting restriction: the official number-input reference does not establish one. The library therefore preserves caller-supplied initial-value strings. The paired observations are recorded in the paired-control evidence; they establish these six cases in one workspace, not a universal lexical rule. Do not conflate this runtime discrepancy with the confirmed requirement that min_value and max_value use JSON strings. Recheck the actual write path before changing library normalization.