1
packages/models/features/chatwoot/index.ts
Normal file
1
packages/models/features/chatwoot/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './types'
|
||||
34
packages/models/features/chatwoot/types.ts
Normal file
34
packages/models/features/chatwoot/types.ts
Normal 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>
|
||||
@@ -5,3 +5,4 @@ export * from './answer'
|
||||
export * from './utils'
|
||||
export * from './credentials'
|
||||
export * from './webhooks'
|
||||
export * from './features/chatwoot'
|
||||
|
||||
@@ -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<
|
||||
|
||||
@@ -59,4 +59,5 @@ export enum IntegrationBlockType {
|
||||
ZAPIER = 'Zapier',
|
||||
MAKE_COM = 'Make.com',
|
||||
PABBLY_CONNECT = 'Pabbly',
|
||||
CHATWOOT = 'Chatwoot',
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user