AI/ML
Automate SLA Monitoring with n8n Workflows
Overview
n8n checks Zendesk tickets against SLA deadlines, alerting the team via Slack if a breach is imminent.
Prerequisites
- n8n installed.
- Zendesk account with API access.
- Slack account with bot token.
Workflow Setup
1. Prepare n8n Environment
Navigate to http://localhost:5678 (or your n8n URL) and log in with your credentials. In the sidebar, click “Workflows,” then select “+ New” and name it (e.g., “SLA Monitor”). Click “+” on the canvas to open the node selector.
2. Trigger Node: Cron
Node: Cron
Settings:
- Cron Expression: */15 * * * * (every 15 minutes)
Output: Periodic trigger.
3. Fetch Tickets Node: Zendesk
Node: Zendesk
Settings:
- Credentials: Zendesk API token
- Resource: Ticket
- Operation: Get Many
- Query: status:open
Output: Open tickets (e.g., {{ $json.tickets[0].created_at }}).
4. Check SLA Node: Function
Node: Function
Settings:
Code:
const created = new Date($node["Zendesk"].json.tickets[0].created_at);const now = new Date();const hours = (now - created) / 1000 / 60 / 60;return [{ json: { atRisk: hours > 4 } }]; // SLA: 5 hoursOutput: SLA status.
5. Alert Node: Slack
Node: Slack
Settings:
- Credentials: Slack Bot Token
- Channel: #support-sla
- Text: SLA Risk: Ticket #{{ $node["Zendesk"].json.tickets[0].id }} nearing 5-hour limit
- Condition: {{ $node["Function"].json.atRisk }}
Output: Alert sent if at risk.
Workflow Summary
- Flow: Cron → Zendesk → Function → Slack.
- Execution: ~10 seconds every 15 minutes.
Benefits
- Prevents SLA breaches by ~25%.
- Ensures timely escalations.
- Maintains service reliability.
Troubleshooting
Cron Fail: Check expression syntax.
SLA Logic: Verify Function code.
Ready to transform your business with our technology solutions? Contact Us today to Leverage Our AI/ML Expertise.
Comment