providing password reset services for a long while: circa 2025

docs: add message queue docs

+53
+53
README.md
··· 30 30 <img src="/.github/images/has_account.webp" width="500" alt="creating an account - success"/> 31 31 </p> 32 32 33 + ### From a developer's perspective 34 + 35 + 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](https://hackclub.slack.com/team/U062UG485EE)). 36 + 37 + The queue is interacted with via a `POST` request to `/slack/message` with a `channel`, `text`, and (optionally) `blocks` json encoded in the body. 38 + 39 + ```bash 40 + curl -X POST "https://hackatime-bot.kierank.hackclub.app/slack/message" \ 41 + -H "Content-Type: application/json" \ 42 + -H "Authorization: Bearer NOTLEEKINGTHATLOL" \ 43 + -d '{ 44 + "channel": "U062UG485EE", 45 + "text": "Hello from hackatime!" 46 + }' 47 + ``` 48 + 49 + or via fetch with blocks 50 + 51 + ```typescript 52 + await fetch("https://hackatime-bot.kierank.hackclub.app/slack/message", { 53 + method: "POST", 54 + headers: { 55 + "Content-Type": "application/json", 56 + Authorization: `Bearer ${process.env.MESSAGE_QUEUE_TOKEN}`, 57 + }, 58 + body: JSON.stringify({ 59 + channel: "U062UG485EE", 60 + text: "Hello from hackatime!", 61 + blocks: [ 62 + { 63 + type: "section", 64 + text: { 65 + type: "mrkdwn", 66 + text: "Hello from hackatime!", 67 + }, 68 + }, 69 + { 70 + type: "divider", 71 + }, 72 + { 73 + type: "context", 74 + elements: [ 75 + { 76 + type: "mrkdwn", 77 + text: "This is a message from the hackatime slack bot!", 78 + }, 79 + ], 80 + }, 81 + ], 82 + }), 83 + }); 84 + ``` 85 + 33 86 ## Devving 34 87 35 88 Create a slack app as per the [manifest.yaml](manifest.yaml) and an env as below