Skip to content
JayZhou-1Public

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

12 Commits

Folders and files

Repository files navigation

instruction

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

enable hello command

code refer to MyApp setup refer to: https://slack.dev/java-slack-sdk/guides/getting-started-with-bolt#enable-hello-command

high level steps to add a new command

  1. add code
    app.command("/hello", (req, ctx) -> {
        return ctx.ack(":wave: Hello!");
    });
  1. 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

Bolt Basics

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

Acknowledge Incoming Requests

ctx.ack

Respond to User Actions

Use Web APIs / Reply using say utility

ctx.client().chatPostMessage ctx.say ctx.getRequestUserToken() ctx.client().searchMessages

Use Logger

Middleware

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);

Modals

todo

  • 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 use ctx.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
  • App Home
  • Events API
  • App Distribution (OAuth Flow)

surace

https://api.slack.com/surfaces

  • The Home tab
  • Modals
  • Messages
  • The continuum of app surfaces

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages