1. Overview
Hacker News is a social news website focusing on computer science and entrepreneurship. The Hacker News API, powered by Algolia, provides programmatic access to retrieve users, articles, and stories from the platform.
Through GoInsight's Hacker News node, you can seamlessly integrate Hacker News data retrieval into your automation workflows. You can retrieve detailed information about specific users, fetch individual articles by their ID, and discover the hottest trending stories on the platform.
2. Prerequisites
Before using this node, you need to meet the following requirements:
- No Account Required: The Hacker News API via Algolia is publicly accessible and does not require authentication or an account.
- Network Access: Ensure your GoInsight instance has network access to hn.algolia.com.
3. Credentials
The Hacker News node does not require any credentials. The Algolia HN Search API is publicly accessible and free to use.
4. Supported Operations
Summary
This node operates on three main resources: Users, Articles, and Stories. The following table summarizes the available operations:
| Resource | Operation | Description |
|---|---|---|
| User | Get a user | Retrieve a single Hacker News user specified by its username using the Algolia HN Search API. |
| Article | Get an article | Retrieve a single Hacker News article specified by its item ID using the Algolia HN Search API. |
| Stories | Get many items | Retrieve the top N hottest Hacker News stories by popularity using the Algolia HN Search API. |
Operation Details
Get a user
Retrieve a single Hacker News user specified by its username using the Algolia HN Search API.
Input Parameters:
- Username: A valid Hacker News username to retrieve, e.g. "jl".
Output:
- User (object): Retrieved user object with fields in PascalCase, each corresponding to the original Algolia API response fields.
- StatusCode (number): Overall operation status code: -1 (parameter error), 200 (success), HTTP status codes for API errors, 500 (exception).
- ErrorMessage (string): Error description if any, empty when successful.
Get an article
Retrieve a single Hacker News article specified by its item ID using the Algolia HN Search API.
Input Parameters:
- ArticleId: A valid Hacker News item ID to retrieve, e.g. "12345".
Output:
- Article (object): Retrieved article object with fields in PascalCase, each corresponding to the original Algolia API response.
- StatusCode (number): Overall operation status code: -1 (parameter error), HTTP status code for API errors, 500 (exception), 200 (success).
- ErrorMessage (string): Error description if any, empty when successful.
Get many items
Retrieve the top N hottest Hacker News stories by popularity using the Algolia HN Search API.
Input Parameters:
- Count: Number of top stories to retrieve. Must be greater than 0.
Output:
- Items (object-array): List of story objects with keys in PascalCase, each corresponding to fields from the Algolia API response.
- StatusCode (number): Overall operation status code: -1 (parameter error), 200 (success), HTTP status codes for API errors, 500 (exception).
- ErrorMessage (string): Error description if any, empty when successful.
5. Example Usage
This section will guide you through creating a simple workflow to retrieve the top trending stories from Hacker News. This is a common use case for monitoring popular technology discussions and news.
Workflow Overview: The workflow consists of three nodes: Start → Get many items → Answer.
Step-by-Step Guide
Step 1: Add the Tool Node
- In the workflow canvas, click the "+" button to add a new node.
- In the panel that appears, select the "Tools" tab.
- Find and select Hacker News from the tool list.
- From the list of supported operations, click Get many items. This will add the corresponding node to your canvas.
Step 2: Configure the Node
- Click the newly added Get many items node. The configuration panel will expand on the right side.
- Credentials Configuration: Since Hacker News API is public, no credentials are required for this node.
- Parameter Configuration:
- Count: Enter the number of top stories you want to retrieve. For example, enter 10 to fetch the top 10 hottest stories currently trending on Hacker News.
Step 3: Run and Verify
- Once all required parameters are correctly filled, any error indicators in the workflow canvas will disappear.
- Click the "Test Run" button in the top-right corner of the canvas to execute the workflow.
- After successful execution, click the log icon in the top-right corner to view detailed input and output for the node, verifying that the operation completed successfully.
- You should see an array of story objects in the Items output, each containing information such as title, author, URL, points, and creation time.
Final Result
After completing these steps, your workflow is fully configured. When you click "Test Run", the top trending stories from Hacker News will be successfully retrieved and available in the workflow output. You can use these stories in subsequent nodes for further processing, filtering, or notification purposes.
6. FAQs
Q: Do I need an API key to use the Hacker News node?
A: No, the Hacker News API via Algolia is publicly accessible and does not require any API keys or authentication.
Q: What happens if I provide an invalid username or article ID?
A: The operation will return with an HTTP error status code (typically 404) in the StatusCode field, and the ErrorMessage field will contain details about the error. The User or Article field will be an empty object.
Q: Can I retrieve a specific number of stories, or is there a limit?
A: You can specify any positive integer for the Count parameter. However, be mindful that requesting a very large number of items may increase response time and data transfer. The Algolia API typically supports up to 1000 items per request.
Q: What format are the returned dates in?
A: Timestamps from the Hacker News API are typically in Unix epoch format (seconds since January 1, 1970). You may need to convert them to human-readable dates in subsequent workflow nodes if needed.
Q: Why are the field names in PascalCase?
A: The GoInsight Hacker News node automatically converts all field names from the original API response (which uses snake_case) to PascalCase for consistency with GoInsight's naming conventions. For example, created_at becomes CreatedAt.
7. Official Documentation
For more detailed information about the Hacker News API and available data fields, please refer to:
Leave a Reply.