2
0

(whatsapp) Improve / fix markdown serializer

Forked remark-slate code to create Typebot's own serializer

Closes #1056
This commit is contained in:
Baptiste Arnaud
2024-01-08 08:40:25 +01:00
parent 7d6c964a0f
commit 244a29423b
11 changed files with 629 additions and 88 deletions

View File

@ -1,9 +1,9 @@
import { ContinueChatResponse } from '@typebot.io/schemas'
import { WhatsAppSendingMessage } from '@typebot.io/schemas/features/whatsapp'
import { convertRichTextToWhatsAppText } from './convertRichTextToWhatsAppText'
import { isSvgSrc } from '@typebot.io/lib/utils'
import { BubbleBlockType } from '@typebot.io/schemas/features/blocks/bubbles/constants'
import { VideoBubbleContentType } from '@typebot.io/schemas/features/blocks/bubbles/video/constants'
import { convertRichTextToMarkdown } from '@typebot.io/lib/serializer/convertRichTextToMarkdown'
const mp4HttpsUrlRegex = /^https:\/\/.*\.mp4$/
@ -17,7 +17,9 @@ export const convertMessageToWhatsAppMessage = (
return {
type: 'text',
text: {
body: convertRichTextToWhatsAppText(message.content.richText),
body: convertRichTextToMarkdown(message.content.richText, {
flavour: 'whatsapp',
}),
},
}
}