Skip to content

feat(slack): add unfurl_links/unfurl_media control to send_message#30

Merged
hampsterx merged 1 commit into
masterfrom
feat/slack-unfurl-control
Jul 1, 2026
Merged

feat(slack): add unfurl_links/unfurl_media control to send_message#30
hampsterx merged 1 commit into
masterfrom
feat/slack-unfurl-control

Conversation

@hampsterx

@hampsterx hampsterx commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Callers can suppress Slack's link/media preview cards (e.g. a digest of many links that would otherwise unfurl into a wall of cards) while keeping the links themselves clickable.
  • SlackClient.send_message gains optional unfurl_links / unfurl_media params (default None).
  • Params are forwarded to chat_postMessage only when explicitly set, so every existing caller keeps Slack's default behavior.

Backwards compatibility

  • Additive optional params, default None. When both are unset, chat_postMessage is called with exactly channel/text/blocks/attachments (no unfurl keys), byte-for-byte the prior behavior. The is not None guard means unfurl_links=False is forwarded, not dropped by a truthiness check. A dedicated test locks in the omit-when-unset path.

Review

  • Internal: clean (verified the is not None guard forwards False).
  • External (Codex, Kimi-agentic): both clean, no findings.

Changes

  • nui_shared_utils/slack_client.py: two optional params + conditional kwargs pass-through.
  • tests/test_slack_client.py: forward-when-set and omit-when-unset tests.

Test plan

  • Unit test: flags forwarded to chat_postMessage when set
  • Unit test: flags omitted when unset (default behavior preserved)
  • test_slack_client.py green (45 passed)
  • New additions Black-clean

Summary by CodeRabbit

  • New Features

    • Added optional controls for Slack message link and media unfurling, allowing messages to explicitly enable or disable this behavior.
    • When these options are not set, existing default Slack behavior is preserved.
  • Tests

    • Added coverage to verify unfurl settings are passed through when provided and omitted when left unset.

- Callers can suppress Slack's link/media preview cards (e.g. a digest of
  many links that would otherwise unfurl into a wall of cards) while keeping
  the links themselves clickable.
- SlackClient.send_message gains optional unfurl_links / unfurl_media params
  (default None).
- Params are forwarded to chat_postMessage only when explicitly set, so every
  existing caller keeps Slack's default behavior.

Backwards compatibility: additive optional params, default None. Existing
callers (and their call assertions) are byte-for-byte unchanged; a second test
locks in the omit-when-unset behavior.
@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d2f508b8-7b77-401a-8bee-e46b6a2fd74d

📥 Commits

Reviewing files that changed from the base of the PR and between fc918d7 and 59436cb.

📒 Files selected for processing (2)
  • nui_shared_utils/slack_client.py
  • tests/test_slack_client.py

Walkthrough

Added optional unfurl_links and unfurl_media parameters to SlackClient.send_message, forwarding them to Slack's chat_postMessage only when explicitly set, otherwise preserving default unfurl behavior. Corresponding unit tests verify both forwarding and omission scenarios.

Changes

Unfurl Parameter Support

Layer / File(s) Summary
Add and document unfurl parameters
nui_shared_utils/slack_client.py
send_message gains unfurl_links/unfurl_media optional parameters (documented in docstring), and _send_operation conditionally includes them in chat_postMessage kwargs only when not None.
Unfurl behavior tests
tests/test_slack_client.py
New tests confirm explicit False unfurl flags are forwarded to chat_postMessage, and unset flags are omitted from the call.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Sequence Diagram(s)

sequenceDiagram
    participant Caller
    participant SlackClient
    participant SlackAPI

    Caller->>SlackClient: send_message(unfurl_links, unfurl_media)
    SlackClient->>SlackClient: build kwargs dict
    alt unfurl_links or unfurl_media not None
        SlackClient->>SlackClient: add flags to kwargs
    end
    SlackClient->>SlackAPI: chat_postMessage(kwargs)
    SlackAPI-->>SlackClient: response
    SlackClient-->>Caller: bool result
Loading

Poem

A rabbit hops with links in tow,
To furl or not, now you can know! 🐇
False means hidden, None means free,
Slack previews dance as they should be.
Hop, test, and ship — quick as can be! 🌿

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding unfurl_links and unfurl_media controls to SlackClient.send_message.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/slack-unfurl-control

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • LINEAR integration encountered authorization issues. Please disconnect and reconnect the integration in the CodeRabbit UI.

Comment @coderabbitai help to get the list of available commands.

@hampsterx hampsterx merged commit b9e7687 into master Jul 1, 2026
9 checks passed
@hampsterx hampsterx deleted the feat/slack-unfurl-control branch July 1, 2026 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant