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

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

Learn how to Build this Workflow with AI:

Visit through Desktop for Best experience

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

  • n8n Platform: For building and running the workflow.
  • OpenAI API: Powers the AI chat model that understands and replies.
  • Hacker News API Node: Fetches top 50 posts in JSON format.
  • JavaScript Code Node: Converts data to JSON string output.
  • Manual Chat Message Node: Allows you to type questions to start the workflow.

Inputs, Processing Steps, and Outputs

Inputs

  • User types a question in the Manual Chat Message node.
  • Workflow receives the trigger to start the process.

Processing Steps

  • AI Agent gets the question and plans actions.
  • Custom tool workflow fetches top 50 Hacker News posts using the Hacker News node.
  • Set node cleans and picks main fields from post data.
  • Code node converts this cleaned data into JSON string.
  • AI Agent reads this data and replies to the user question.

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.

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 Viral UGC Video Creation Using n8n + Degaus (Beginner-Friendly Guide)

Learn how to automate viral UGC video creation using n8n, AI prompts, and Degaus. This beginner-friendly guide shows how to import, configure, and run the workflow without technical complexity.
Form Trigger
Google Sheets
Gmail
+37
Free

AI SEO Blog Writer Automation Workflows in n8n

A complete beginner guide to building an AI SEO blog writer automation using n8n.
AI Agent
Google Sheets
httpRequest
+5
Free

Automate CrowdStrike Alerts with VirusTotal, Jira & Slack

This workflow automates processing of CrowdStrike detections by enriching threat data via VirusTotal, creating Jira tickets for incident tracking, and notifying teams on Slack for quick response. Save hours daily by transforming complex threat data into actionable alerts effortlessly.
scheduleTrigger
httpRequest
jira
+5
Free

Automate Telegram Invoices to Notion with AI Summaries & Reports

Save hours on financial tracking by automating invoice extraction from Telegram photos to Notion using Google Gemini AI. This workflow extracts data, records transactions, and generates detailed spending reports with charts sent on schedule via Telegram.
lmChatGoogleGemini
telegramTrigger
notion
+9
Free

Automate Email Replies with n8n and AI-Powered Summarization

Save hours managing your inbox with this n8n workflow that uses IMAP email triggers, AI summarization, and vector search to draft concise replies requiring minimal review. Automate business email processing efficiently with AI guidance and Gmail integration.
emailReadImap
vectorStoreQdrant
emailSend
+12
Free

Automate Email Campaigns Using n8n with Gmail & Google Sheets

This n8n workflow automates personalized email outreach campaigns by integrating Gmail and Google Sheets, saving hours of manual follow-up work and reducing errors in email sequences. It ensures timely follow-ups based on previous email interactions, optimizing communication efficiency.
googleSheets
gmail
code
+5
Free