| Function | Description |
|---|
createEmailProvider(config) | Create an email provider (SES or SMTP) |
createPushProvider(config) | Create a push notification provider (SNS) |
createSmsProvider(config) | Create an SMS provider (SNS) |
ChannelProvider interface:
| Method | Description |
|---|
send(options) | Send a message via this channel |
name | Channel name ('email', 'push', 'sms') |
| Function | Description |
|---|
createCommsClient(config) | Create a comms client with one or more providers |
CommsClient interface:
| Method | Description |
|---|
send(request) | Send a single message across one or more channels |
broadcast(request) | Send to many recipients with channel fallback |
| Function | Description |
|---|
renderString(template, vars) | Render a single template string |
renderTemplate(template, vars) | Render a MessageTemplate (subject + body) |
extractVariables(template) | Extract {{variable}} placeholders from a template |
createTemplateRegistry() | Create an in-memory template store |
| Function | Description |
|---|
isChannelAllowed(userId, channel, store) | Check whether a channel is allowed for a user |
isQuietHours(prefs, now?) | Check whether the user is in quiet hours |
getEffectiveChannels(requested, prefs) | Filter channels through user preferences |
createMemoryPreferenceStore() | Create an in-memory PreferenceStore |
| Function | Description |
|---|
createChatManager(store) | Create a chat manager backed by a ChatStore |
ChatManager interface:
| Method | Description |
|---|
createDirectRoom(userA, userB) | Create a 1-1 direct room |
createGroupRoom(options) | Create a group room |
sendMessage(options) | Send a chat message |
getMessages(roomId, options?) | Fetch messages for a room |
Comms-related types are exported from ./types/index.js and the messaging/chat modules. Common shapes include Channel, DeliveryStatus, MessagePriority, Message, Attachment, Recipient, DeliveryReceipt, SendRequest, BroadcastRequest, SendResult, BroadcastResult, MessageTemplate, RenderedTemplate, NotificationPreference, PreferenceStore, ChatRoom, Participant, ChatMessage, TypingEvent, PresenceStatus, UserPresence, UnreadCount, ChatStore.
| Constant | Description |
|---|
DEFAULT_PREFERENCES | Default per-user notification preferences |