Skip to content

new-chat-message

Source of truth: packages/notifications/src/translations.ts

DomainChannelsRecipients
chatin-app + email + pushChannel members minus the sender
SourceContext
apps/svelte-web/src/routes/api/stream-webhook/+server.ts:154handleNewMessage
interface NewChatMessageData {
senderName: string;
messagePreview: string;
inboxUrl: string;
}

The caller invokes triggerWorkflow('new-chat-message', recipientIds, data) where data is the NewChatMessageData shape above. The server pre-translates the payload via getTranslatedPayload('new-chat-message', recipientLocale, data) from @repo/notifications before sending, producing { inAppBody, emailSubject, emailBody } for the dashboard templates to render.

Knock dashboard template body: {{ inAppBody }}.

LocalePreview source
es💬 Nuevo mensaje de ${p.senderName}
en💬 New message from ${p.senderName}

Subject: {{ emailSubject }}. Body: {{ emailBody }} (HTML mode, dashboard escaping OFF — every user-supplied string is escaped server-side via escapeHtml from @repo/notifications).

LocaleSubject preview
esNuevo mensaje de ${p.senderName}
enNew message from ${p.senderName}

Email body is composed by emailBody.es in packages/notifications/src/translations.ts via the layout components in packages/notifications/src/email-layout.ts (wrapEmailLayout, ctaButton, calloutBox, quoteBlock, propertyCard, detailTable / detailRow). Body source is not inlined here because it spans tens of lines per locale — open the source file for the full template.

Push delivery is configured at the Knock dashboard level for this workflow (FCM channel step with {{ inAppBody }} as the notification body). iOS APNs is deferred until the dashboard p8 key is wired — see Configuration → mobile push.