https://api.slack.com/start/building/bolt-java
gradle dependency is copied from: https://slack.dev/java-slack-sdk/guides/getting-started-with-bolt#gradle
code refer to MyApp setup refer to: https://slack.dev/java-slack-sdk/guides/getting-started-with-bolt#enable-hello-command
- add code
app.command("/hello", (req, ctx) -> {
return ctx.ack(":wave: Hello!");
});- add Slash Command in Slack app config page https://slack.dev/java-slack-sdk/guides/getting-started-with-bolt#enable-hello-command eg: Command: /hello Request URL: https://97f1-130-41-63-67.ngrok.io/slack/events Short Description: anything
if this is the first time to enable Slash command, you need to reinstall Slack bot
https://slack.dev/java-slack-sdk/guides/bolt-basics
- app.event
- Events API: Responds to any kinds of bot/user events you subscribe.
- app.message
- Responds to messages posted by a user only when the text in messages matches the given keyword or regular expressions.
- app.command
- app.blockAction
- app.blockSuggestion
- app.viewSubmission
- app.viewClosed
- app.globalShortcut
- app.messageShortcut
- app.dialogSubmission
- app.dialogSuggestion
- app.dialogCancellation
- app.attachmentAction
ctx.ack
ctx.client().chatPostMessage ctx.say ctx.getRequestUserToken() ctx.client().searchMessages
app.use((req, _resp, chain) -> {})
Built-in Middleware List
- RequestVerification
- to verify the signature in HTTP Mode requests
- SingleTeamAuthorization or MultiTeamsAuthorization
- to lookup the valid OAuth access token for handling a request
- IgnoringSelfEvents
- to skip the events generated by this app’s bot user (this is useful for avoiding code error causing an infinite loop)
- SSLCheck
- to handle ssl_check=1 requests from Slack
AppConfig appConfig = new AppConfig();
appConfig.setIgnoringSelfEventsEnabled(false); // the default is true
appConfig.setSslCheckEnabled(false); // the default is true
// Please don't do this without an alternative solution
appConfig.setRequestVerificationEnabled(false); // the default is true
App app = new App(appConfig);- Slash Commands
- Interactive Components
- https://slack.dev/java-slack-sdk/guides/interactive-components
app.blockAction- Buttons
- Select menus
- Multi-select menus
- Overflow menus
- Date pikers
- Time pickers
- Plain-text input fields
- Radio buttons
- Checkboxes
- If you post a message using response_url, call
ctx.ack()without arguments and usectx.respond()to post a message.
- Modals
- Shortcuts: https://slack.dev/java-slack-sdk/guides/shortcuts
- either global or message,
- message shortcut can be used to select a message, then create a Jira tt
- either global or message,
- App Home
- Events API
- App Distribution (OAuth Flow)
https://api.slack.com/surfaces
- The Home tab
- Modals
- Messages
- The continuum of app surfaces