slacker icon indicating copy to clipboard operation
slacker copied to clipboard

How to add a thread message if using slacker

Open as3379 opened this issue 5 years ago • 1 comments

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.

as3379 avatar Oct 11 '19 18:10 as3379

@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

GregHilston avatar Jun 06 '20 13:06 GregHilston