I posted a link to my repo regarding AI context lengths to Hacker News under the Show HN category and wanted to see its position in the listing every now and then.
API
Fortunately, Hacker News has an API which you can send a request to for it to respond back with a list of posts. This was a Show HN post, so I needed the /v0/showstories.json
API. I implemented simple Python code to request that path and get the index of the post. After this, I calculate a page number by dividing the post index by 30.
Message Design?
Slack offers something called Block Kit, which allows you to build detailed messages. I tried a few designs and settled on a regular message. Regardless, if I do need to redesign it, I can just add blocks.
I first went with a button “View Post in List”.
This led to some issues.
I eventually added a link that does the same thing, which doesn’t show any errors and works well.
“View Post in List” Link
This is a link to the specific page on HN with an anchor tag of the post ID. This results in the page scrolling to the very post being tracked.