cecon-interfaces
Version:
Interfaces de Projetos Cecon
78 lines (77 loc) • 2.21 kB
TypeScript
import { IN8nChatApiCallback } from '../interfaces/i-chat-api-callback';
import { IN8nChatResponse } from '../interfaces/i-chat-response';
export declare class N8nChatResponseEntity implements IN8nChatResponse {
responseId: string;
originalMessageId: string;
sessionId: string;
userId: string;
message: string;
messageType: 'text' | 'image' | 'audio' | 'video' | 'document' | 'template' | 'quick_reply' | 'button';
timestamp: Date;
platform: string;
responseData?: {
buttons?: Array<{
id: string;
text: string;
type: 'reply' | 'url' | 'call';
payload?: string;
url?: string;
phoneNumber?: string;
apiCallback?: IN8nChatApiCallback;
}>;
quickReplies?: Array<{
id: string;
text: string;
payload?: string;
apiCallback?: IN8nChatApiCallback;
}>;
template?: {
type: string;
elements: any[];
};
media?: {
url: string;
type: string;
caption?: string;
filename?: string;
};
};
delivery: {
priority: 'low' | 'normal' | 'high';
delay?: number;
retryAttempts?: number;
};
metadata?: {
automated: boolean;
botName?: string;
workflowId?: string;
nodeId?: string;
};
status: 'queued' | 'sent' | 'delivered' | 'read' | 'failed';
constructor(data?: Partial<N8nChatResponseEntity>);
/**
* Adiciona um botão com callback de API opcional
*/
addButton(button: {
id: string;
text: string;
type: 'reply' | 'url' | 'call';
payload?: string;
url?: string;
phoneNumber?: string;
apiCallback?: IN8nChatApiCallback;
}): void;
/**
* Adiciona uma resposta rápida com callback de API opcional
*/
addQuickReply(quickReply: {
id: string;
text: string;
payload?: string;
apiCallback?: IN8nChatApiCallback;
}): void;
/**
* Valida se a resposta está pronta para ser enviada
*/
isValid(): boolean;
}