Enbbox Docs

Multi-Channel Workflows

Build multi-channel notification workflows with Enbbox. Combine email, SMS, push, in-app, and chat channels in a single workflow with fallback logic and conditional routing.

Multi-channel workflows ensure users receive notifications on their preferred channel with automatic fallback.

Example: Order Update

const orderUpdate = workflow("order-update", async ({ step, payload }) => {
  // Step 1: In-app notification (immediate)
  await step.inApp("order-inapp", async () => ({
    subject: `Order #${payload.orderNumber} Update`,
    body: `Your order status: ${payload.status}`,
    primaryAction: {
      label: "Track Order",
      redirect: { url: `/orders/${payload.orderNumber}` },
    },
  }));

  // Step 2: Email notification
  await step.email("order-email", async () => ({
    subject: `Order #${payload.orderNumber}: ${payload.status}`,
    body: `<h1>Order Update</h1><p>${payload.statusMessage}</p>`,
  }));

  // Step 3: If shipped, also send SMS
  if (payload.status === "shipped") {
    await step.sms("shipping-sms", async () => ({
      body: `Your order #${payload.orderNumber} has shipped! Track: ${payload.trackingUrl}`,
    }));
  }

  // Step 4: Push notification
  await step.push("order-push", async () => ({
    title: "Order Update",
    body: `Order #${payload.orderNumber}: ${payload.status}`,
  }));
});

Fallback Pattern

Send via in-app first, then escalate if unread:

const urgentAlert = workflow("urgent-alert", async ({ step, payload }) => {
  await step.inApp("alert-inapp", async () => ({
    subject: payload.title,
    body: payload.message,
  }));

  await step.delay("wait-1h", async () => ({ amount: 1, unit: "hours" }));

  await step.email("alert-email", async () => ({
    subject: `[Urgent] ${payload.title}`,
    body: `<p>${payload.message}</p>`,
  }));

  await step.delay("wait-4h", async () => ({ amount: 4, unit: "hours" }));

  await step.sms("alert-sms", async () => ({
    body: `Urgent: ${payload.message}`,
  }));
});

Best Practices

  1. Start with in-app — Lowest friction, real-time
  2. Escalate by urgency — Email → SMS → Phone
  3. Respect preferences — Let users choose their channels
  4. Use conditions — Skip channels based on delivery status
  5. Mark critical — Override preferences only for essential notifications

On this page