How to add a thread message if using slacker
as3379 opened this issue · 1 comments
as3379 commented
How to find ts_id from a given response. I'm trying to send a message to slack and add a thread to original message. To do so I need the ts_id of the original message. The code looks like:
response = client.chat.post_message(channel=channel, text=message)
ts = response['ts']
text = 'Copy into https://codebeautify.org/jsonviewer.'
client.chat.post_message(
channel=channel,
thread_ts=ts,
text=text
)
However, code fails to retrieve the ts value from response.
GregHilston commented
@as3379 I know this is a very late reply, but I tested out sending a message in a public channel and got this reply:
{'client_msg_id': '6ed12f32-c9fa-4c6f-9bb5-9c5993a78bfa', 'suppress_notification': False, 'type': 'message', 'text': 'test', 'user': 'U389XUHT2', 'team': 'T38AP97Q9', 'blocks': [{'type': 'rich_text', 'block_id': 'N4y3', 'elements': [{'type': 'rich_text_section', 'elements': [{'type': 'text', 'text': 'test'}]}]}], 'source_team': 'T38AP97Q9', 'user_team': 'T38AP97Q9', 'channel': 'C3FAX3UCV', 'event_ts': '1591450995.006800', 'ts': '1591450995.006800'}
Which has your ts
as expected