Support bot for the Hack Club Slack
Find a file
Mish 43967cf289
App home improvements! (#133)
* Show an error message if the views_publish call fails

This means that if our Block Kit has a syntax error and Slack API returns en error for it, a fallback screen is shown instead of indefinite loading

* Include nav buttons in the header

* Fix header formatting error

I think this was a GH Copilot hallucination that I accepted bc it looked very similar to the OG code :(

* Show header on the loading screen

* Make clicking on a button during the loading phase work

* Delete views/home/apps.py

I don't think this view is used anywhere

* Use the new header style everywhere

* Remove buttons.py (no longer used)

* Show "dashboard" tab as selected during first load

This means that the "default" virtual view name no longer exists, but we have a DEFAULT_VIEW constant now

* Add at least some sort of return type to get_header()

* Make the helper and assigned views non-helper-friendly

* Allow non-helpers to access the app home

* Remove useless `or` statement

* Extract error_screen to a component

* Gate the tags view to only helpers

* Make the tags view non-helper-friendly

* Make the stats view non-helper-friendly

* Make the error text a bit nicer

* Fix type error

* Make the infinite loading situation less likely

This could happen if you spam-clicked one of the buttons (I tested with assigned tickets). I think the problem existed before but was made worse by the new `user_last_requested_view` logic - now it's back to normal and the issue is very hard to recreate.

* Remove "unknown user" view and transcripts

* Remove commented code block

* Remove comment the second

* Fix timezone fetching and add more logs
2025-12-08 11:54:00 +00:00
.github/workflows Configure CodeQL scans using YAML (#65) 2025-10-20 23:03:29 +00:00
.vscode Ensure the Prisma VSCode extension sticks with Prisma v6 (#118) 2025-11-20 13:06:17 +00:00
nephthys App home improvements! (#133) 2025-12-08 11:54:00 +00:00
prisma Preparation for improving the daily summary message (#124) 2025-11-29 11:25:49 +00:00
.dockerignore Add a Dockerignore file (#72) 2025-10-25 08:33:57 +00:00
.env.sample Make the header in app home configurable (#87) 2025-10-28 22:38:30 +00:00
.gitignore Preparation for improving the daily summary message (#124) 2025-11-29 11:25:49 +00:00
.pre-commit-config.yaml Initial commit 2025-05-30 22:49:06 +01:00
.python-version Initial commit 2025-05-30 22:49:06 +01:00
Dockerfile Add a Docker healthcheck (#99) 2025-11-11 02:28:28 +00:00
LICENSE Initial commit 2025-05-30 22:49:06 +01:00
manifest.yml Add files:write scope to app manifest (#86) 2025-10-28 22:37:25 +00:00
pyproject.toml Add support for pushing logs to an OpenTelemetry endpoint (#130) 2025-12-01 14:05:32 +00:00
README.md Document ?reopen (#79) 2025-10-26 16:53:15 +00:00
uv.lock Add support for pushing logs to an OpenTelemetry endpoint (#130) 2025-12-01 14:05:32 +00:00

Nephthys

Nephthys is the bot powering #summer-of-making-help and #identity-help in the Hack Club Slack! Below is a guide to set her up for developing and here's a list of some of her features :)

Features

Tags

You can tag tickets in the private tickets channel or with the macro ?tag <tag_name>. This will DM the people who are specialised in responding to those issues and have it show up in their assigned tickets. You can assign yourself to get notified for specific tags on the app home

Macros

Sometimes its nice to be able to do things quickly... Heres where macros come in! Send one of the following messages in an open thread and something will happen

  • ?resolve - the ticket gets closed. Equivalent of hitting i get it now
  • ?reopen - reopen a closed ticket
  • ?identity - redirect to #identity-help
  • ?faq - redirect to the FAQ
  • ?hii - silly message :3
  • ?shipcertqueue - tell them to wait and vote because there's a backlog of ships
  • ?fraud - redirect to fraud dept
  • ?thread - remove the reaction and all Nephthys replies to unclutter duplicates
  • more to come?? feel free to PR your own into hackclub/nephthys or tell me what you want

Stale

Tickets that have been not had a response for more than 3 days will automatically be closed as stale. The last helper to respond in the thread gets credit for closing them

Stale ticket handling is not working at the moment, but more features for dealing with stale tickets are planned.

Leaderboard

At midnight UK time each day, you get to see the stats for the day in the team channel! Helpers can also see more detailed stats at any time on the app home for the bot!

Assigned Tickets

When you send a message in a help thread, that thread is assigned to you and it is up to you to resolve it. You can see a list of threads waiting for you on the app home - just select the Assigned Tickets tab at the top

Prerequisites

  • Python (3.13 or later)
  • uv
  • A Slack workspace where you have permissions to install apps
  • Tunneling tool (for local development)
  • A PostgreSQL database (you can run one in Docker using the command below)
docker run --name hh-postgres -e POSTGRES_PASSWORD=postgres -p 5432:5432 -d postgres

Setting up the Slack App

  1. Go to https://api.slack.com/apps and click "Create New App".
  2. Choose "From an app manifest" and select your workspace.
  3. Copy and paste the manifest in manifest.yml.
  4. Review and create the app.
  5. In the "Basic Information" section, note down the App Id, Client Id, Client Secret, Signing Secret .
  6. Go to "OAuth & Permissions" and install the app to your workspace. Note down the "Bot User OAuth Token".

Setting up the Project

  1. Clone the repository:

    git clone https://github.com/hackclub/nephthys
    cd nephthys
    
  2. Install dependencies:

    uv sync
    source .venv/bin/activate # for bash/zsh
    source .venv/bin/activate.fish # for fish
    source .venv/bin/activate.csh # for csh
    source .venv/bin/activate.ps1 # for powershell
    
  3. Copy the .env.sample file to .env:

    cp .env.sample .env
    
  4. Edit the .env file and fill in the values:

Running the Application

  1. Start your tunneling tool and expose the local server. (Not needed in socket mode with SLACK_APP_TOKEN set)

    Note the HTTPS URL you get.

  2. Update your Slack app's request URLs:

    • Go to your Slack app's settings.
    • In "Event Subscriptions" and "Interactivity & Shortcuts", update the request URL to your HTTPS URL followed by /slack/events.
    • In "OAuth & Permissions", update Redirect URLs to your HTTPS URL followed by /slack/oauth_redirect.
  3. MAKE SURE YOU CHANGE THE COMMAND - DO NOT USE THE SAME COMMAND

  4. Install pre-commit hooks:

    uv run pre-commit install
    
  5. Start your database and update the database schema:

    uv run prisma db push
    uv run prisma generate
    
  6. Start the application:

    nephthys
    

Your Slack app should now be running and connected to your Slack workspace!

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Scripts

The codebase contains some scripts in the nephthys/scripts/ directory to help with development and testing. They are documented below.

Adding Dummy Data

add_dummy_data.py is a script that adds a bunch of dummy (i.e. fake) support ticket records to the database, for stress-testing/performance testing.

Usage: uv run nephthys/scripts/add_dummy_data.py <num_records>

  • Ensure you run it after the nephthys has been run at least once (and once the DB has been initialized)
  • It takes a while to run (adding 20k records takes ~50 seconds on my machine)
  • Don't run this in production, obviously

License

This project is licensed under the MIT License.