Skip to content

Commit a6c973e

Browse files
committed
fix: conversation timeline schema missmatch
1 parent 51f2f82 commit a6c973e

3 files changed

Lines changed: 5 additions & 0 deletions

File tree

apps/api/src/utils/conversation-realtime.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ export async function emitConversationCreatedEvent({
126126
updatedAt: conversation.updatedAt,
127127
visitorId: conversation.visitorId,
128128
websiteId: conversation.websiteId,
129+
channel: conversation.channel,
129130
status: conversation.status,
130131
deletedAt: conversation.deletedAt ?? null,
131132
lastTimelineItem: header.lastTimelineItem ?? undefined,

apps/api/src/ws/router.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,7 @@ describe("conversationCreated handler", () => {
483483
updatedAt: new Date().toISOString(),
484484
visitorId: "visitor-created",
485485
websiteId: "site-created",
486+
channel: "widget",
486487
status: "open",
487488
deletedAt: null,
488489
lastTimelineItem: undefined,

packages/core/src/client.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ type InitiateConversationParams = {
8686
conversationId?: string;
8787
visitorId?: string | null;
8888
websiteId?: string | null;
89+
channel?: Conversation["channel"];
8990
title?: string;
9091
status?: Conversation["status"];
9192
defaultTimelineItems?: Array<DefaultMessage | TimelineItem>;
@@ -257,6 +258,7 @@ export class CossistantClient {
257258
updatedAt: now,
258259
visitorId: baseVisitorId,
259260
websiteId: baseWebsiteId,
261+
channel: params.channel ?? "widget",
260262
status: params.status ?? ConversationStatus.OPEN,
261263
deletedAt: null,
262264
lastTimelineItem: timelineItems.at(-1),
@@ -420,6 +422,7 @@ export class CossistantClient {
420422
const response = await this.restClient.createConversation({
421423
conversationId: rest.conversationId,
422424
visitorId: pending.conversation.visitorId || undefined,
425+
channel: pending.conversation.channel,
423426
defaultTimelineItems: [
424427
...pending.initialTimelineItems,
425428
optimisticTimelineItem,

0 commit comments

Comments
 (0)