Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Developer integration guide

This guide maps common integration patterns to DNotifier capabilities — for frontend-only, backend-only, and full-stack teams. It replaces ad-hoc "how do I wire this?" questions with concrete architectures using realtime 1:1 messaging, chat, AI, and workflows.


Before you integrate

Step
Action

2

Create an app and note App ID + secret

3

Install SDK — npm or pub.dev

4

Choose transport — WebSocket for live client; HTTP for AI/RAG and server send

User ID scheme: Decide early how IDs map to auth users, devices, bots, and service accounts. IDs are routing keys for all messaging.

→ Credentials & environment


Capability quick reference

Capability
When to use
Primary APIs

Realtime communication

Live delivery to known IDs

connect, send, sendBinary, HTTP RPC send

Chat

Threads with history

send + fetchChatHistory, deleteChatHistoryMessage

AI

LLM + RAG

sendAI, addDocument, search

Workflows

Multi-step agents

defineAgent, Workflow, run workflow


Frontend integration patterns

Frontend apps (React, Vue, Svelte, Flutter, etc.) typically hold a WebSocket connection for realtime and call HTTP transport for AI where appropriate.

Connect on login

→ Browser platform guide


Realtime dashboards via 1:1 messaging

Goal: Admin dashboard updates live when metrics change.

Piece
Implementation

Client

Connect as userId: adminUser.id (or per-dashboard session ID)

Backend

Metric job sends { type: "metrics", data } to that receiverId

UI

onMessage updates charts

No shared channel — each dashboard session is an ID you control.

→ Live dashboards use case


In-app notifications

Goal: Toast or inbox when events occur.

  1. User connects with authenticated userId.

  2. Backend event → server send to receiverId: userId.

  3. Payload { type: "notification", title, body, link }.

  4. Client routes by type in handleIncoming.

Works for order updates, mentions, approvals, and system alerts.


Collaborative UI sync

Goal: Two or more users see cursors, selections, or document ops.

Strategy
Details

Peer sync

User A sends ops to User B's ID

Fan-out

Your app maintains participant array; loop receiverIds

Authority

Backend merges; pushes canonical state to each participant ID

DNotifier delivers ops; conflict resolution stays in your app.

→ Collaborative UI sync


Embedded chat UI

Goal: 1:1 or support chat in your product.

  1. Connect WebSocket on thread open.

  2. fetchChatHistory for sender + peer IDs.

  3. send with saveHistory: true.

  4. Render with Chat UI patterns.

Bot participants use the same APIs with a bot userId.

→ Building 1:1 chat


Live progress tracking

Goal: Progress bar for upload, export, or AI job.

  1. Client connects before starting job.

  2. Worker sends { type: "progress", percent, label } to user's ID.

  3. UI updates from onMessage; show complete state at 100%.

Pair with workflows for multi-step AI pipelines.


AI panels (frontend)

For copilots and assistants in the UI:

Use HTTP transport for predictable request/response. Optionally push long-running results via WebSocket when done.

→ Send a prompt


Backend integration patterns

Backend services (Node, Dart server, etc.) connect for server-side send, AI/RAG, and workflow execution — often without a persistent WebSocket.

Server-side message delivery (HTTP RPC send)

Goal: Push events to online users from cron jobs, microservices, or webhooks.

Step
Action

1

User already connected on frontend with known userId

2

Backend uses SDK or HTTP API with app credentials

3

Send payload with receiverId: targetUserId

4

Client receives in onMessage

This is backend-to-client updates — the standard pattern for notifying a specific user without polling.

→ Backend-to-client updates


Webhooks to realtime bridge

Goal: External systems (payment processors, CI/CD webhooks, internal ERP) trigger live client updates.

Step
Details

Receive

POST webhook to your endpoint

Verify

Signature / secret validation

Resolve user

Map event to DNotifier userId (e.g. customer ID)

Deliver

Send structured payload to that ID

Optional

Persist event in your DB before send

Example payloads:

  • { type: "payment-succeeded", invoiceId }

  • { type: "deploy-complete", environment }

The bridge is your code — DNotifier is the last mile to connected clients.


Microservice events via direct messaging to user IDs

Goal: Service A notifies Service B or an end user without a separate client-facing bus.

Pattern
Example

User last mile

Billing service sends to user-123 — mobile app shows alert

Service to service

svc-inventory sends to connected svc-orders worker ID

Job completion

Worker sends result to requesting user's ID

Assign service account IDs the same way as user IDs — any connected client with that ID receives messages.


AI and RAG on the server

Goal: Keep prompts and document ingestion on trusted infrastructure.

Run workflows on the server for batch processing, cron-driven reports, and webhook-triggered AI.

→ Node.js platform guide


Workflow runner (backend)

Define agents and workflows in code; execute from API routes or workers:

  1. Register agents with DNotifier.defineAgent.

  2. Build Workflow with entry and registerAgents.

  3. On request, instantiate DNotifier (HTTP), connect, run workflow with input.

  4. Return result to HTTP client or push to user via send if they wait on WebSocket.

Enable observability: true for production debugging.

→ Run a workflow


Full-stack integration patterns

Full-stack teams split connection ownership (client WebSocket) and authority (server AI, routing, webhooks).

Responsibility
Owner
Transport

User chat UI

Frontend

WebSocket

Live notifications

Backend → client

HTTP send or WS

AI / RAG / workflows

Backend

HTTP

Auth / secrets

Backend

—

User ID issuance

Backend

—


End-to-end: support chat with AI handoff

Layer
Stack

Frontend

Widget: WS connect, chat UI, onMessage

Backend API

Route messages; run workflow; assign agents

AI

sendAI + RAG for bot; workflow for escalation

Realtime

Status events to user ID (agent-joined, queue)

Chat

History between user, bot, and agent IDs

→ Combined use cases


End-to-end: export with live progress

Layer
Stack

Frontend

Start export; WS connected

Backend

Queue job with userId metadata

Worker

Progress + complete messages to that ID

Optional AI

Workflow summarizes export contents


End-to-end: collaborative document

Layer
Stack

Frontend

WS; send ops to peer IDs

Backend

Persist snapshots; optional merge authority

Realtime

Op delivery only

Optional AI

Side panel sendAI over HTTP


Transport decision matrix

Scenario
Client
Server

Chat UI

WebSocket

HTTP send for push

AI assistant panel

HTTP (or WS if unified)

HTTP

Dashboard live metrics

WebSocket

HTTP send

Webhook → user alert

—

HTTP send

Workflow batch job

—

HTTP

Full matrix: Transport method matrix


Multi-platform clients

Platform
Guide

Browser

Node.js

Flutter

Pure Dart

Use the same app credentials; align userId with your auth across web and mobile.


Production checklist (integration-focused)

Item
Verify

Secrets only on server

No app secret in mobile/web bundles

Stable user IDs

Same auth user → same DNotifier ID

Plan limits

getPlanLimits() gates features

Logging

logs: true for AI; workflow observability in prod

Payload schema

Versioned type field in JSON messages

→ Production checklist


Where to go next

Topic
Link

Use case deep dives

API reference

Copy-paste examples

Troubleshooting

Support links

Dashboard: app.dnotifier.com · Pricing: dnotifier.com · SDKs: npm · pub.dev

Last updated