diff --git a/src/api/integrations/chatbot/typebot/services/typebot.service.ts b/src/api/integrations/chatbot/typebot/services/typebot.service.ts index 5cf35c32..bf52e963 100644 --- a/src/api/integrations/chatbot/typebot/services/typebot.service.ts +++ b/src/api/integrations/chatbot/typebot/services/typebot.service.ts @@ -9,6 +9,16 @@ import axios from 'axios'; import { BaseChatbotService } from '../../base-chatbot.service'; import { OpenaiService } from '../../openai/services/openai.service'; +interface RichTextNode { + text?: string; + type?: string; + children?: RichTextNode[]; + bold?: boolean; + italic?: boolean; + underline?: boolean; + url?: string; +} + export class TypebotService extends BaseChatbotService { private openaiService: OpenaiService; @@ -196,9 +206,8 @@ export class TypebotService extends BaseChatbotService { /** * Apply rich text formatting for TypeBot messages */ - private applyFormatting(element: any): string { - if (typeof element === 'string') return element; - if (!element) return ''; + private applyFormatting(element: string | RichTextNode | undefined): string { + if (!element || typeof element === 'string') return element || ''; let text = '';