1. Opening Problem Statement
Meet Sarah, a community manager for a tech Discord server dedicated to startup enthusiasts and product fans. Every day, Sarah wants to share the top trending projects on ProductHunt to keep her community engaged and informed. However, manually checking ProductHunt’s ranking, copying project details, and posting them to Discord eats up at least 30 minutes daily. Over time, these small daily tasks have accumulated to hours lost every month, with occasional errors like posting outdated info or missing key projects.
This tedious manual approach not only wastes Sarah’s valuable time but also risks lowering community engagement as posts may be delayed or inconsistent. Sarah needed an automated, reliable way to fetch and share the freshest top ProductHunt projects on Discord without lifting a finger.
2. What This Automation Does
When this n8n workflow runs, here’s what happens automatically:
- Every hour, a Cron node triggers the workflow to run, ensuring fresh data is fetched regularly.
- The GraphQL node queries the ProductHunt API to get the top 5 trending projects posted within the last 24 hours and ranked by votes.
- The Item Lists node extracts individual project entries from the GraphQL response for further processing.
- The Set node formats each project’s key data: name, description, and votes into a simple structure.
- Finally, the Discord node posts a neatly formatted message listing these top projects with their descriptions and vote counts directly to a configured Discord channel.
This automation saves Sarah about 30 minutes daily, reduces human errors, and keeps her community instantly informed with fresh content.
3. Prerequisites ⚙️
- n8n account to create and run the workflow.
- ProductHunt API access token with required permissions to query posts.
- Discord webhook URL from the channel where you want to post updates.
- Familiarity with basic JSON and GraphQL queries (helpful but not required).
4. Step-by-Step Guide
Step 1: Set up a Cron Trigger for Hourly Runs
In n8n, click + New Workflow and add the Cron node. Configure it as follows:
- Navigate to the Cron node’s Trigger Times settings.
- Select Every Hour to ensure the workflow executes once per hour.
You should see the node set to run hourly.
Common Mistake: Forgetting to set the frequency correctly can cause your workflow not to run as expected.
Step 2: Configure the GraphQL Node to Fetch ProductHunt Data
Add a GraphQL node and connect it to the Cron node. Enter the following settings:
- Set the Endpoint URL to
https://api.producthunt.com/v2/api/graphql. - In the Query field, paste the provided GraphQL query that fetches posts from the last 24 hours ordered by ranking.
- Add a header parameter named Authorization with value
Bearer YOUR-TOKEN(replace YOUR-TOKEN with your actual ProductHunt API token).
You should see the node ready to pull the top-ranked posts.
Common Mistake: Using an invalid or expired token will cause authorization errors.
Step 3: Extract Posts with the Item Lists Node
Insert an Item Lists node to process the GraphQL response. Configure it as:
- Set the Field To Split Out to
data.posts.edges. - Set destination field name to
posts.
This flattens the array of post objects for easier handling downstream.
Common Mistake: Incorrect path in Field To Split Out causes empty or missing data.
Step 4: Format Project Data in the Set Node
The Set node prepares each project’s details. Set it up like this:
- Add three fields: Votes (numeric), Name (string), and Description (string).
- Use expressions to extract data from the current item: e.g.,
{{$json["posts"]["node"]["votesCount"]}}for votes. - Activate Keep Only Set to keep just these fields.
You’ll see neatly shaped data objects output for the Discord node.
Common Mistake: Missing or incorrect expressions lead to empty fields.
Step 5: Post to Discord With Discord Node
Add a Discord node connected to the Set node. Configure:
- Paste your Webhook URL supplied by Discord.
- In the Text field, format a message using expressions like:
=Here are the top 5 PH projects:
**Name:** {{$json["Name"]}}
**Description:** {{$json["Description"]}}
**Vote:** {{$json["Votes"]}}
-------Run the workflow to test. A message should appear in your Discord channel showing the latest top projects.
Common Mistake: An incorrect webhook URL or missing permissions will prevent posting.
5. Customizations ✏️
- Increase Project Count: Modify the GraphQL first argument from 5 to your desired number to post more projects.
- Change Posting Frequency: In the Cron node, adjust the trigger to run every 30 minutes or daily as needed.
- Add Reviews Rating: Enhance the Set node by adding a field for reviewsRating from the GraphQL data to provide more info on project quality.
- Format Discord Message Differently: Customize the message text in the Discord node to include emojis or additional markdown styling.
- Filter Projects By Date More Specifically: Edit the GraphQL query dates to only fetch projects posted within a custom timeframe.
6. Troubleshooting 🔧
Problem: “Authorization failed” or empty GraphQL response.
Cause: Incorrect or expired ProductHunt API token.
Solution: Go to the GraphQL node, update your Authorization header with a valid Bearer token, and test again.
Problem: Discord messages not appearing.
Cause: Invalid Discord webhook or lack of permission.
Solution: Verify the webhook URL is correct and that the bot/user has permission to post in the channel.
Problem: Empty or malformed data in messages.
Cause: Incorrect expressions or field paths in Set node.
Solution: Check expressions in the Set node carefully, especially the JSON paths like $json["posts"]["node"]["votesCount"].
7. Pre-Production Checklist ✅
- Verify your ProductHunt API token is active and has the correct scopes.
- Test the Cron trigger timing suits your needs.
- Run the GraphQL query in a separate tool (like Insomnia or Postman) to verify it returns expected data.
- Ensure Discord webhook URL works by sending a manual test message.
- Execute a full workflow test in n8n and confirm the Discord post appears correctly.
8. Deployment Guide
Activate your workflow in n8n by switching the toggle in the top right corner. Your automation is now live, fetching the top ProductHunt projects hourly and posting to Discord.
Consider monitoring usage logs in n8n and Discord to ensure stable operation. Adjust the Cron frequency or GraphQL query as your community grows.
9. FAQs
Q: Can I use Slack instead of Discord?
A: Absolutely! You can replace the Discord node with a Slack node and configure a Slack webhook instead.
Q: Does this consume ProductHunt API credits?
A: ProductHunt API rate limits apply. Running hourly queries is generally fine for typical usage but check their docs.
Q: Is my data safe using this workflow?
A: Yes, no personal data is stored; only public Project information and your API tokens are used securely in n8n.
10. Conclusion
Congratulations! You’ve automated fetching and posting the top 5 ProductHunt projects directly to your Discord community every hour. This saves you at least 30 minutes daily, eliminates manual copying errors, and keeps your members engaged with the freshest startup trends.
Next, consider expanding this automation by integrating other social channels or adding richer project data to your posts. Happy automating!