From 3971e4a888a97c2017ae243c903c981e9e592900 Mon Sep 17 00:00:00 2001 From: Baptiste Arnaud Date: Fri, 1 Mar 2024 16:24:36 +0100 Subject: [PATCH] :children_crossing: (whatsapp) Remove .mp4 regex restriction for video URLs Closes #1282 --- apps/docs/deploy/whatsapp/overview.mdx | 1 + .../bot-engine/whatsapp/convertMessageToWhatsAppMessage.ts | 5 +---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/apps/docs/deploy/whatsapp/overview.mdx b/apps/docs/deploy/whatsapp/overview.mdx index 09280ab30..e4779fd3f 100644 --- a/apps/docs/deploy/whatsapp/overview.mdx +++ b/apps/docs/deploy/whatsapp/overview.mdx @@ -19,6 +19,7 @@ You can preview and test your bot by clicking on the Preview button in the edito WhatsApp environment have some limitations that you need to keep in mind when building the bot: - GIF and SVG image files are not supported. They won't be displayed. +- Only .mp4 videos are supported (See [Supported Media Types](https://developers.facebook.com/docs/whatsapp/cloud-api/reference/media#supported-media-types) for more info). - Buttons content can't be longer than 20 characters. If the content is longer, it will be truncated. - WhatsApp only allows to display 3 buttons at a time. So we work around that by adding "..." messages to display more buttons. - Incompatible blocks, if present, they will be skipped: diff --git a/packages/bot-engine/whatsapp/convertMessageToWhatsAppMessage.ts b/packages/bot-engine/whatsapp/convertMessageToWhatsAppMessage.ts index b3c660997..7d7807cc6 100644 --- a/packages/bot-engine/whatsapp/convertMessageToWhatsAppMessage.ts +++ b/packages/bot-engine/whatsapp/convertMessageToWhatsAppMessage.ts @@ -5,8 +5,6 @@ import { BubbleBlockType } from '@typebot.io/schemas/features/blocks/bubbles/con import { VideoBubbleContentType } from '@typebot.io/schemas/features/blocks/bubbles/video/constants' import { convertRichTextToMarkdown } from '@typebot.io/lib/markdown/convertRichTextToMarkdown' -const mp4HttpsUrlRegex = /^https:\/\/.*\.mp4$/ - export const convertMessageToWhatsAppMessage = ( message: ContinueChatResponse['messages'][number] ): WhatsAppSendingMessage | undefined => { @@ -45,8 +43,7 @@ export const convertMessageToWhatsAppMessage = ( case BubbleBlockType.VIDEO: { if ( !message.content.url || - (message.content.type !== VideoBubbleContentType.URL && - isVideoUrlNotCompatible(message.content.url)) + message.content.type !== VideoBubbleContentType.URL ) return return {