Skip to content

Instantly share code, notes, and snippets.

@KyMidd
Created February 27, 2025 17:27
Show Gist options
  • Select an option

  • Save KyMidd/8cff795dcc67efd3460efeaa3a53c111 to your computer and use it in GitHub Desktop.

Select an option

Save KyMidd/8cff795dcc67efd3460efeaa3a53c111 to your computer and use it in GitHub Desktop.
# Update slack response - handle initial post and streaming response
def update_slack_response(say, client, message_ts, channel_id, thread_ts, message_text):
# If message_ts is None, we're posting a new message
if message_ts is None:
slack_response = say(
text=message_text,
thread_ts=thread_ts,
)
# Set message_ts
message_ts = slack_response['ts']
else:
# We're updating an existing message
client.chat_update(
text=message_text,
channel=channel_id,
ts=message_ts,
)
# Return the message_ts
return message_ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment