⚙️ Refresh API mocks and send OpenAPI diff alerts with GitHub and Postman

⚡ 45 views · ⚙️ DevOps & CI/CD

💡 Pro Tip — If you need GitHub data beyond what the REST API gives you, ScraperNode has a repository scraper that extracts metadata at scale without token rate limits.

View All Scrapers

Description

API Mock Auto-Refresh with GitHub, Postman & OpenAPI Diff Alerts

This n8n workflow automates the full API specification update lifecycle whenever changes are pushed to GitHub. It refreshes a Postman mock server, downloads the old and new OpenAPI specs, compares them using openapi-diff, then posts detected API changes directly to the GitHub Pull Request and emails the team. This helps engineering teams instantly validate API contract changes, catch breaking updates early and keep testers/mobile developers synced automatically.

Quick Start Setup

  1. Import the workflow JSON into your n8n account.
  2. Add your GitHub, Postman and Gmail credentials.
  3. Update values inside Set: Config node.
  4. Create a GitHub webhook pointing to /webhook/api-update.
  5. Configure GitHub Actions to run openapi-diff and POST results to /webhook/api-diff-result.
  6. Activate the workflow.
  7. Push an API spec update and test the automation.

What It Does

Managing API changes across backend, QA, mobile and frontend teams can become messy when OpenAPI specs are updated manually. This workflow solves that by creating an automated pipeline between GitHub, Postman and your internal notification channels.

Whenever code or spec changes are pushed to the develop branch, the workflow first refreshes your Postman Mock Server so testers can immediately work with the latest API behavior. It then downloads both old and new API spec files.

Next, an external GitHub Actions process runs openapi-diff to compare the specs and sends the result back into n8n. If changes exist, the workflow cleans the output, posts it as a GitHub Pull Request comment and emails the summary to stakeholders.

Who It’s For

Requirements to Use This Workflow

Accounts / Tools Needed

/openapi_specs/openapi_old.yaml
/openapi_specs/openapi_new.yaml

How It Works & Set Up

Workflow Logic

GitHub Push Trigger
   ↓
Load Config
   ↓
Refresh Postman Mock
   ↓
Download Old Spec
   ↓
Download New Spec
   ↓
GitHub Actions runs openapi-diff
   ↓
Send Result to n8n Webhook
   ↓
If changes found:
   ├─ Comment on PR
   └─ Send Email
Else:
   └─ Stop execution

Setup Instructions

1. Import Workflow

Upload the JSON file into n8n.

2. Configure Credentials

Connect:

3. Update Set: Config Node

Replace sample values with your real values:

4. GitHub Webhook

Create webhook inside your repository:

POST https://your-n8n-domain/webhook/api-update

Trigger on:

5. GitHub Actions Setup

Use Docker image for openapi-diff and POST response to:

https://your-n8n-domain/webhook/api-diff-result

6. Activate Workflow

Turn workflow ON and test with a sample OpenAPI change.

How To Customize Nodes

Set: Config

Use environment variables or credentials instead of plain text values.

Update Postman Mock

Point to another mock server or workspace.

Comment to PR

Customize PR comment format:

Send Summary Email

Send to:

If Node

Filter only:

Add-ons (Optional Enhancements)

  1. Slack notifications instead of email
  2. Microsoft Teams alerts
  3. Jira ticket creation for breaking changes
  4. Auto-approve PR if no breaking changes
  5. Save diff history to database
  6. Daily digest of API changes
  7. Trigger mobile regression tests automatically
  8. Publish docs automatically after merge

Use Case Examples

1. Mobile App Sync

Backend updates endpoints → mobile team receives diff instantly.

2. QA Regression Planning

Tester receives changed API list before release testing.

3. API Governance

Architecture team tracks breaking changes across repos.

4. Faster PR Reviews

Reviewers see API contract changes directly in GitHub comments.

5. Multi-Team Communication

Frontend, backend and product teams stay aligned.

There can be many more enterprise and SaaS use cases for this workflow.

Troubleshooting Guide

IssuePossible CauseSolution
Webhook not triggeringWrong GitHub webhook URLRecheck endpoint
No PR comment postedInvalid GitHub tokenRegenerate PAT
Mock not refreshedWrong Postman mock IDVerify mock server ID
Email not sentGmail OAuth expiredReconnect Gmail
No diff detectedSame specs or bad file pathValidate YAML files
Workflow stops earlyEmpty diff payloadCheck GitHub Actions POST body

Need Help?

Need help deploying or customizing this workflow for production use?

Our n8n workflow developers at WeblineIndia can help you with:

🔗 Nodes Used

HTTP Request, Webhook, Gmail, Stop and Error

📥 Import

Download workflow.json and import into n8n: Workflow menu → Import from File

📖 Importing guide · 🔑 Credential setup