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 withnpx enbbox sync, and trigger your first notification. Total setup time: under 5 minutes.
Installation
npm install @enbbox/frameworkDefine 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
| Step | Channel | Action |
|---|---|---|
| 1 | Sends a welcome email with the user's name | |
| 2 | In-App | Shows 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/enbboxThis 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
- Email Channel — Configure email templates and providers
- In-App Channel — Add the Inbox component to your app
- Delay & Digest — Add timing and aggregation to workflows
- API Reference — Full REST API documentation
Introduction
Introduction to the Enbbox Framework. Learn how code-first workflow definitions work, supported channels, and how to integrate with Next.js and Express.
Email Channel
Send email notifications using the Enbbox Framework. Configure email templates, HTML content, and subject lines in TypeScript workflow definitions.