Hi @Baptiste I have adpated the code to my case. But it seems this function is not getting a tag as url. Fo sample, I have the next messages array attached. I am using the next code:
export const convertRichTextToWhatsAppText = (richText: TElement[]): string =>
richText
.map(chunk =>
serialize(chunk)?.replaceAll("*
", "").replaceAll("'", "'")
)
.join("\n");
export const convertMessageToWhatsAppMessage = (
message: any
): string | undefined => {
switch (message.type) {
case "text": {
if (!message.content.richText
message.content.richText.length === 0)
return undefined;
const txt = convertRichTextToWhatsAppText(message.content.richText);
console.log("txt", txt);
return txt;
}
case "image": {
if (!message.content.url
isImageUrlNotCompatible(message.content.url))
return undefined;
return message.content.url;
}
case "audio": {
if (!message.content.url) return undefined;
return message.content.url;
}
case "video": {
if (
!message.content.url ||
(message.content.type !== "url" &&
isVideoUrlNotCompatible(message.content.url))
)
return undefined;
return message.content.url;
}
case "embed": {
if (!message.content.url) return undefined;
return message.content.url;
}
}
return undefined;
};