Automate Dashboard Metrics with n8n HTTP & Function Nodes

Struggling to manually update your project’s Docker, GitHub, npm, and Product Hunt stats? This n8n workflow automates retrieving and posting these key metrics to your dashboard, saving hours and minimizing errors automatically.
cron
httpRequest
function
+2
Workflow Identifier: 2159
NODES in Use: Cron, Set, HTTP Request, Function, GitHub

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

Learn how to Build this Workflow with AI:

Visit through Desktop for Best experience

Opening Problem Statement

Meet Alex, a project manager responsible for keeping the development team and stakeholders updated on multiple software project metrics. Alex’s project relies on DockerHub for container images, GitHub for code collaboration, npm for package management, and Product Hunt for community feedback and ratings. Every day, Alex spends hours manually collecting data from these sources to update the team’s internal dashboard. The process is tedious, error-prone, and delays decision-making. One missed update meant inaccurate reports, causing misaligned priorities and costing valuable time and resources.

Alex needs a reliable and automated solution to fetch and post key project stats like Docker pulls, GitHub forks, npm scores, and Product Hunt reviews into the dashboard. Time wasted updating manually can stretch to several hours weekly, further amplified by data formatting issues and inconsistent token management. This scenario is exactly what the advanced n8n workflow we’re examining solves.

What This Automation Does

When triggered every minute by a cron job, this n8n workflow automatically collects, processes, and posts critical project data metrics from various APIs to a centralized dashboard. Here’s what happens:

  • Retrieves DockerHub repository data (stars, pulls) and posts them to dashboard widgets
  • Fetches detailed GitHub repository stats (stars, forks, watchers, open issues) and updates dashboard components
  • Pulls npm package quality, popularity, maintenance, and final aggregated scores
  • Gets Product Hunt post data including votes, comments, reviews count, and ratings for social proof
  • Processes and formats raw numeric data into readable, comma-separated strings for easy dashboard display
  • Posts all these formatted metrics securely with authentication tokens to the dashboard’s REST API endpoints

This automation saves Alex at least several hours a week, eliminates manual errors, and ensures real-time, trustworthy stats for better project insights.

Prerequisites ⚙️

  • n8n account with access to create and run workflows ⏱️
  • Access to DockerHub API for repository data retrieval 🔌
  • GitHub account and Personal Access Token with repo permissions 🔐
  • npm API access (no token required) for package info 📊
  • Product Hunt API token for retrieving post analytics 🔑
  • Your project’s dashboard API endpoint URL and authentication token to post metrics 📁
  • Basic knowledge of HTTP requests and function nodes within n8n

Step-by-Step Guide

1. Set up the Cron Trigger for Automated Scheduling

Navigate to Nodes > Cron. Configure it to trigger every minute to keep your dashboard data fresh. The trigger fires the entire workflow automatically without manual intervention.

Common mistake: Forgetting to activate the workflow after setting the cron trigger will prevent execution.

2. Define Dashboard and Project Settings with Set Node

Add a Set node named Dashboard Configuration. Input string values setting your dashboard API URL, auth token, Docker repo info, GitHub repo details, npm package name, and Product Hunt post ID. These serve as constants for every HTTP request.

Example configuration includes a dashboardHostname like http://192.168.0.14:8080 and an auth token such as n8n-rocks!.

Expected outcome: These variables become reference points throughout the workflow.

3. Retrieve Real-Time Docker Data

Use an HTTP Request node named Retrieve Docker Data. Set the method to GET and build the URL dynamically using dashboard config JSON values, e.g., https://hub.docker.com/v2/repositories/n8nio/n8n. Add a “User-Agent” header set to “n8n”.

It fetches the Docker image’s current stars and pull counts.

Tip: Make sure you use the exact repository name to avoid 404 errors.

4. Format Docker Metrics for Dashboard

Connect to a Function node called Massage Docker Data. Use JavaScript code to transform raw star and pull counts into comma-separated number strings for readability:

items[0].json.star_count = items[0].json.star_count.toString().replace(/B(?=(d{3})+(?!d))/g, ",");
items[0].json.pull_count = items[0].json.pull_count.toString().replace(/B(?=(d{3})+(?!d))/g, ",");
return items;

This ensures large numbers display nicely on dashboards.

5. Post Docker Stars and Pulls to Dashboard

Use two HTTP Request nodes named Docker Stars and Docker Pulls. Both are POST requests to your dashboard URL, sending the auth token and current metric values from the Function node.

Important: Ensure the auth token header is exact or your posts will be rejected.

6. Fetch npm Package Data

Add an HTTP Request node called Retrieve npm Data, GET method to https://api.npms.io/v2/package/n8n dynamically from config. Include “User-Agent” header as “n8n”.

This retrieves npm quality, popularity, maintenance, and final scores for the package.

7. Format npm Scores with Function Node

Connect to Function node Massage npm Data. Use this code to round each score to two decimal places for better display:

items[0].json.score.detail.maintenance = parseFloat(items[0].json.score.detail.maintenance.toFixed(2));
items[0].json.score.detail.popularity= parseFloat(items[0].json.score.detail.popularity.toFixed(2));
items[0].json.score.detail.quality= parseFloat(items[0].json.score.detail.quality.toFixed(2));
items[0].json.score.final= parseFloat(items[0].json.score.final.toFixed(2));
return items;

8. Post npm Metrics to Dashboard

Use multiple HTTP Request nodes: npm Maintenance, npm Quality, npm Popularity, and npm Final. Each sends a POST request carrying the corresponding score and auth token for dashboard widgets updating.

9. Retrieve GitHub Repository Stats

Add a GitHub node configured with a connected GitHub API credential. Fetch repository data such as stars, forks, watchers, and open issues by setting operation to “Get repository” with owner and repo from Dashboard Configuration.

10. Format GitHub Data

Link a Function node Massage GitHub Data to format numbers with commas:

items[0].json.stargazers_count = items[0].json.stargazers_count.toString().replace(/B(?=(d{3})+(?!d))/g, ",");
items[0].json.subscribers_count = items[0].json.subscribers_count.toString().replace(/B(?=(d{3})+(?!d))/g, ",");
items[0].json.forks_count = items[0].json.forks_count.toString().replace(/B(?=(d{3})+(?!d))/g, ",");
items[0].json.open_issues_count = items[0].json.open_issues_count.toString().replace(/B(?=(d{3})+(?!d))/g, ",");
return items;

11. Post GitHub Data to Dashboard

Four HTTP Request nodes GitHub Stars, GitHub Forks, GitHub Watchers, and GitHub Open Issues make POST calls with data and token to dashboard endpoints for each metric.

12. Retrieve Product Hunt Data via GraphQL

Use an HTTP Request node Retrieve Product Hunt Data pointed at the Product Hunt GraphQL endpoint. Pass your API token in headers. Query for votes, comments, reviews, and rating by the configured post ID.

13. Massage Product Hunt Data

Another Function node formats the counts into comma-separated strings:

items[0].json.data.post.commentsCount = items[0].json.data.post.commentsCount.toString().replace(/B(?=(d{3})+(?!d))/g, ",");
items[0].json.data.post.votesCount= items[0].json.data.post.votesCount.toString().replace(/B(?=(d{3})+(?!d))/g, ",");
items[0].json.data.post.reviewsCount= items[0].json.data.post.reviewsCount.toString().replace(/B(?=(d{3})+(?!d))/g, ",");
return items;

14. Post Product Hunt Metrics to Dashboard

Use HTTP Request nodes like Product Hunt Rating, Product Hunt Reviews, Product Hunt Votes, and Product Hunt Comments to update the dashboard widgets with the latest Product Hunt insights.

Customizations ✏️

  1. Change Update Frequency: In the Cron node, adjust the trigger from every minute to hourly or daily to reduce API calls. Simply select the mode value and choose your preferred interval.
  2. Add More Metrics: Extend the workflow by adding more GitHub resource endpoints or npm statistics by duplicating HTTP Request nodes and modifying URLs and payloads accordingly.
  3. Modify Dashboard API: If your dashboard uses a different endpoint structure, update the URL patterns in the HTTP Request nodes to match your custom API, leveraging the JSON config variables for easy changes.
  4. Enhance Data Formatting: Edit Function nodes to format numbers differently or calculate additional metrics like growth rate or trends before posting.

Troubleshooting 🔧

Problem: “HTTP Error 401 Unauthorized” when posting to dashboard API.

Cause: Invalid or missing authentication token in the POST requests.

Solution: Verify the dashboardAuthToken in the Dashboard Configuration Set node. Confirm it matches your dashboard API expected token. Also, ensure no extra spaces or hidden characters.

Problem: “404 Not Found” error fetching Docker or GitHub data.

Cause: Incorrect repository or package names in the configuration.

Solution: Double-check the Docker docker_name and docker_repository, GitHub github_owner and github_repo, and npm npm_package values in the Dashboard Configuration node match your actual project names exactly.

Pre-Production Checklist ✅

  • Confirm all API tokens (GitHub, Product Hunt, Dashboard) are valid and have necessary permissions.
  • Test each data retrieval HTTP Request node individually using n8n’s manual execution.
  • Validate formatting Function nodes output readable, comma-separated numbers.
  • Confirm dashboard endpoints accept POST data with your auth token correctly.
  • Dry-run workflow in a sandbox or staging environment before activating live.

Deployment Guide

Activate the workflow in n8n after final validation. Since it runs every minute, monitor API quota usage to avoid rate limits. Use n8n’s execution logs to track successful runs and troubleshoot any failures.

FAQs

Q: Can I replace GitHub with GitLab?
While this workflow uses the official GitHub node, you can substitute GitLab using HTTP Request nodes targeting GitLab’s API with adjusted queries.

Q: Does this workflow consume many API credits?
API consumption depends on frequency. Adjust your cron job frequency as needed to balance freshness and cost.

Q: Is my dashboard data secure?
Yes, all posts require an authentication token. Ensure you keep credentials private, and use HTTPS endpoints when possible.

Conclusion

By setting up this n8n automation, you have transformed a tedious manual dashboard update task into a smooth, error-free, and timely process. Your project metrics from Docker, GitHub, npm, and Product Hunt now automatically refresh every minute, giving your team reliable, up-to-date insights at a glance.

This workflow saves several hours weekly and eliminates manual data entry mistakes. Next, consider expanding this system with Slack notifications for metric alerts or integrating more project management tools like Jira or Trello for comprehensive project health monitoring.

Take pride in your automated dashboard setup — a solid foundation for smart, data-driven project success!

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 in n8n

A complete beginner guide to building an AI-powered 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