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>

View File

@@ -5,3 +5,4 @@ export * from './answer'
export * from './utils'
export * from './credentials'
export * from './webhooks'
export * from './features/chatwoot'

View File

@@ -1,4 +1,8 @@
import { z } from 'zod'
import {
chatwootBlockSchema,
chatwootOptionsSchema,
} from '../../../features/chatwoot'
import {
googleAnalyticsOptionsSchema,
googleAnalyticsBlockSchema,
@@ -17,6 +21,7 @@ const integrationBlockOptionsSchema = googleSheetsOptionsSchema
.or(googleAnalyticsOptionsSchema)
.or(webhookOptionsSchema)
.or(sendEmailOptionsSchema)
.or(chatwootOptionsSchema)
export const integrationBlockSchema = googleSheetsBlockSchema
.or(googleAnalyticsBlockSchema)
@@ -25,6 +30,7 @@ export const integrationBlockSchema = googleSheetsBlockSchema
.or(zapierBlockSchema)
.or(makeComBlockSchema)
.or(pabblyConnectBlockSchema)
.or(chatwootBlockSchema)
export type IntegrationBlock = z.infer<typeof integrationBlockSchema>
export type IntegrationBlockOptions = z.infer<

View File

@@ -59,4 +59,5 @@ export enum IntegrationBlockType {
ZAPIER = 'Zapier',
MAKE_COM = 'Make.com',
PABBLY_CONNECT = 'Pabbly',
CHATWOOT = 'Chatwoot',
}