6

I am trying to build an app that syncs a forum with slack. Posting on either site will reflect on the site, but I need the ID of messages in Slack. The Slack Documentation says that

the text property is the text spoken, and ts is the unique (per-channel) timestamp.

Does this mean that the ts field is effectively the ID for that channel?

Justine Krejcha
  • 1,235
  • 17
  • 27
Devin Dixon
  • 11,553
  • 24
  • 86
  • 167

1 Answers1

8

Yes, the timestamp (ts) is the ID of a message within a channel.

The complete ID of a message over multiple Slack workspaces is:

  • Slack workspace ID -> channel ID -> message timestamp

You can verify by looking for example on the API method chat.delete for deleting a message. There you also need to give the channel ID and the timestamp to identify the message to be deleted. (Plus the token, which is linked 1:1 to the slack team).

Erik Kalkoken
  • 30,467
  • 8
  • 79
  • 114
  • 3
    Thanks! They more clearly explain this in the documentation – Devin Dixon Mar 04 '18 at 16:19
  • 2
    [It is documented](https://api.slack.com/messaging/retrieving#individual_messages), but I think the real problem is that they didn't just create separate fields named `timestamp` and `id`, where `id` already includes both the channel ID and timestamp. That would be intuitive, instead of everyone having to search around for 10 minutes trying to figure it out :| – Ian Dunn Apr 15 '22 at 15:11