Skip to content

Gnomecromancer/hackatime-bot

 
 

Repository files navigation

Logo
Hackatime Slack Bot

signup for a hackatime account and get password resets; all on on the hackclub slack!

How do I use it?

Run the /hackatime command in the slack and it will prompt you to click a button to create an account if you don't have one, or to reset your password if you do.

creating an account creating an account - success

From a developer's perspective

There is a sweet message queue that is used to handle all hackatime slack messages. This is handled and persisted across restarts with bun:sqlite. To access the queue you need an admin token which you can ask me for on slack (@krn).

The queue is interacted with via a POST request to /slack/message with a channel, text, and (optionally) blocks json encoded in the body.

curl -X POST "https://hackatime-bot.kierank.hackclub.app/slack/message" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer NOTLEEKINGTHATLOL" \
-d '{
  "channel": "U062UG485EE",
  "text": "Hello from hackatime!"
}'

or via fetch with blocks

await fetch("https://hackatime-bot.kierank.hackclub.app/slack/message", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    Authorization: `Bearer ${process.env.MESSAGE_QUEUE_TOKEN}`,
  },
  body: JSON.stringify({
    channel: "U062UG485EE",
    text: "Hello from hackatime!",
    blocks: [
      {
        type: "section",
        text: {
          type: "mrkdwn",
          text: "Hello from hackatime!",
        },
      },
      {
        type: "divider",
      },
      {
        type: "context",
        elements: [
          {
            type: "mrkdwn",
            text: "This is a message from the hackatime slack bot!",
          },
        ],
      },
    ],
  }),
});

Devving

Create a slack app as per the manifest.yaml and an env as below

SLACK_BOT_TOKEN=xoxb-xxx-xxxx-xxxxxx
SLACK_SIGNING_SECRET=xxxxxx
NODE_ENV=development
ADMINS=U062UG485EE
HACKATIME_API_KEY=xxxxxx
bun install
bun run index.ts

then start an ngrok

ngrok http --domain casual-renewing-reptile.ngrok-free.app 3000

Screenshots

A bunch of screenshots of all the models

Initial Signup

Run the /hackatime command in slack and it will start the signup process

creating an account
First you'll see the initial signup prompt

cancel creating account
No pressure - you can always cancel if you change your mind

creating an account - password
Choose a secure password that meets the requirements

creating an account - bad password
Make sure to enter a valid password!

creating an account - confirm
Confirm your password to make sure it's entered correctly

creating an account - success
Success! Your account is now created

Existing Account

After you've created an account, you can reset your password if needed by again running the /hackatime command in slack

has account
The bot will recognize your existing account

resetting a password
You can easily reset your password if needed

© 2025-present Kieran Klukas

About

providing password reset services in hc: circa 2025

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • TypeScript 100.0%