Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to search for a message by a specific ts

Tags:

slack-api

I am trying to get the parent message of a threaded reply with the Slack API. When a new reply is put, it has a "thread_ts" attached to it, which corrsponds to its parent message's "ts". I tried to do a searchall with the ts as the query but this didn't work. How would I do this?

like image 347
user3408657 Avatar asked Oct 28 '25 05:10

user3408657


1 Answers

See Slack's docs on retrieving a single message with channels.history. This "selecting 1 item from a range" approach should also work with other channel history methods and conversations.history.

The easiest way is to provide the thread_ts value you want to look up as the latest parameter to conversations.history, along with the containing channel ID as channel, and a limit of 1 to ask for a single message. You will need the corresponding *:history scope to make the request.

Example: GET /api/conversations.history?token=TOKEN_WITH_CHANNELS_HISTORY_SCOPE&channel=C2EB2QT8A&latest=1476909142.000007&inclusive=true&limit=1

like image 135
Taylor Singletary Avatar answered Oct 31 '25 12:10

Taylor Singletary