Monitoring a Hacker News Post

tercmdtercmd
2 min read

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”.

Slack message from app “HN Monitor” with message “ Post #36056445 is #36 on show page 2!” with a button on the side “ 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.

Slack message from app “HN Monitor” with message “ Post #36056445 is #40 on show page 2!” with a link “View post on page”

“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.

Hacker News Post

0
Subscribe to my newsletter

Read articles from tercmd directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

tercmd
tercmd