Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add thread mate plugin #1294

Merged
merged 3 commits into from
Oct 16, 2023
Merged

Add thread mate plugin #1294

merged 3 commits into from
Oct 16, 2023

Conversation

mszostok
Copy link
Collaborator

@mszostok mszostok commented Oct 10, 2023

Description

Changes proposed in this pull request:

  • Add thread mate plugin
    • randomize initial next idx value
    • opt to define ack message emoji
    • opt to bind for channel messages
    • persist processed activity

Testing

  1. Build plugin: PLUGIN_TARGETS="thread-mate" make build-plugins-single

  2. Create config:

    Details

    communications:
      default-group:
        socketSlack:
          enabled: true
          channels:
            general:
              name: backoffice
              bindings:
                executors:
                  - helping-hands-assigner
                sources: []
            default:
              name: helping-hands
              textMessageBindings:
                event: ChannelMessage # currently only ChannelMessage is supported. Other options that we may add in the future: ChannelMessage, ThreadMessage, AllMessages
                messages:
                  - text:
                      include: ".*" # all messages
                    users:
                      exclude: ["U02KKBR5PE1:Mateusz", "etc"]
                    processedEmojiIndicator: "robot_face" # empty - disabled
                    command: "thread-mate pick --bk-cmd-header 'Help assistance' "
                    executors:
                      - helping-hands-assigner
              bindings:
                executors: []
                sources: []
    
          appToken: "xapp-"
          botToken: "xoxb-"
    
    executors:
      helping-hands-assigner:
        botkube/thread-mate:
          enabled: true
          context:
            rbac:
              group:
                type: Static
                static:
                  values: [ "system:masters" ]
          config:
            pick:
              # userCooldownTime represents the time that must elapse for a given user's message before the "pick" method can be used again.
              userCooldownTime: 3m
              #messageTemplate: |
                # ...
            roundRobin:
              assignees: ["U02KKBR5PE1:Mateusz", "etc"]
              groupName: "botkube"
    
    aliases:
      act-all:
        command: thread-mate get activity
        displayName: "Get thread activity"
      act:
        command: thread-mate get activity --assignee-ids
        displayName: "Get thread activity"
    
    plugins:
      cacheDir: "/tmp/plugins"
      repositories:
        botkube:
          url: http://host.k3d.internal:3010/botkube.yaml
    
    settings:
      log:
        level: "debug"
        formatter: text
      clusterName: "labs"
      upgradeNotifier: false
    
    analytics:
      disable: true

  3. Start plugin server: env PLUGIN_SERVER_HOST=http://host.k3d.internal go run test/helpers/plugin_server.go

  4. Run Botkube: env LOG_LEVEL_EXECUTOR_BOTKUBE_THREAD_MATE=debug BOTKUBE_CONFIG_PATHS="./helm/botkube/values.yaml,/tmp/mate-cfg.yaml" go run ./cmd/botkube-agent/main.go

  5. Test:

    • round-robin rotation
    • getting DMs
    • use custom emoji
    • cooldown window for using pick
      • if a user sends e.g. 3 messages on main thread within X minutes, only the first one is used to select a support person.
    • @Botkube thread-mate get activity:
      • takeover button
      • mark as resolved
      • export data as markdown and csv
      • search options
    • define different message template
    • Botkube should ignore messages from the support person
    • Thread messages should be ignored
    • restart Botkube, activity should be preserved

Related issue(s)

Notes

Make sure that your socket slack app is subscribed to channel events
Screenshot 2023-10-11 at 22 55 24

@mszostok mszostok added the enhancement New feature or request label Oct 10, 2023
@mszostok mszostok force-pushed the thread-mate-plugin branch 3 times, most recently from 60b9e29 to 7c1977c Compare October 11, 2023 20:47
@mszostok mszostok marked this pull request as ready for review October 11, 2023 20:48
@mszostok mszostok requested a review from PrasadG193 as a code owner October 11, 2023 20:48
@mszostok mszostok requested review from a team and pkosiec October 11, 2023 20:48
Copy link
Collaborator

@pkosiec pkosiec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just fantastic 🚀 A few small comments/questions, but overall the functionality works even better than I thought it will be!

internal/executor/x/mathx/int.go Show resolved Hide resolved
pkg/api/executor/grpc_adapter.go Outdated Show resolved Hide resolved
pkg/api/executor/grpc_adapter.go Outdated Show resolved Hide resolved
pkg/api/message.go Show resolved Hide resolved
pkg/api/message.go Outdated Show resolved Hide resolved
internal/executor/thread-mate/cm_sync.go Outdated Show resolved Hide resolved
internal/executor/thread-mate/system_data.go Outdated Show resolved Hide resolved
internal/executor/thread-mate/service.go Outdated Show resolved Hide resolved
internal/executor/thread-mate/service.go Show resolved Hide resolved
internal/executor/thread-mate/service.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@pkosiec pkosiec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - again, well done!

@mszostok mszostok enabled auto-merge (squash) October 16, 2023 09:02
@mszostok mszostok merged commit 69e606a into kubeshop:main Oct 16, 2023
15 checks passed
@mszostok mszostok deleted the thread-mate-plugin branch October 16, 2023 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants