README
¶
Rich-text field checks
This example tests each added rich-text field against a real Slack workspace. It posts one message per field, prints the raw response before the library decodes it, and checks whether the library preserves the returned fields. Use a channel intended for tests.
Setup
Export SLACK_BOT_TOKEN with a bot token (xoxb-) that has chat:write, and invite the bot
to the channel. The repository's .envrc can supply this variable. Reinstall the app after
changing scopes. Posting needs no Socket Mode, event subscriptions, agent app configuration,
Enterprise Grid organization, or paid plan. Some metadata may be generated by Slack or apply
only to particular features; API acceptance does not prove that Slack uses it.
Reading an existing message also needs the history scope for its conversation type:
channels:history, groups:history, im:history, or mpim:history. The bot must have access
to that conversation.
Post the checks
From the repository root, after loading .envrc:
go run ./examples/rich_text_fields -channel C123 -user U123
This checks color and date styles, date timezone, channel and user from_llm, and the four
link flags (unsafe, from_llm, is_slack_url, truncated). Missing case-specific flags
produce a SKIP line. Each case can also run alone:
go run ./examples/rich_text_fields -channel C123 -case date-timezone
go run ./examples/rich_text_fields -channel C123 -case channel-tab -tab TAB_ID
go run ./examples/rich_text_fields -channel C123 -case emoji-url \
-emoji CUSTOM_EMOJI_NAME -emoji-url https://HOST/PATH/emoji.png
go run ./examples/rich_text_fields -channel C123 -case broadcast-style
Use an actual tab ID from the target channel for -tab. Use a custom emoji name and its public
asset URL for the emoji check. The emoji url field comes from Slack's
official Node types
and is intended for custom emoji shared across workspaces.
The broadcast case posts @here, which can notify active channel members. It is excluded from
-case all unless you add -allow-broadcast. To run every case:
go run ./examples/rich_text_fields -channel C123 -user U123 -tab TAB_ID \
-emoji CUSTOM_EMOJI_NAME -emoji-url https://HOST/PATH/emoji.png -allow-broadcast
Use -case list to list cases. Add -json to print the outgoing blocks without calling Slack,
or -debug for Slack client logs.
Read a real payload
If Slack rejects or removes a field on posting, inspect a message produced by the Slack feature
that uses it. The read action checks the selected message's top-level blocks:
go run ./examples/rich_text_fields -action read \
-url https://WORKSPACE.slack.com/archives/C123/p1720710212123456
Alternatively, pass -channel C123 -ts 1720710212.123456. This uses
conversations.history, so choose a channel message rather than a thread reply.
Interpret the output
ACCEPTEDmeanschat.postMessagesucceeded.RETURNED ... present=true unchanged=truemeans Slack returned the value sent for that field.RETURNED ... present=falsemeans Slack omitted it. This does not prove a decoding bug.DECODE ... preserved=truemeans the typed library retained the field Slack returned.DECODE CHECK FAILEDorpreserved=falseidentifies a library decoding problem and produces a nonzero exit status. API failures also produce a nonzero status, after the other cases run.SKIPmeans the case did not run. Supply the indicated flags to complete it.
Check the posted messages in Slack for visible styles, date formatting and tab navigation.
Metadata can have no visible effect. Paste back the case names, RETURNED and DECODE lines,
and any Slack errors with their response messages. Raw output can contain message content.
The field definitions are in Slack's element reference.