import type { ResolvedWechatMpAccount, WechatMpActiveDeliveryMode, WechatMpReplyMode, TemplateDataField, MediaMessageParams, RetryConfig, TimeWindowConfig, SendCapabilityResult } from "./types.js"; export type PassiveReplyResult = { ok: boolean; body?: string; error?: string; }; export type ActiveSendResult = { ok: boolean; msgid?: string; error?: string; }; export declare function buildPassiveTextReply(params: { account: ResolvedWechatMpAccount; toUserName: string; fromUserName: string; content: string; timestamp?: string; nonce?: string; }): PassiveReplyResult; export declare function sendWechatMpActiveText(params: { account: ResolvedWechatMpAccount; toUserName: string; text: string; /** Optional retry configuration; if provided, enables retry on transient errors */ retryConfig?: RetryConfig; }): Promise; export declare function resolveReplyMode(account: ResolvedWechatMpAccount): WechatMpReplyMode; export declare function resolveActiveDeliveryMode(account: ResolvedWechatMpAccount): WechatMpActiveDeliveryMode; export interface SendTemplateParams { templateId: string; data: Record; url?: string; miniprogram?: { appid: string; pagepath?: string; }; } /** * Send template message via WeChat MP template message API * https://developers.weixin.qq.com/doc/offiaccount/Message_management/Template_message_interface.html */ export declare function sendWechatMpActiveTemplate(params: { account: ResolvedWechatMpAccount; toUserName: string; template: SendTemplateParams; /** Optional retry configuration; if provided, enables retry on transient errors */ retryConfig?: RetryConfig; }): Promise; /** * Send media message (image/voice/video) via WeChat MP customer service API * Workflow: Upload media -> Get media_id -> Send message */ export declare function sendWechatMpActiveMedia(params: { account: ResolvedWechatMpAccount; toUserName: string; media: MediaMessageParams; /** Optional retry configuration; if provided, enables retry on transient errors */ retryConfig?: RetryConfig; }): Promise; /** * Determine if a WeChat error should be retried */ export declare function shouldRetryWechatError(error: unknown, attempt: number, maxRetries?: number): boolean; /** * Default retry configuration */ export declare const DEFAULT_RETRY_CONFIG: Required; /** * Resolve retry configuration from account config */ export declare function resolveRetryConfig(account: ResolvedWechatMpAccount): Required; /** * Execute a send operation with retry logic * * @param fn The async function to execute * @param retryConfig Retry configuration options * @returns Promise with the result of the function * * @example * ```ts * const result = await sendWithRetry( * () => sendSingleMessage(account, toUserName, text), * { maxRetries: 3, initialDelay: 1000 } * ); * ``` */ export declare function sendWithRetry(fn: () => Promise, retryConfig?: RetryConfig): Promise; /** * Check if a user is within the 48h interaction window for active messaging. * * WeChat MP requires that users have interacted with the official account * within the last 48 hours to receive customer service messages. * * @param account The resolved account * @param openId The user's openId * @returns true if the user can receive active messages */ export declare function canSendToUser(account: ResolvedWechatMpAccount, openId: string): Promise; /** * Check if current time is within allowed time window. * * Supports three modes: * - 'always': No time restriction (returns true) * - 'business': 9:00-18:00 on weekdays * - 'custom': User-defined hour ranges * * @param config Time window configuration (defaults to 'always') * @returns true if current time is within allowed window */ export declare function isInTimeWindow(config?: TimeWindowConfig): boolean; /** * Probe send capability without actually sending a message. * * Checks: * 1. Account is configured for active sending (canSendActive) * 2. User is within 48h interaction window * 3. (Optional) Current time is within allowed time window * * @param account The resolved account * @param openId The user's openId * @param timeWindowConfig Optional time window configuration * @returns Detailed capability result */ export declare function probeSendCapability(account: ResolvedWechatMpAccount, openId: string, timeWindowConfig?: TimeWindowConfig): Promise; //# sourceMappingURL=send.d.ts.map