[inbox] call API for conversation list and message list
A self-hosted, white-label alternative to ManyChat for agencies.
Brought to you by:
phongmaker
Originally created by: realcodesiman
Add API and handle actions for:
Add a button to add new message randomly from chat room
DON'T care about websocket, will be implemented later
Actions for message:
https://clerk.com/blog/authenticated-next-chat-app-with-ably-and-clerk
Inbox {
id String @id @default(cuid(2))
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
chatbotId String
channelType String // eg: ChannelWebWidget | ChannelMessenger | ChannelWhatsapp | ...
channelId String
name String
}
ContactInbox {
contactId String
inboxId String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
chatbotId String
sourceId String // id message of messenger or whatsapp, ...
}
WebWidgetTemplate {
id String @id @default(cuid(2))
name String
}
ChannelWebWidget {
id String @id @default(cuid(2))
chatbotId String
// welcomeFlowId String? -> relation to Flow.id, add later
authorizedDomains String[]
// suggestedMessages Json // dự kiến [{ key: hello, actionType: SendFlow | OpenWebsite | Text, value: .... }]
// menus Json // dự kiến [{ key: hello, menuType: SendFlow | OpenWebsite, value: .... }]
webWidgetTemplateId String
brandColor String @default("#007bff")
showHeader Boolean @default(true)
showPersonalLogo Boolean @default(false)
showMessageInput Boolean @default(true)
customizeCss String?
}
Conversation {
id String @id @default(cuid(2))
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
chatbotId String
contactId String
contactInboxId String
contactLastSeenAt DateTime?
agentLastSeenAt DateTime?
sourceId String // id message of messenger or whatsapp, ...
}
ConversationParticipant {
id String @id @default(cuid(2))
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
chatbotId String
conversationId String
userId String
contactId String
}
Message {
id String @id @default(cuid(2))
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
conversationId String
inboxId String
chatbotId String
messageType MessageType // enum: text | image | markdown | audio | video | file | location | carousel | card | dropdown | choice
content String?
senderType SenderType
senderId String?
}
Attachment {
id String @id @default(cuid(2))
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
chatbotId String
attachmentType Attachment // enum: image | audio | video | ...
messageId String
}
Ticket changed by: realcodesiman