Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Customer support agent — Dart

Runnable CLI that connects to DNotifier, seeds a support knowledge base, and chats with a production-style support agent.

Prerequisites

  • Dart SDK 3.0+
  • DNotifier app with AI enabled — app.dnotifier.com
  • DNOTIFIER_APP_ID and DNOTIFIER_SECRET

Run

cd dnotifier-examples/use-cases/customer-support-agent/dart
cp .env.example .env
# edit .env — set DNOTIFIER_APP_ID and DNOTIFIER_SECRET

dart pub get
dart run bin/main.dart

Expected startup:

Connected to DNotifier (AI support agent ready)
Seeding sample customer-support knowledge base…
Indexed: Password reset …
…
Ready. userId=support-agent-demo  useKnowledgeBase=true  sessionId=(new)
you>

Example session:

you> How do I reset my password?
agent> …

you> /add VIP shipping | VIP orders ship in 1 business day.
Document added: …

you> How fast is VIP shipping?
agent> …

you> /quit

Commands

Command Action
(any text) Ask the support agent (sendAI)
/seed Re-index sample support docs
/add Title | content… Add one knowledge-base document
/kb on / /kb off Toggle useKnowledgeBase
/history Fetch AI history for this user
/help Show commands
/quit Disconnect and exit

What runs on startup

  1. Connects over HTTP with logs: true
  2. If SEED_KB=true, indexes sample FAQs via addKnowledgeBase
  3. Opens an interactive prompt

Project layout

lib/
  prompts.dart          supportSystemPrompt + supportKnowledgePrompt
  knowledge_base.dart   addKnowledgeBase + seedSupportKnowledgeBase
  support_agent.dart    askSupport / fetchSupportHistory
  client.dart           DNotifier client factory
  env.dart              .env loader
bin/
  main.dart             CLI entry

Key code

await addKnowledgeBase(notifier, senderId, KnowledgeDoc(
  title: 'Refunds and returns',
  content: 'Return window: 30 days…',
  type: 'policy',
  recordId: 'support-faq-refunds', // required by Dart SDK
));

final result = await askSupport(
  notifier,
  question,
  senderId: senderId,
  sessionId: sessionId,
  useKnowledgeBase: true,
);

Docs

See the use-case README and DNotifier product docs.