Enbbox Docs

Subscribers

Subscribers in Enbbox — manage notification recipients with unique identifiers, contact details, preferences, custom data, and channel credentials (device tokens, chat IDs).

A Subscriber is a user in your system who receives notifications. Every notification in Enbbox is delivered to a subscriber.

How Enbbox Identifies a Subscriber

Each subscriber is uniquely identified by a subscriberId — a string you define, typically matching the user's ID in your system.

// The subscriberId maps to your internal user ID
await enbbox.subscribers.identify("user-123", {
  email: "[email protected]",
  firstName: "John",
});

Subscriber Profile Structure

User Data

FieldTypeDescription
subscriberIdstringRequired. Unique identifier
emailstringEmail address for email notifications
phonestringPhone number for SMS notifications
firstNamestringFirst name for personalization
lastNamestringLast name for personalization
avatarstringAvatar URL displayed in the Inbox
localestringPreferred locale (e.g., en, fr)

Custom Data

Store arbitrary metadata on a subscriber for use in notification templates:

await enbbox.subscribers.identify("user-123", {
  email: "[email protected]",
  data: {
    plan: "premium",
    company: "Acme Corp",
    signupDate: "2024-01-15",
  },
});

Use custom data in templates with Handlebars syntax: {{subscriber.data.plan}}

Channel-Specific Credentials

For push and chat channels, subscribers need provider-specific credentials:

await enbbox.subscribers.setCredentials("user-123", "fcm", {
  deviceTokens: ["token-abc-123"],
});

Subscriber Creation

Just-in-Time

Subscribers can be created automatically when a workflow is triggered — if the subscriber doesn't exist, Enbbox creates them with the provided data.

Ahead of Trigger

Pre-create subscribers before triggering workflows:

await enbbox.subscribers.identify("user-123", {
  email: "[email protected]",
  firstName: "John",
  lastName: "Doe",
});

Bulk Import

Create multiple subscribers at once:

await enbbox.subscribers.bulkCreate([
  { subscriberId: "user-1", email: "[email protected]" },
  { subscriberId: "user-2", email: "[email protected]" },
  { subscriberId: "user-3", email: "[email protected]" },
]);

Subscriber Preferences

Subscribers can control which notifications they receive:

Global Preferences

Enable or disable specific channels entirely:

// Subscriber opts out of SMS notifications
await enbbox.subscribers.updatePreference("user-123", {
  channel: { sms: false },
});

Workflow-Specific Preferences

Control preferences per workflow:

// Subscriber opts out of email for a specific workflow
await enbbox.subscribers.updatePreference("user-123", {
  workflowId: "marketing-updates",
  channel: { email: false },
});

Preference UI

The <Inbox /> component includes built-in preference management, allowing subscribers to control their notification settings directly.

Managing Subscribers

Dashboard

View, search, and manage subscribers in the Enbbox dashboard under Subscribers.

API

Full CRUD operations are available via the REST API:

  • GET /subscribers — List all subscribers
  • POST /subscribers — Create a subscriber
  • GET /subscribers/:subscriberId — Get subscriber details
  • PUT /subscribers/:subscriberId — Update a subscriber
  • DELETE /subscribers/:subscriberId — Delete a subscriber

Frequently Asked Questions

Can two subscribers have the same email address?

Yes. The subscriberId is the unique identifier, not the email. Multiple subscribers can share an email address.

Do I have to use subscriberId as my system userId?

No, but it's recommended. Using the same ID simplifies integration and avoids maintaining a mapping.

Can a notification be sent without adding a subscriber?

No. Every notification requires a subscriber. However, subscribers can be created automatically during trigger (just-in-time creation).

On this page