diff --git a/apps/docs/self-hosting/configuration.mdx b/apps/docs/self-hosting/configuration.mdx index e0f94f0db..c2de56179 100644 --- a/apps/docs/self-hosting/configuration.mdx +++ b/apps/docs/self-hosting/configuration.mdx @@ -245,6 +245,7 @@ In order to be able to test your bot on WhatsApp from the Preview drawer, you ne | WHATSAPP_PREVIEW_TEMPLATE_NAME | | The preview start template message name | | WHATSAPP_PREVIEW_TEMPLATE_LANG | en_US | The preview start template message name | | WHATSAPP_CLOUD_API_URL | https://graph.facebook.com | The WhatsApp Cloud API base URL | +| WHATSAPP_INTERACTIVE_GROUP_SIZE | 3 | The array size of items to send to API on choice input. You can't choose a number higher than 3 if you are using the official cloud API URL. | ## Others diff --git a/packages/bot-engine/whatsapp/convertInputToWhatsAppMessage.ts b/packages/bot-engine/whatsapp/convertInputToWhatsAppMessage.ts index 83f1d559e..0926fd99d 100644 --- a/packages/bot-engine/whatsapp/convertInputToWhatsAppMessage.ts +++ b/packages/bot-engine/whatsapp/convertInputToWhatsAppMessage.ts @@ -6,6 +6,7 @@ import { InputBlockType } from '@typebot.io/schemas/features/blocks/inputs/const import { defaultPictureChoiceOptions } from '@typebot.io/schemas/features/blocks/inputs/pictureChoice/constants' import { defaultChoiceInputOptions } from '@typebot.io/schemas/features/blocks/inputs/choice/constants' import { convertRichTextToMarkdown } from '@typebot.io/lib/markdown/convertRichTextToMarkdown' +import { env } from '@typebot.io/env' export const convertInputToWhatsAppMessages = ( input: NonNullable, @@ -110,7 +111,7 @@ export const convertInputToWhatsAppMessages = ( ] const items = groupArrayByArraySize( input.items.filter((item) => isDefined(item.content)), - 3 + env.WHATSAPP_INTERACTIVE_GROUP_SIZE ) as ButtonItem[][] return items.map((items, idx) => ({ type: 'interactive', diff --git a/packages/env/env.ts b/packages/env/env.ts index b13ab51a7..4faeade51 100644 --- a/packages/env/env.ts +++ b/packages/env/env.ts @@ -307,6 +307,7 @@ const whatsAppEnv = { .url() .optional() .default('https://graph.facebook.com'), + WHATSAPP_INTERACTIVE_GROUP_SIZE: z.coerce.number().optional().default(3), }, }