Why Integration Resilience Matters
Every ServiceNow developer has been there — you build a beautiful integration, it works perfectly in dev, and then production happens. APIs go down, payloads change, rate limits hit, and suddenly your automated workflow is silently failing at 2 AM.
In this guide, we'll walk through battle-tested patterns for building integrations that survive the real world.
The Three Pillars of Resilient Integrations
1. Retry with Exponential Backoff
Never retry immediately. The most common mistake is hammering a failing endpoint with rapid retries, which often makes things worse.
Instead, implement exponential backoff with jitter:
// Flow Designer Script Step
var maxRetries = 3;
var baseDelay = 1000; // 1 secondfor (var attempt = 0; attempt < maxRetries; attempt++) {
try {
var response = sn_ws.RESTMessageV2(messageName, methodName);
response.execute();
break; // Success, exit retry loop
} catch (e) {
var delay = baseDelay * Math.pow(2, attempt);
var jitter = Math.random() * delay * 0.1;
gs.sleep((delay + jitter));
}
}2. Circuit Breaker Pattern
When an external service is consistently failing, stop calling it entirely for a cooldown period. This prevents cascading failures and gives the downstream service time to recover.
ServiceNow doesn't have a built-in circuit breaker, but you can implement one using system properties as state storage:
integration.{name}.circuit_state— CLOSED, OPEN, or HALF_OPENintegration.{name}.failure_count— consecutive failuresintegration.{name}.last_failure— timestamp of last failure
Check these properties at the start of every integration flow. If the circuit is OPEN and the cooldown hasn't elapsed, skip the call entirely and log a warning.
3. Dead Letter Queue
When all retries are exhausted, don't just log an error and move on. Push the failed payload to a dead letter table for manual review and replay.
Create a custom table (u_integration_dead_letter) with fields for:
- Source system
- Target endpoint
- Payload (JSON)
- Error message
- Retry count
- Status (pending, retried, abandoned)
Putting It All Together
The magic happens when you combine all three patterns into a single reusable subflow. Your integration flows become clean and declarative — they just call the subflow and trust the resilience layer to handle the chaos.
At OnlyFlows, we're building a library of production-ready patterns like this. Every flow, subflow, and action is tested against real-world failure scenarios before publishing.
Key Takeaways
- Never retry without backoff — exponential backoff with jitter is your friend
- Implement circuit breakers — protect your instance from cascading failures
- Dead letter everything — failed payloads should be recoverable, not lost
- Make it reusable — wrap resilience patterns in subflows so every integration benefits
What patterns do you use for resilient integrations? Drop a comment or share your flows on OnlyFlows.tech.