Building a service on the Product Hunt API
I read this tweet, and I got inspired to build a service that would notify you every time someone you're following on Twitter launched something on Product Hunt:
So I built and launched Lauchini with the help of the Product Hunt API. Every night at 1 am PST, I email my subscribers about the makers they are following that are launching products on Product Hunt:
That way, you can keep track of when a fellow maker is launching something.
Today, I sadly had to sunset the project:
I have built a notification system with Slack where I every night get a summary of how many emails got sent:
Some of my subscribers are following thousands of Twitter users, so someone is always notified about a launch every night.
This last weekend I noticed that no one got an email. I woke up on Sunday and checked the logs; the service was up and working, and the lambdas got invoked but said that not a single maker that my subscribers were following launched anything.
The weekend is great for launching B2C products, so I remember thinking that's weird, but I went on with my day.
Suddenly, no makers launching
I stayed up late on Sunday night, past 1 am, and noticed again in real time that none of my subscribers received an email.
With Monday morning approaching and the start of a new week, I knew there had to be launches happening.
So, I started investigating.
My very first blog post was about the Product Hunt API (Support makers launching on Product Hunt), so I already had numerous working Jupyter notebooks.
I started digging into the Product Hunt API, adding my API key and calling the endpoint to check for daily launches:
import requests
api_token_ph = "YOUR_API_KEY"
api_url_posts = "https://api.producthunt.com/v1/posts"
# Construct header
headers = {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': 'Bearer ' + api_token_ph,
'Host': 'api.producthunt.com'
}
# API call
ph_response = requests.get(api_url_posts, headers=headers)
ph_response.json()['posts']
Redacted names
I immediately noticed something new; all the names and usernames were redacted:
Another thing I noticed was that all the Twitter handles were None:
A quick look at one of the makers of a project that day shows that they, in fact, have their Twitter profile added on Product Hunt:
Here's what the response used to look like:
Trying the V2 API: GraphQL
At first, I thought that it might just impact the V1 API. That would be possible since the V1 API is deprecated and has been so for years.
They're referring to using V2 instead, where you're getting the data via a GraphQL interface:
So I wrote the code for the same call but with GraphQL for the V2 API. Hoping I would get the missing username
and twitter_username
values:
api_token_ph = "YOUR_API_KEY"
headers = {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': 'Bearer ' + api_token_ph,
'Host': 'api.producthunt.com'
}
# Specify your query
query = {"query":
"""
query todayPosts {
posts {
totalCount
edges {
node {
id
name
tagline
votesCount
featuredAt
makers {
name
followers {
totalCount
}
following {
totalCount
}
madePosts {
totalCount
}
twitterUsername
}
}
}
}
}
"""}
API_URL = "https://api.producthunt.com/v2/api/graphql"
today_posts = requests.post(API_URL,headers=headers,data=json.dumps(query))
today_posts = today_posts.json()
today_posts
Unfortunately, even with GraphQL and the V2 API, the maker names
are redacted, and the twitter_username
is also None
, just like the response from the V1 API:
By this point, it was already 2 am, so I decided to call it a night and come back to it the next day.
Checking logs
The next step was to look at my cloud logs.
When did this change actually occur?
While the cron job for fetching daily launches runs once per night, each email generates its own log:
So started looking into the log for each day:
I checked every log until, bingo! I found a day when makers were launching:
The logs show February 24th, so this major API change took place sometime after last Friday, with marker names being redacted.
Reaching out to the support team
I decided to ask the support group about it in the chat:
Then I went ahead and wrote an email to the subscribers. I was still hoping this was a temporary change or even a bug, so I wrote it as a temporary pause of Launchini:
Now the only thing I could do was wait for an answer from the support team.
I found others asking the same, and I joined them, hoping this was a bug that could be fixed:
Confirmed: permanent change
Today, I woke up to this answer from the support team:
I was not surprised, even though I genuinely hoped it would be a temporary bug.
Issue closed
Issue closed: V1 fully shut down later this year
When I checked back to write a comment on GitHub, the issue was already closed with this comment:
The natural next step for me was to write and send an email telling my subscribers that Launchini was getting terminated immediately:
Conclusion
The recent changes in the Product Hunt API may affect developers who rely on Product Hunt API for their services. The removal of several key fields, including usernames and Twitter handles, has made it difficult to track product launches and notify subscribers in real time. Redacted values and the absence of Twitter usernames indicated that the Product Hunt API had undergone some significant changes sometime around February 24-25th.
As mentioned earlier, the V1 API is deprecated and seems to be fully shut down later this year. The V2 API is the recommended way to access Product Hunt data, and you may need to update your code to use GraphQL queries instead of RESTful endpoints.
Overall, the changes to the Product Hunt API serve as a reminder to stay adaptable and be prepared for unexpected changes in third-party APIs.