Enbbox Docs

Framework Quickstart

Get started with the Enbbox Framework in under 5 minutes. Define notification workflows in TypeScript, serve them via Next.js or Express, and trigger your first multi-channel notification.

Framework Quickstart

TL;DR — Install @enbbox/framework, define a workflow in TypeScript, serve it via a Next.js or Express endpoint, sync it with npx enbbox sync, and trigger your first notification. Total setup time: under 5 minutes.

Installation

npm install @enbbox/framework

Define Your First Workflow

Create a file workflows/welcome.ts:

import { workflow } from "@enbbox/framework";

export const welcomeWorkflow = workflow(
  "welcome-notification",
  async ({ step, payload }) => {
    await step.email("welcome-email", async () => ({
      subject: `Welcome, ${payload.name}!`,
      body: `
        <h1>Welcome to Our Platform</h1>
        <p>Hi ${payload.name}, we're excited to have you!</p>
        <p>Here are some things you can do to get started:</p>
        <ul>
          <li>Complete your profile</li>
          <li>Explore the dashboard</li>
          <li>Invite your team</li>
        </ul>
      `,
    }));

    await step.inApp("welcome-inapp", async () => ({
      subject: "Welcome!",
      body: `Thanks for joining, ${payload.name}!`,
    }));
  },
  {
    payloadSchema: {
      type: "object",
      properties: {
        name: { type: "string" },
      },
      required: ["name"],
    },
  },
);

What This Does

StepChannelAction
1EmailSends a welcome email with the user's name
2In-AppShows a real-time in-app notification in the Inbox

The @enbbox/framework provides type-safe workflow definitions with support for all 5 channels (email, SMS, push, in-app, chat), delay steps, digest aggregation, and conditional logic.

Serve the Endpoint

Next.js

// app/api/enbbox/route.ts
import { serve } from "@enbbox/framework/next";
import { welcomeWorkflow } from "@/workflows/welcome";

export const { GET, POST, OPTIONS } = serve({
  workflows: [welcomeWorkflow],
});

Express

import express from "express";
import { serve } from "@enbbox/framework/express";
import { welcomeWorkflow } from "./workflows/welcome";

const app = express();

app.use("/api/enbbox", serve({ workflows: [welcomeWorkflow] }));

Sync to Enbbox

npx enbbox sync --bridge-url http://localhost:3000/api/enbbox

This command syncs your code-first workflow definitions with the Enbbox dashboard, making them visible in the visual workflow builder.

Trigger Your First Notification

await enbbox.trigger("welcome-notification", {
  to: { subscriberId: "user-123" },
  payload: { name: "John" },
});

Next Steps

On this page