Summarization
Product Hunt Thread Summarizer
Fetch comments from any Product Hunt launch and generate a structured executive summary of user sentiment, key feedback, and top questions using OneInfer's LLM API.
OneInfer Chat APIProduct Hunt APIPythonFastAPI
Step-by-step guide
1
Fetch comments from the Product Hunt GraphQL API
python
import requests
PH_TOKEN = "your-producthunt-developer-token"
QUERY = """
query GetPost($slug: String!) {
post(slug: $slug) {
name
tagline
votesCount
commentsCount
comments(first: 50, order: VOTES_COUNT) {
edges {
node {
body
votesCount
user { name }
}
}
}
}
}
"""
def fetch_comments(slug: str) -> dict:
response = requests.post(
"https://api.producthunt.com/v2/api/graphql",
headers={"Authorization": f"Bearer {PH_TOKEN}"},
json={"query": QUERY, "variables": {"slug": slug}}
)
return response.json()["data"]["post"]
data = fetch_comments("some-product-launch")
comments = [e["node"]["body"] for e in data["comments"]["edges"]]
print(f"Fetched {len(comments)} comments for: {data['name']}")2
Summarize with structured output
python
import openai
import json
client = openai.OpenAI(
api_key="your-oneinfer-api-key",
base_url="https://api.oneinfer.ai/v1"
)
def summarize_thread(product_name: str, comments: list[str]) -> dict:
comments_text = "\n---\n".join(comments[:40])
response = client.chat.completions.create(
model="meta-llama/Llama-3.3-70B-Instruct-Turbo",
messages=[
{"role": "system", "content": (
"You are a product analyst. Analyze the user comments and return a JSON object with: "
"overall_sentiment (positive/mixed/negative), key_praise (list of 3), "
"key_concerns (list of 3), top_questions (list of 3), one_line_verdict (string)."
)},
{"role": "user", "content": (
f"Product: {product_name}\n\nComments:\n{comments_text}"
)}
],
response_format={"type": "json_object"}
)
return json.loads(response.choices[0].message.content)
summary = summarize_thread(data["name"], comments)
print(json.dumps(summary, indent=2))3
Example output
json
{
"overall_sentiment": "positive",
"key_praise": [
"Incredibly fast setup — had it running in under 5 minutes",
"The UI is clean and intuitive",
"Great pricing compared to alternatives"
],
"key_concerns": [
"No team collaboration features yet",
"Missing export to PDF option",
"Mobile app would be a game changer"
],
"top_questions": [
"Is there an API available?",
"What's the roadmap for enterprise features?",
"Can this integrate with Slack?"
],
"one_line_verdict": "Strong launch with enthusiastic early adopters; team features are the most requested next step."
}