import { BaseChannel } from './index'; /** * WeChat Official Account Channel — v1.0.0 * * Handles: * - GET verification (signature/timestamp/nonce/echostr) * - POST XML message parsing and reply * - Customer Service Message API for async replies * - Access token management with caching * - Template messages * - Subscribe/unsubscribe events */ export interface WeChatChannelConfig { /** WeChat Official Account AppID */ appId: string; /** WeChat Official Account AppSecret */ appSecret: string; /** Verification token for message validation */ token: string; /** AES encoding key for encrypted messages (optional) */ encodingAESKey?: string; /** HTTP server port (default: 8080) */ port?: number; } export interface WeChatMessage { toUserName: string; fromUserName: string; createTime: number; msgType: 'text' | 'image' | 'voice' | 'video' | 'event'; content?: string; msgId?: string; event?: string; eventKey?: string; } export interface TemplateMessageData { toUser: string; templateId: string; url?: string; data: Record; } export declare class WeChatChannel extends BaseChannel { type: string; private config; private accessToken; private tokenExpiry; private server; constructor(config: WeChatChannelConfig); start(): Promise; stop(): Promise; /** Verify WeChat signature for GET requests */ private handleVerification; /** Handle incoming POST messages (XML) */ private handleIncoming; /** Verify WeChat signature */ verifySignature(signature: string, timestamp: string, nonce: string): boolean; /** Parse WeChat XML message using regex */ static parseXML(xml: string): WeChatMessage | null; /** Format response as WeChat XML */ static formatXMLResponse(toUser: string, fromUser: string, content: string): string; /** Handle incoming WeChat message */ handleMessage(wxMsg: WeChatMessage): Promise; /** Handle WeChat events */ private handleEvent; /** Convert WeChat message to internal Message */ private wechatToMessage; /** Get or refresh access token */ getAccessToken(): Promise; /** Send customer service message */ sendMessage(openId: string, text: string): Promise; /** Send template message */ sendTemplateMessage(data: TemplateMessageData): Promise; /** Read request body */ private readBody; /** Simple HTTPS GET */ private httpsGet; /** Simple HTTPS POST */ private httpsPost; } //# sourceMappingURL=wechat.d.ts.map