Build AI Agent with Custom Hacker News Data in n8n

Discover how this n8n workflow enables you to create an AI chat agent that fetches and interprets the top 50 Hacker News posts instantly. Save hours by automating complex data retrieval and chat interactions with OpenAI and Hacker News integration.
manualChatTrigger
executeWorkflowTrigger
hackerNews
+6
Workflow Identifier: 1658
NODES in Use: manualChatTrigger, executeWorkflowTrigger, hackerNews, set, agent, lmChatOpenAi, code, toolWorkflow, stickyNote
Automate AI agent with n8n and OpenAI

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

What This Automation Does

This workflow automatically gets the top 50 posts ever on Hacker News.

It cleans the data and answers your chat questions about these posts using AI.

You get quick and clear info about popular Hacker News stories without looking them up yourself.


Who Should Use This Workflow

This is for data analysts, content creators, or anyone who wants fast access to Hacker News trends.

It fits people who want to save time and avoid mistakes from manual data fetching.


Tools and Services Used


Inputs, Processing Steps, and Outputs

Inputs

Processing Steps

Outputs

  • Clear, formatted answers to Hacker News queries in chat.
  • JSON string with top post details for other uses.

Beginner Step-by-Step: How to Use This Workflow in n8n

1. Import the Workflow

  1. Download the workflow file using the Download button on this page.
  2. Inside the n8n editor, click “Import from File” and load the downloaded workflow.

2. Configure Credentials and Settings

  1. Add your OpenAI API Key in the OpenAI Chat Model node credentials.
  2. Check the Hacker News node if any limit or filters need changes.
  3. Update any workflow IDs or references if required, especially in the custom tool node.

3. Test the Workflow

  1. Trigger the manual chat message by typing a question like “What is the 5th most popular post ever on Hacker News?”
  2. Review the AI agent’s reply for correctness.

4. Activate for Production

  1. Switch the workflow toggle to ON in n8n.
  2. Monitor runs to ensure smooth operation.

If hosting n8n yourself, visit self-host n8n to explore hosting options.


Customizations

  • Change how many posts are fetched by adjusting the limit in the Hacker News node.
  • Add more data fields in the cleanup Set node for richer info.
  • Adjust max interaction rounds in the AI Agent node.
  • Add other news sources by modifying the sub-workflow.
  • Customize chat prompts for team style or language preferences.

Troubleshooting

AI Agent does not respond

Check if the OpenAI Chat Model has correct API key and is connected to the AI Agent.

Hacker News node returns no data

Test network connection and check for API limits.

JSON formatting error in Code node

Confirm upstream nodes provide an array input matching the code’s expectation.


Pre-Production Checklist

  • Validate OpenAI API key is active.
  • Confirm manual chat triggers proper AI Agent reply.
  • Test sub-workflow returns Hacker News data correctly.
  • Review cleaned data fields output.
  • Run a test query “What is the 5th most popular post ever on Hacker News?”
  • Backup the workflow before going live.

Conclusion

This workflow saves time by automating Hacker News data collection and answering questions fast.

It helps stay updated on top tech news without manual work or errors.

Consider adding alerts or other platforms later to grow automation.

Sample Code for JSON Stringify in the Code Node

This code turns all posts data into a JSON string for output.

return {
 'response': JSON.stringify($input.all().map(x => x.json))
}

Example User Question to Start Chat

Use this example question in the Manual Chat Message node to test:

What is the 5th most popular post ever on Hacker News?

Summary of Results

→ Fast answers to Hacker News top posts questions.

✓ Clean, easy-to-read post data in JSON for use.

✓ Saves hours of manual data work.

✓ Quick setup and testing inside n8n.

✓ Flexible to customize for many needs.

Automate AI agent with n8n and OpenAI

Visit through Desktop to Interact with the Workflow.

Frequently Asked Questions

The AI Agent uses a custom tool node to run a sub-workflow that fetches top 50 posts through the Hacker News node.
An OpenAI API key is required to connect the OpenAI Chat Model node, and access to the Hacker News API is needed inside the Hacker News node.
Adjust the limit parameter inside the Hacker News node in the sub-workflow to the desired number.
Trigger the Manual Chat Message node by typing a sample question and verify that the AI Agent replies correctly.

Promoted by BULDRR AI

Related Workflows

Automate Twist Channel Creation and Messaging with n8n

This workflow automates creating and updating a channel in Twist and sending a personalized message to specific users. It eliminates manual setup errors and saves time managing Twist communications.

Automate Ideogram Image Generation with Google Sheets & Gmail

This workflow automates graphic design image generation via Ideogram AI, storing image data in Google Sheets and Google Drive, with email alerts via Gmail. It saves designers hours by automating image creation, remixing, review, and record-keeping.

Automate IT Support with Slack and OpenAI in n8n

Streamline IT support by automating Slack message handling using n8n and OpenAI. This workflow handles Slack DMs, filters bots, queries a Confluence knowledge base, and delivers AI-generated responses, improving support efficiency and response time.

Automate Crypto Analysis with CoinMarketCap & n8n AI Agent

Discover how this unique n8n workflow leverages CoinMarketCap’s multi-agent AI to deliver precise, real-time cryptocurrency insights directly via Telegram. Manage crypto data analysis efficiently with automated multi-source API integration.

Automate Gumroad to Beehiiv Subscriber Sync with n8n

Learn how to automatically add new Gumroad sales customers as Beehiiv newsletter subscribers using n8n automation. This workflow saves time by syncing sales data to Google Sheets CRM and notifying your Telegram channel instantly.

Generate On-Brand Blog Articles Using n8n and OpenAI

This workflow automates the creation of on-brand blog articles by analyzing existing company content using n8n and OpenAI. It extracts article structures and brand voice to produce consistent draft articles, saving significant content creation time.
1:1 Free Strategy Session
Your competitors are already automating. Are you still paying for it manually?

Do you want to adopt AI Automation?

Every hour your team does repetitive work, you're burning real money.
While you wait, faster businesses are cutting costs and moving quicker.
AI and automations aren't the future anymore — they're the present.

Book a live 1-on-1 session where we show you exactly which of your daily tasks can be automated — and what it’s costing you not to.