Refresh API mocks and send OpenAPI diff alerts with GitHub and Postman
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
Import the workflow JSON into your n8n account. Add your GitHub, Postman and Gmail credentials. Update values inside Set: Config node. Create a GitHub webhook pointing to /webhook/api-update. Configure GitHub Actions to run openapi-diff and POST results to /webhook/api-diff-result. Activate the workflow. 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
API development teams Mobile app teams relying on mocks QA / testing engineers DevOps teams managing CI/CD pipelines Product teams reviewing API changes Enterprises maintaining multiple consumers of internal APIs
Requirements to Use This Workflow
Accounts / Tools Needed
n8n account (cloud or self-hosted) GitHub repository access Postman account with Mock Server Gmail account for notifications GitHub Personal Access Token GitHub Actions enabled in repository OpenAPI spec files stored in repository
Recommended Files
/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
- Import Workflow
Upload the JSON file into n8n.
- Configure Credentials
Connect:
GitHub Header Auth Postman API Key Gmail OAuth2
- Update Set: Config Node
Replace sample values with your real values:
postman.apiKey postman.mockId github.repo github.token github.prId
- GitHub Webhook
Create webhook inside your repository:
POST https://your-n8n-domain/webhook/api-update
Trigger on:
Push events Pull requests (optional)
- GitHub Actions Setup
Use Docker image for openapi-diff and POST response to:
https://your-n8n-domain/webhook/api-diff-result
- 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:
Add markdown tables Mention reviewers Highlight breaking changes only
Send Summary Email
Send to:
Product managers QA team Slack email channel Multiple recipients
If Node
Filter only:
Breaking changes Path additions Schema changes
Add-ons (Optional Enhancements)
Slack notifications instead of email Microsoft Teams alerts Jira ticket creation for breaking changes Auto-approve PR if no breaking changes Save diff history to database Daily digest of API changes Trigger mobile regression tests automatically Publish docs automatically after merge
Use Case Examples
- Mobile App Sync
Backend updates endpoints → mobile team receives diff instantly.
- QA Regression Planning
Tester receives changed API list before release testing.
- API Governance
Architecture team tracks breaking changes across repos.
- Faster PR Reviews
Reviewers see API contract changes directly in GitHub comments.
- 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
| Issue | Possible Cause | Solution | |---|---|---| | Webhook not triggering | Wrong GitHub webhook URL | Recheck endpoint | | No PR comment posted | Invalid GitHub token | Regenerate PAT | | Mock not refreshed | Wrong Postman mock ID | Verify mock server ID | | Email not sent | Gmail OAuth expired | Reconnect Gmail | | No diff detected | Same specs or bad file path | Validate YAML files | | Workflow stops early | Empty diff payload | Check 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:
n8n workflow implementation GitHub CI/CD integrations API governance automation Postman mock lifecycle systems Enterprise DevOps automations Custom notification pipelines
Related Templates
AI Email Classifier & Auto-Delete for Gmail (SPAM/OFFER Cleaner)
This workflow is designed for freelancers, solopreneurs, and business owners who receive a high volume of irrelevant mes...
Automatic News Summarization & Email Digest with GPT-4, NewsAPI and Gmail
📰 AI News Digest Agent: Auto News Summarizer & Email Newsletter Create an intelligent news curation system that automat...
Generate Food Recipes from Gmail & Form Requests with Ollama & Llama 3.2
This n8n template demonstrates how to create an intelligent food recipe assistant that accepts requests via Gmail and we...
🔒 Please log in to import templates to n8n and favorite templates
Workflow Visualization
Loading...
Preparing workflow renderer
Comments (0)
Login to post comments