Failover may be triggered by:

  • A provider outage.
  • Invalid recipient destination.
  • Provider throttling / payment issues.

Provider Failover

Have a backup provider for your most important channels. Backup providers are used automatically in the event of a provider outage or billing issue. No configuration beyond installing the provider from the channels page is required. For example, if SendGrid is your preferred email channel, you could install SES as a backup. If SendGrid fails, SES will be used automatically.

Channel Failover

Have multiple best of channels in your template configuration or single channels in routing. Courier will attempt to use each configured channel until the message is successfully sent. For example, if a template uses Best of: Email, Push, SMS, Courier will start with Email. If that fails, Push will be tried and so on.

Message Timeouts

Courier will retry failed sends with any provider for five minutes by default before failing over to the next available provider. This can be overridden using the message.timeouts field of your send call. All timeouts are specified in milliseconds.

Example:

{
  "message": {
    "timeouts": {
      /** Attempt each provider for 10 seconds before moving on to the next provider in the channel */
      "provider": 10000,
      /** Attempt to use a provider within the current channel for 1 minute before moving on to the next channel */
      "channel": 60000,
      /** Attempt the send for 2 minutes before quitting (no retry or failover will occur after this time) */
      "message": 120000
    },

    // Timeouts can also be specified on a channel and provider level. These take precedent over
    // The top level timeouts field when applicable

    "channels": {
      "email": {
        "timeout": 50000
      }
    },

    "providers": {
      "ses": {
        "timeout": 20000
      }
    }
  }
}