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

Append `thread_ts` to the payload of a lazy listener in Slash Commands #1276

Closed adrianfusco closed 7 months ago

adrianfusco commented 7 months ago

Hi!

I am using slash commands with answers that will take more than 3 seconds so I'm using a lazy_listener, e.g. lazy_listener.

I wonder if there's any way to add to the payload the thread_ts of the ack function to the lazy one SlashCommandPayload.json

Reproducible in:

def fetch_data(respond, body):
    data = get(...)
    respond(f"Data: {data}")

def delayed_response(body, say):
   ack()
   # I can append data to the `body` and access it in the `fetch_data` function.
   response = say('Fetching info...')
   # Once I post a message I can access the `thread_ts` from `response`
   # But I can't modify the body here so I can't pass the `thread_ts` to the `fetch_data` function

app.command("/get-data")(
    ack=delayed_response,
    lazy=[fetch_data]
)

Thanks.

adrianfusco commented 7 months ago

Opening in the right project (python one): https://github.com/slackapi/python-slack-sdk/issues/1453