Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions methods/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
19 changes: 19 additions & 0 deletions methods/src/chat/chat_append_stream.py
Original file line number Diff line number Diff line change
@@ -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)
19 changes: 19 additions & 0 deletions methods/src/chat/chat_start_stream.py
Original file line number Diff line number Diff line change
@@ -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)
18 changes: 18 additions & 0 deletions methods/src/chat/chat_stop_stream.py
Original file line number Diff line number Diff line change
@@ -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)