slackapi / java-slack-sdk

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

Responding to an external_select search request within 3 seconds #1204

Closed karishma21mahajan21 closed 12 months ago

karishma21mahajan21 commented 12 months ago

I am using external multi select in a modal. Calling BlockSuggestionHandler when user enters some characters and calling external api in this handler with each user interaction. But the response from external api and conversion to option List is taking more than 3 sec. Hence getting "Nothing could be found" in the dropdown.

Tried checking response_url but it is missing for this block interaction and as per slack docs response_url in modals is only available on submission. Also tried to use views.update api with the list of options fetched from api call but for external multi select, we do not have options where i can set the list. Please suggest some way out for this external multi select.

karishma21mahajan21 commented 12 months ago

Added reference of the suggestionHandler using for this interaction https://github.com/karishma21mahajan21/slack-multi-select-external/blob/main/ClassUtil

seratch commented 12 months ago

Hi @karishma21mahajan21, thanks for writing in.

I understand that retrieving data for returning keyword search results can take more than 3 seconds in some situations. However, your app needs to return results within 3 seconds for external select requests and there is no workaround. Please consider optimizing the response time in some ways.

I hope this helps! If you don't have anything further to ask on this topic, would you mind closing this issue?

karishma21mahajan21 commented 12 months ago

Hi @seratch, Thank you for reverting.

Can you suggest any other way of populating the external select? Will view.push() would work? Actually i am facing issues in setting values for multi select in this scenario as we don't have .options() for external multi select.

seratch commented 12 months ago

Will view.push() would work?

No, it does not.

To handle external select search requests, you need to have app.blockSuggestion() handler, which must return options data within 3 seconds. Please refer to https://slack.dev/java-slack-sdk/guides/interactive-components to learn how to write the code. Also, please note that you need to configure Features > Interactivity & Shortcuts > Select Menus > Options Load URL on https://api.slack.com/apps for it.

karishma21mahajan21 commented 12 months ago

@seratch Thank you for clarifying my doubts. Closing this issue now.