Skip to content

Conversation

@zimeg
Copy link
Member

@zimeg zimeg commented Dec 18, 2025

Summary

This PR updates the chat_stream helper to support and flush "chunks".

Testing

The following snippet might be useful in testing:

import time

from slack_sdk import WebClient
from slack_sdk.models.messages.chunk import MarkdownTextChunk, TaskUpdateChunk

streamer = client.chat_stream(
    channel="C0123456789",
    recipient_team_id="T0123456789",
    recipient_user_id="U0123456789",
    thread_ts="10101010101.010101",
)

streamer.append(
    chunks=[
        MarkdownTextChunk(
            text="Hello.\nI have received the task. ",
        ),
        MarkdownTextChunk(
            text="This task appears manageable.\nThat is good.",
        ),
        TaskUpdateChunk(
            id="001",
            title="Understanding the task...",
            status="in_progress",
            details="- Identifying the goal\n- Identifying constraints",
        ),
        TaskUpdateChunk(
            id="002",
            title="Performing acrobatics...",
            status="pending",
        ),
    ],
)
time.sleep(4)

streamer.append(
    chunks=[
        TaskUpdateChunk(
            id="001",
            title="Understanding the task...",
            status="complete",
            details="\n- Pretending this was obvious",
            output="We'll continue to ramble now",
        ),
        TaskUpdateChunk(
            id="002",
            title="Performing acrobatics...",
            status="in_progress",
        ),
    ],
)
time.sleep(4)

streamer.stop(
    chunks=[
        TaskUpdateChunk(
            id="002",
            title="Performing acrobatics...",
            status="complete",
            details="- Jumped atop ropes\n- Juggled bowling pins\n- Rode a single wheel too",
        ),
        MarkdownTextChunk(
            text="The crowd appears to be astouned and applauds :popcorn:"
        ),
    ],
)

Category

  • slack_sdk.web.WebClient (sync/async) (Web API client)
  • /docs (Documents)
  • tests/integration_tests (Automated tests for this library)

Requirements

  • I've read and understood the Contributing Guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've run python3 -m venv .venv && source .venv/bin/activate && ./scripts/run_validation.sh after making the changes.

@codecov
Copy link

codecov bot commented Dec 18, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.93%. Comparing base (1fb7355) to head (92c93e0).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@                      Coverage Diff                      @@
##           zimeg-feat-ai-apps-chunks    #1809      +/-   ##
=============================================================
+ Coverage                      83.90%   83.93%   +0.02%     
=============================================================
  Files                            116      116              
  Lines                          13168    13192      +24     
=============================================================
+ Hits                           11049    11073      +24     
  Misses                          2119     2119              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement M-T: A feature request for new functionality semver:minor web-client

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants