Real Messaging Engine

Intelligent Routing

Routing decides which channel and which provider carry each message, and what happens when the first choice fails.

Decision order

Request
  ↓
Consent check ......... blocked → Suppressed
  ↓
Suppression check ..... blocked → Suppressed
  ↓
Channel selection ..... explicit | capability | preference | EIE prediction
  ↓
Provider selection .... priority · health · cost · geography · daily limit
  ↓
Send
  ↓
Failure? → Failover provider → Retry policy → Alternate channel → Dead letter

Channel strategies

StrategyBehavior
EXPLICITUse the single channel requested
FIRST_CAPABLEFirst channel the device or address supports
FIRST_REACHABLETry in order until one accepts
ALLSend on every listed channel
LEAST_COSTCheapest channel that satisfies the policy
PREDICTEDEIE-predicted highest-response channel

Provider selection

Providers are scored per message:

weights:
  priority:   0.40    # configured Priority__c
  health:     0.30    # rolling error + bounce rate
  cost:       0.15
  geography:  0.10    # provider region vs recipient region
  headroom:   0.05    # remaining daily limit

A provider whose rolling error rate crosses the configured threshold is opened out of the pool (circuit breaker) and probed periodically before returning.

Failover

provider: SENDGRID
failoverProvider: AMAZON_SES
failoverOn: [5xx, timeout, rate_limited, circuit_open]
maxFailoverHops: 2

Failover is transparent to the caller: the Message__c record keeps one identity while Delivery_Attempt__c children record each provider attempt.

Routing rules

Declarative rules override defaults without code:

- name: EU recipients stay in EU
  when: recipient.country in [DE, FR, ES, IT, NL]
  then: provider = AZURE_ACS_EU

- name: OTP is SMS first
  when: message.category == "AUTHENTICATION"
  then: channels = [SMS, VOICE], strategy = FIRST_REACHABLE

- name: High-value accounts use dedicated IP
  when: account.Tier__c == "Platinum"
  then: ipPool = "platinum"

Continue to Delivery Analytics.

Was this helpful?

Last updated 1 month ago