slackapi / java-slack-sdk

Slack Developer Kit (including Bolt for Java) for any JVM language
https://slack.dev/java-slack-sdk/
MIT License
570 stars 209 forks source link

Request for Slack api WebhookResponse send(String url, Payload payload) to return ts value #1254

Closed rhibiscusc closed 7 months ago

rhibiscusc commented 8 months ago

My issue is similar to the problem described here: https://stackoverflow.com/questions/56291169/slack-get-thread-id-after-posting-message-using-incoming-web-hook

I am currently using slack as our new service notification hub. But I like to organize the notification per a specific event id. So when the service is going to persist the ts value for the first message related to the event id and put subsequent message in the thread.

Category (place an x in each of the [ ])

Requirements

Please make sure if this topic is specific to this SDK. For general questions/issues about Slack API platform or its server-side, could you submit questions at https://my.slack.com/help/requests/new instead. :bow:

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you agree to those rules.

hello-ashleyintech commented 8 months ago

Hi, @rhibiscusc! Thank you for your question! 🙌

Based on the documentation, it looks like not returning the ts is not just a limitation of the Java SDK, but a limitation of Incoming Webhooks in general:

You can use an Incoming Webhook to make your message appear as a reply in a thread. You'll need to retrieve the message ts value, however, as it is not returned when sending a request to an Incoming Webhook.

You can retrieve the ts value in one of the following ways:

I hope this helps!

seratch commented 7 months ago

As Ashly mentioned, you can utilize other web APIs to fetch the data. Another suggestio is to switch to chat.postMessage API rather than using an incoming webhook. The chat.postMessage API response provides the posted message's channel ID and ts. This should be the most straight-forward way to achieve your goal.

Since we don't have anything else to share on this topic, let me close this issue. That said, whenever you have any follow up questions on this topic, please don't hesitate to write in!