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.
/webhook/api-update.openapi-diff and POST results to /webhook/api-diff-result.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.
/openapi_specs/openapi_old.yaml
/openapi_specs/openapi_new.yaml
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
Upload the JSON file into n8n.
Connect:
Replace sample values with your real values:
postman.apiKeypostman.mockIdgithub.repogithub.tokengithub.prIdCreate webhook inside your repository:
POST https://your-n8n-domain/webhook/api-update
Trigger on:
Use Docker image for openapi-diff and POST response to:
https://your-n8n-domain/webhook/api-diff-result
Turn workflow ON and test with a sample OpenAPI change.
Use environment variables or credentials instead of plain text values.
Point to another mock server or workspace.
Customize PR comment format:
Send to:
Filter only:
Backend updates endpoints → mobile team receives diff instantly.
Tester receives changed API list before release testing.
Architecture team tracks breaking changes across repos.
Reviewers see API contract changes directly in GitHub comments.
Frontend, backend and product teams stay aligned.
There can be many more enterprise and SaaS use cases for this workflow.
| 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 deploying or customizing this workflow for production use?
Our n8n workflow developers at WeblineIndia can help you with: