Skip to content

Aaron's Proposed Bot

apklinker edited this page Apr 6, 2021 · 6 revisions

Here is my proposal for what the slack bot would look like.

Rest API Server

Slack Bots are created in the slack workspace console. They are backed by a simple REST backend. These backends have the following endpoints:

  • /commands - used for slash commands
  • /interactions - used to handle the results of forms and shortcuts
  • /data-sources - used to populate custom data for fields in forms

If we want to use shortcuts instead of commands (like the existing HackerRank app), we actually don't need to worry about the /comnmands endpoint at all!

Also, with this proposal, there aren't any custom fields to populate lists in forms, so the /data-sources endpoint is also not necessary

So with that in mind, here's what the interactions might look like. The endpoint is just a massive switch statement based on the type of interaction to handle:

  • /interactions
    • shortcut-join-queue
      • Shortcut title: "Join Queue"
      • This opens a dialog prompting a teammate for the languages they would like to review
      • When submitted, it triggers the submit-join-queue interaction
    • shortcut-request-review
      • Shortcut title: "Request a Review"
      • This opens a form similar to the existing form, letting the requestor enter the languages used and the due date
      • When the form is submitted, it triggers the submit-request-review interaction
    • shortcut-leave-queue
      • Shortcut title: "Leave Queue"
      • Unlike the other shortcuts, this doesn't open a form, since there is nothing to prompt the user
      • It updates the queue directly
    • submit-join-queue
      • Triggered after submitting dialog opened by shortcut-join-queue
      • Appends the teammate to the database and adds them to the end of the queue
    • submit-request-review
      • Triggered after submitting dialog opened by shortcut-request-review
      • This is where the queue logic and teammate notifications will be initiated

shortcut-* - These are the types of interactions from triggering a shortcut using the ⚡ button

submit-* - These are the types of interactions from submitting a dialog


Flow

  1. Teammate opts into the queue using the "Join HackerRank Queue (join-queue)" shortcut
    • Shows the user a form to input their languages
  2. When a HackerRank is requested to be reviewed using the "HackerRank Review (request-review)" shortcut we
    • Prompt for the languages and due date like before
    • When submitted, notify the people at the top of the queue and start their timeouts
  3. To opt-out of the queue, teammates use the "Leave HackerRank Queue (leave-queue)" shortcut

Clone this wiki locally