mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-14 22:41:09 +02:00
A grep audit after the previous matrix removal commits found a handful
of stragglers in non-runtime files that the earlier sweeps missed:
- services/mana-llm/CLAUDE.md: removed matrix-ollama-bot from the
consumer-apps diagram and from the related-services table
- services/mana-video-gen/CLAUDE.md: removed "Matrix Bots" integration
bullet
- packages/notify-client/README.md: removed sendMatrix() doc entry
(the method itself was already gone in the prior cleanup)
- docker/grafana/dashboards/logs-explorer.json: dropped the "Matrix
Stack" log row that queried tier="matrix" (would show no data forever)
- docker/grafana/dashboards/master-overview.json: dropped the "Matrix
Bots" stat panel that counted up{job=~"matrix-.*-bot"}
- apps/mana/apps/landing/src/data/ecosystem-health.json: regenerated via
scripts/ecosystem-audit.mjs to drop matrix from the app list, icon
counts, file analytics, top offenders and authGuard missing list
- .gitignore: removed services/matrix-stt-bot/data/ pattern (the
service itself was deleted long ago)
Production-side stragglers also addressed (not in this commit):
- DROP USER synapse on prod Postgres (the parallel cleanup commit
2514831a3 dropped DATABASE matrix + DATABASE synapse but left the
role behind)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
3.3 KiB
3.3 KiB
@mana/notify-client
Client SDK for the mana-notify notification service.
Installation
pnpm add @mana/notify-client
Usage
Basic Usage
import { NotifyClient } from '@mana/notify-client';
const notify = new NotifyClient({
serviceUrl: 'http://localhost:3040',
serviceKey: process.env.MANA_NOTIFY_SERVICE_KEY,
appId: 'your-app-id',
});
// Send email
await notify.sendEmail({
to: 'user@example.com',
template: 'auth-password-reset',
data: { resetUrl: 'https://...', userName: 'Max' },
});
// Send push notification
await notify.sendPush({
userId: 'user-uuid',
title: 'New Message',
body: 'You have a new message',
data: { messageId: 'xxx' },
});
// Send to specific token
await notify.sendPush({
token: 'ExponentPushToken[xxx]',
title: 'Hello',
body: 'World',
});
// Schedule notification
await notify.scheduleEmail({
to: 'user@example.com',
template: 'calendar-reminder',
data: { eventTitle: 'Meeting' },
scheduledFor: new Date('2024-12-20T13:45:00Z'),
});
NestJS Integration
import { Module } from '@nestjs/common';
import { ConfigModule, ConfigService } from '@nestjs/config';
import { NotifyModule } from '@mana/notify-client/nestjs';
@Module({
imports: [
ConfigModule.forRoot(),
NotifyModule.forRootAsync({
imports: [ConfigModule],
useFactory: (config: ConfigService) => ({
serviceUrl: config.get('MANA_NOTIFY_URL', 'http://localhost:3040'),
serviceKey: config.get('MANA_NOTIFY_SERVICE_KEY'),
appId: config.get('APP_ID'),
}),
inject: [ConfigService],
}),
],
})
export class AppModule {}
Then inject the client:
import { Injectable, Inject } from '@nestjs/common';
import { NOTIFY_CLIENT, NotifyClient } from '@mana/notify-client/nestjs';
@Injectable()
export class NotificationService {
constructor(@Inject(NOTIFY_CLIENT) private readonly notify: NotifyClient) {}
async sendWelcomeEmail(email: string, name: string) {
await this.notify.sendEmail({
to: email,
template: 'auth-welcome',
data: { userName: name },
});
}
}
API Reference
NotifyClient
Constructor
new NotifyClient({
serviceUrl: string; // mana-notify service URL
serviceKey: string; // Service authentication key
appId: string; // Your application ID
timeout?: number; // Request timeout in ms (default: 30000)
});
Methods
sendEmail(options)- Send an email immediatelyscheduleEmail(options)- Schedule an email for later
Push Notifications
sendPush(options)- Send a push notificationschedulePush(options)- Schedule a push notification
Other Channels
sendWebhook(options)- Send a webhook
Batch & Management
sendBatch(notifications)- Send multiple notificationsgetNotification(id)- Get notification statuscancelNotification(id)- Cancel a pending notification
Templates
listTemplates(appId?)- List available templatesgetTemplate(slug, locale?)- Get a templatepreviewTemplate(slug, data, locale?)- Preview a rendered template
Environment Variables
| Variable | Description |
|---|---|
MANA_NOTIFY_URL |
mana-notify service URL |
MANA_NOTIFY_SERVICE_KEY |
Service authentication key |
APP_ID |
Your application ID |