skailan-conversations
Version:
Servicio de conversaciones y mensajería para Skailan
92 lines • 2.87 kB
TypeScript
import { IChannelRepository } from "../repositories/IChannelRepository";
import { Channel } from "../entities/Channel";
export interface ChannelConfig {
telegram?: {
botToken: string;
webhookUrl?: string;
botUsername?: string;
autoResponse?: boolean;
welcomeMessage?: string;
};
whatsapp?: {
phoneNumberId: string;
accessToken: string;
webhookVerifyToken?: string;
};
email?: {
smtpHost: string;
smtpPort: number;
username: string;
password: string;
};
}
export interface CreateChannelConfigRequest {
organizationId: string;
type: "telegram" | "whatsapp" | "email";
config: ChannelConfig;
status?: string;
}
export interface UpdateChannelConfigRequest {
id: string;
organizationId: string;
config?: ChannelConfig;
status?: string;
}
export declare class ChannelConfigurationService {
private channelRepository;
constructor(channelRepository: IChannelRepository);
/**
* Crea una nueva configuración de canal
*/
createChannelConfig(request: CreateChannelConfigRequest): Promise<Channel>;
/**
* Actualiza la configuración de un canal existente
*/
updateChannelConfig(request: UpdateChannelConfigRequest): Promise<Channel>;
/**
* Obtiene la configuración de un canal específico
*/
getChannelConfig(channelId: string, organizationId: string): Promise<Channel | null>;
/**
* Obtiene todas las configuraciones de canales de una organización
*/
getAllChannelConfigs(organizationId: string): Promise<Channel[]>;
/**
* Obtiene la configuración de Telegram para una organización
*/
getTelegramConfig(organizationId: string): Promise<Channel | null>;
/**
* Configura específicamente un canal de Telegram
*/
configureTelegramChannel(organizationId: string, botToken: string, options?: {
webhookUrl?: string;
botUsername?: string;
autoResponse?: boolean;
welcomeMessage?: string;
}): Promise<Channel>;
/**
* Valida la configuración de un canal según su tipo
*/
private validateChannelConfig;
/**
* Valida la configuración específica de Telegram
*/
private validateTelegramConfig;
/**
* Valida la configuración específica de WhatsApp
*/
private validateWhatsAppConfig;
/**
* Valida la configuración específica de Email
*/
private validateEmailConfig;
/**
* Elimina la configuración de un canal
*/
deleteChannelConfig(channelId: string, organizationId: string): Promise<void>;
/**
* Verifica si un canal está activo
*/
isChannelActive(channelId: string, organizationId: string): Promise<boolean>;
}
//# sourceMappingURL=ChannelConfigurationService.d.ts.map