@skyiro/notifier-client
v0.1.3
Published
gRPC client wrappers for the notifier service
Readme
@skyiro/notifier-client
TypeScript gRPC client for publishing notifier events.
Install
pnpm add @skyiro/notifier-clientUsage
import { NotifierClient } from '@skyiro/notifier-client';
const client = new NotifierClient(process.env.MAILER_GRPC_ADDRESS ?? '127.0.0.1:50051');
async function sendLoginOtp() {
const response = await client.publishEmailEvent({
tenantId: 'demo-tenant',
recipient: '[email protected]',
templateKey: 'LOGIN',
payload: { otp: '123456' },
idempotencyKey: `login-otp-${Date.now()}`
});
console.log(response);
client.close();
}Available APIs
publishEmailEvent(data)publishNotificationEvent(data)close()
Configuration
Only one runtime value is configurable: the gRPC server URL/address passed to NotifierClient.
new NotifierClient('127.0.0.1:50051');Recommended environment variable:
MAILER_GRPC_ADDRESS(example:127.0.0.1:50051)
There are no additional client options (no auth, retry, timeout, or TLS config exposed by this package yet).
Local example script
From this package:
pnpm example:login-email