Open bence-nagy opened 3 years ago
Hey, you can get if you copy the link to the message and extract the ID from the end of the URL. example:
https://[yourdomain].slack.com/archives/C6JPLL60L/p1582740873000100 ------------------------------------------------------------------------^^^^^^^^^^^^^^^^^^^
becomes: 1582740873.000100
hope that helps.
Sorry, I only really addressed part of your question here...
chat.postMessage that you've linked to is not the API method that is being called as part of SlackClient.Post.
Posting to the webhook URL, sadly, does not return the ThreadId in the same way.
I started some time ago implementing the API https://github.com/mrb0nj/Slack.Webhooks/blob/feature/api/src/Slack.Webhooks/Chat/ChatClient.cs but this branch is massively different to the current implementation of this library.
Thanks for the replies and for clarifying that the webhook's post uses a different API method, now I get why this property is not returned.
Do you have a rough estimation about when the mentioned branch will be ready? Or is already in a state that I could try it out? Do you plan to create a (beta) nuget package from it?
Either way, thanks for the great package 👍
Any updates?
we need this too!
we also need this functionality
Consider the following use case: A bot wants to post subsequent messages into a single thread within a slack channel. So the first message would be a normal message, further messages would be thread replies to that message.
For this to work - as far as I can tell - you would need to get the identifier (which seems to be the
ts
property) of the first posted message. The slack API returns this information (see the documentation) in the form of"ts": "1503435956.000247"
.If I had the value of that property then I could construct message objects with their
ThreadId
property set to the value returned by the first posted message, but this wrapper does not seems to expose that returned property.The
Post
methods only seem to return with abool
(or aTask<bool>
) and it seems that they do not modify the passedSlackMessage
object, so the returnedts
value is simply discarded. Is it so or am I missing something?Would it be possible to somehow expose the
ts
property of a message once posted? Either via returning it from the Post methods or maybe storing it in the message object passed to the methods - so mutating the passed argument?Or is there any workaround I can use? (Apart from using the slack API directly - which is of course a solution to my problem.)
Thanks in advance.