From 407ac995175dac12627910b269bef75919c94d76 Mon Sep 17 00:00:00 2001 From: Eden Zimbelman Date: Wed, 26 Aug 2026 14:31:13 -0700 Subject: [PATCH] feat: add chat streaming method examples (start/append/stop) Add copy-paste reference examples for the chat.startStream, chat.appendStream, and chat.stopStream Web API methods in the existing "chat" method family, alongside chat.postMessage. Co-Authored-By: Claude --- methods/README.md | 3 +++ methods/src/chat/chat_append_stream.py | 19 +++++++++++++++++++ methods/src/chat/chat_start_stream.py | 19 +++++++++++++++++++ methods/src/chat/chat_stop_stream.py | 18 ++++++++++++++++++ 4 files changed, 59 insertions(+) create mode 100644 methods/src/chat/chat_append_stream.py create mode 100644 methods/src/chat/chat_start_stream.py create mode 100644 methods/src/chat/chat_stop_stream.py diff --git a/methods/README.md b/methods/README.md index 299a2d5..c34b296 100644 --- a/methods/README.md +++ b/methods/README.md @@ -18,4 +18,7 @@ $ slack run chat_post_message.py # Make the request ### chat +- **[chat.appendStream](https://docs.slack.dev/reference/methods/chat.appendStream)**: Appends text to an existing streaming conversation. [Implementation](./src/chat/chat_append_stream.py). - **[chat.postMessage](https://docs.slack.dev/reference/methods/chat.postmessage)**: Sends a message to a channel. [Implementation](./src/chat/chat_post_message.py). +- **[chat.startStream](https://docs.slack.dev/reference/methods/chat.startStream)**: Starts a new streaming conversation. [Implementation](./src/chat/chat_start_stream.py). +- **[chat.stopStream](https://docs.slack.dev/reference/methods/chat.stopStream)**: Stops a streaming conversation. [Implementation](./src/chat/chat_stop_stream.py). diff --git a/methods/src/chat/chat_append_stream.py b/methods/src/chat/chat_append_stream.py new file mode 100644 index 0000000..3078577 --- /dev/null +++ b/methods/src/chat/chat_append_stream.py @@ -0,0 +1,19 @@ +import os + +from slack_sdk import WebClient + +# Read a token from an environment variable +token = os.environ.get("SLACK_TOKEN") + +# Initialize +client = WebClient(token=token) + +# Call the chat.appendStream method +response = client.chat_appendStream( + channel="C123ABC456", + ts="1234567890.123456", + markdown_text=" — reading the logs now", +) + +# Inspect the response +print(response) diff --git a/methods/src/chat/chat_start_stream.py b/methods/src/chat/chat_start_stream.py new file mode 100644 index 0000000..92fb9ea --- /dev/null +++ b/methods/src/chat/chat_start_stream.py @@ -0,0 +1,19 @@ +import os + +from slack_sdk import WebClient + +# Read a token from an environment variable +token = os.environ.get("SLACK_TOKEN") + +# Initialize +client = WebClient(token=token) + +# Call the chat.startStream method +response = client.chat_startStream( + channel="C123ABC456", + thread_ts="1234567890.123456", + markdown_text="Let me look into that", +) + +# Inspect the response +print(response) diff --git a/methods/src/chat/chat_stop_stream.py b/methods/src/chat/chat_stop_stream.py new file mode 100644 index 0000000..57ea3a5 --- /dev/null +++ b/methods/src/chat/chat_stop_stream.py @@ -0,0 +1,18 @@ +import os + +from slack_sdk import WebClient + +# Read a token from an environment variable +token = os.environ.get("SLACK_TOKEN") + +# Initialize +client = WebClient(token=token) + +# Call the chat.stopStream method +response = client.chat_stopStream( + channel="C123ABC456", + ts="1234567890.123456", +) + +# Inspect the response +print(response)