n8n
Version:
n8n Workflow Automation Tool
59 lines (58 loc) • 3.02 kB
TypeScript
import { AgentIntegrationConfig } from '@n8n/api-types';
import type { RichCardComponentType } from '@n8n/api-types';
import { Logger } from '@n8n/backend-common';
import { OutboundHttp, SsrfProtectionService } from '@n8n/backend-network';
import { SsrfProtectionConfig } from '@n8n/config';
import type { Thread, Author } from 'chat';
import { InstanceSettings } from 'n8n-core';
import { UrlService } from '../../../../services/url.service';
import { AgentRepository } from '../../repositories/agent.repository';
import { AgentChatIntegration, type AgentChatIntegrationContext, type BridgeExecutionContext, type BridgeMessageContextParams, type BridgeResumeExecutionContext } from '../agent-chat-integration';
import type { SuspendComponent } from '../component-mapper';
export declare class TelegramIntegration extends AgentChatIntegration {
private readonly logger;
private readonly urlService;
private readonly agentRepository;
private readonly instanceSettings;
private readonly outboundHttp;
private readonly ssrfConfig;
private readonly ssrfProtectionService;
readonly type = "telegram";
readonly credentialTypes: string[];
readonly displayLabel = "Telegram";
readonly displayIcon = "telegram";
readonly builderGuidance: {
capabilities: string[];
useIntegrationWhen: string[];
useNodeToolWhen: string[];
};
readonly supportedComponents: readonly RichCardComponentType[];
readonly actionToolDefinitions: import("../integration-tool-types").IntegrationActionDefinition[];
readonly needsShortCallbackData = true;
readonly disableStreaming = true;
readonly formatThreadId: {
fromSdk: (thread: Thread<unknown, unknown>) => string;
toSdk: (threadId: string) => string;
};
constructor(logger: Logger, urlService: UrlService, agentRepository: AgentRepository, instanceSettings: InstanceSettings, outboundHttp: OutboundHttp, ssrfConfig: SsrfProtectionConfig, ssrfProtectionService: SsrfProtectionService);
createAdapter(ctx: AgentChatIntegrationContext): Promise<unknown>;
requiresLeader(): boolean;
onBeforeConnect(ctx: AgentChatIntegrationContext): Promise<void>;
onAfterConnect(ctx: AgentChatIntegrationContext): Promise<void>;
onBeforeDisconnect(ctx: AgentChatIntegrationContext): Promise<void>;
isUserAllowed(author: Author, integration: AgentIntegrationConfig | undefined): boolean;
createBridgeExecutionContext(params: BridgeMessageContextParams): Promise<BridgeExecutionContext>;
createResumeExecutionContext(params: {
thread: BridgeMessageContextParams['thread'];
logger: BridgeMessageContextParams['logger'];
agentId: string;
}): Promise<BridgeResumeExecutionContext>;
normalizeComponents(components: SuspendComponent[]): SuspendComponent[];
private getMode;
private deriveSecretToken;
private extractBotToken;
private botApiUrl;
private botApiRequest;
private isOkStatus;
private stringifyBody;
}