skailan-conversations
Version:
Servicio de conversaciones y mensajería para Skailan
63 lines • 1.88 kB
TypeScript
import { Message } from "../entities/Message";
import { Conversation } from "../entities/Conversation";
export interface ChannelMessage {
id: string;
from: string;
to: string;
type: "text" | "image" | "video" | "audio" | "document" | "location" | "contact";
content: string;
mediaUrl?: string;
timestamp: Date;
metadata?: Record<string, any>;
}
export interface ChannelContact {
id: string;
name?: string;
phone?: string;
email?: string;
externalId: string;
metadata?: Record<string, any>;
}
export interface SendMessageRequest {
organizationId: string;
conversationId: string;
channelId: string;
to: string;
content: string;
type?: "text" | "image" | "video" | "audio" | "document";
mediaUrl?: string;
options?: Record<string, any>;
}
export interface ChannelConfig {
[key: string]: any;
}
export interface IChannelService {
/**
* Procesa un mensaje entrante del canal
*/
processIncomingMessage(organizationId: string, channelId: string, message: ChannelMessage): Promise<{
conversation: Conversation;
message: Message;
}>;
/**
* Envía un mensaje a través del canal
*/
sendMessage(request: SendMessageRequest): Promise<Message>;
/**
* Valida la configuración del canal
*/
validateConfig(config: ChannelConfig): Promise<boolean>;
/**
* Obtiene información del contacto desde el canal
*/
getContactInfo(organizationId: string, channelId: string, contactId: string): Promise<ChannelContact>;
/**
* Verifica la autenticidad del webhook
*/
verifyWebhook(payload: any, signature: string, config: ChannelConfig): Promise<boolean>;
/**
* Obtiene el tipo de canal que maneja este servicio
*/
getChannelType(): string;
}
//# sourceMappingURL=IChannelService.d.ts.map