2
0

Add Chatwoot livechat integration

Closes #159
This commit is contained in:
Baptiste Arnaud
2022-11-10 10:53:44 +01:00
parent 92147c315f
commit ea84039024
32 changed files with 464 additions and 62 deletions

View File

@ -0,0 +1 @@
export * from './types'

View File

@ -0,0 +1,34 @@
import { z } from 'zod'
import {
blockBaseSchema,
IntegrationBlockType,
} from '../../typebot/blocks/shared'
export const chatwootOptionsSchema = z.object({
baseUrl: z.string(),
websiteToken: z.string(),
user: z
.object({
id: z.string().optional(),
email: z.string().optional(),
name: z.string().optional(),
avatarUrl: z.string().optional(),
phoneNumber: z.string().optional(),
})
.optional(),
})
export const chatwootBlockSchema = blockBaseSchema.and(
z.object({
type: z.enum([IntegrationBlockType.CHATWOOT]),
options: chatwootOptionsSchema,
})
)
export const defaultChatwootOptions: ChatwootOptions = {
baseUrl: 'https://app.chatwoot.com',
websiteToken: '',
}
export type ChatwootBlock = z.infer<typeof chatwootBlockSchema>
export type ChatwootOptions = z.infer<typeof chatwootOptionsSchema>