2
0

🚸 (whatsapp) Avoid multiple replies to be sent concurently

Closes #972, closes #1453
This commit is contained in:
Baptiste Arnaud
2024-04-18 09:38:22 +02:00
parent 94539e8ed3
commit 7bec58e745
12 changed files with 84 additions and 21 deletions

View File

@ -28,13 +28,20 @@ import { preprocessTypebot } from '../typebot/helpers/preprocessTypebot'
import { typebotV5Schema, typebotV6Schema } from '../typebot/typebot'
import { BubbleBlockType } from '../blocks/bubbles/constants'
import { clientSideActionSchema } from './clientSideAction'
import { ChatSession as ChatSessionFromPrisma } from '@typebot.io/prisma'
const chatSessionSchema = z.object({
id: z.string(),
createdAt: z.date(),
updatedAt: z.date(),
state: sessionStateSchema,
})
isReplying: z
.boolean()
.nullable()
.describe(
'Used in WhatsApp runtime to avoid concurrent replies from the bot'
),
}) satisfies z.ZodType<ChatSessionFromPrisma, z.ZodTypeDef, unknown>
export type ChatSession = z.infer<typeof chatSessionSchema>
const textMessageSchema = z