/** * Interface for a text message. * @interface */ interface TextPayload { /** * Payload of the text message. */ message?: string; } /** * General interface for any Button. * @interface */ interface ButtonModel { name: string; request: { type: "open_url"; payload: { url: string; }; } | { type: "text"; payload: { message: string; }; }; } /** * Interface for a choice message with buttons. * @interface */ interface ChoicePayload { /** * Payload of the choice message. */ buttons: ButtonModel[]; } /** * Interface for an image message. * @interface */ interface ImagePayload { /** * Payload of the image message. */ image: string; } /** * Interface for a card message with buttons. * @interface */ interface CardPayload { /** * Payload of the card message. */ imageUrl?: string; title: string; description?: { text: string; }; buttons?: ButtonModel[]; } /** * Interface for a carousel payload containing an array of cards. * @interface */ interface CarouselPayload { cards: CardPayload[]; } type MessageType = "text" | "choice" | "visual" | "cardV2" | "carousel"; interface Message { type: MessageType; payload: TextPayload | ChoicePayload | ImagePayload | CardPayload | CarouselPayload; } type FinalResponse = Message[];