Skip to content

Commit e0504e6

Browse files
zimegClaude
andauthored
feat(methods): add chat.appendStream, chat.startStream and chat.stopStream method examples (#214)
Co-authored-by: Claude <svc-devxp-claude@slack-corp.com>
1 parent ef1d40a commit e0504e6

4 files changed

Lines changed: 61 additions & 0 deletions

File tree

‎methods/README.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ $ slack run chat_post_message.py # Make the request
5252

5353
### chat
5454

55+
- **[chat.appendStream](https://docs.slack.dev/reference/methods/chat.appendStream)**: Appends text to an existing streaming conversation. [Implementation](./src/chat/chat_append_stream.py).
5556
- **[chat.postMessage](https://docs.slack.dev/reference/methods/chat.postmessage)**: Sends a message to a channel. [Implementation](./src/chat/chat_post_message.py).
57+
- **[chat.startStream](https://docs.slack.dev/reference/methods/chat.startStream)**: Starts a new streaming conversation. [Implementation](./src/chat/chat_start_stream.py).
58+
- **[chat.stopStream](https://docs.slack.dev/reference/methods/chat.stopStream)**: Stops a streaming conversation. [Implementation](./src/chat/chat_stop_stream.py).
5659

5760
### slackbot
5861

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import os
2+
3+
from slack_sdk import WebClient
4+
5+
# Read a token from an environment variable
6+
token = os.environ.get("SLACK_TOKEN")
7+
8+
# Initialize
9+
client = WebClient(token=token)
10+
11+
# Call the chat.appendStream method
12+
response = client.chat_appendStream(
13+
channel="C123ABC456",
14+
ts="1234567890.123456",
15+
markdown_text="**This is bold text**",
16+
)
17+
18+
# Inspect the response
19+
print(response)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import os
2+
3+
from slack_sdk import WebClient
4+
5+
# Read a token from an environment variable
6+
token = os.environ.get("SLACK_TOKEN")
7+
8+
# Initialize
9+
client = WebClient(token=token)
10+
11+
# Call the chat.startStream method
12+
response = client.chat_startStream(
13+
channel="C123ABC456",
14+
markdown_text="**This is bold text**",
15+
thread_ts="1721609600.123456",
16+
recipient_user_id="U0123456789",
17+
recipient_team_id="T0123456789",
18+
)
19+
20+
# Inspect the response
21+
print(response)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import os
2+
3+
from slack_sdk import WebClient
4+
5+
# Read a token from an environment variable
6+
token = os.environ.get("SLACK_TOKEN")
7+
8+
# Initialize
9+
client = WebClient(token=token)
10+
11+
# Call the chat.stopStream method
12+
response = client.chat_stopStream(
13+
channel="C123ABC456",
14+
ts="1234567890.123456",
15+
)
16+
17+
# Inspect the response
18+
print(response)

0 commit comments

Comments
 (0)