Skip to content

weixin-ts / bot/src / WeixinBotOptions

Interface: WeixinBotOptions ​

Defined in: bot/src/types.ts:259

Configuration options for the WeixinBot client

Properties ​

apiTimeoutMs? ​

optional apiTimeoutMs?: number

Defined in: bot/src/types.ts:273

Regular API timeout in ms

Default ​

ts
15000

appId? ​

optional appId?: string

Defined in: bot/src/types.ts:267

iLink App ID


baseUrl? ​

optional baseUrl?: string

Defined in: bot/src/types.ts:263

API base URL

Default ​

ts
'https://ilinkai.weixin.qq.com'

cdnBaseUrl? ​

optional cdnBaseUrl?: string

Defined in: bot/src/types.ts:265

CDN base URL

Default ​

ts
'https://novac2c.cdn.weixin.qq.com/c2c'

debug? ​

optional debug?: (...args) => void

Defined in: bot/src/types.ts:304

Optional debug logger for diagnosing CDN upload and internal operations. When set, detailed upload request/response info is logged via this callback.

Parameters ​

args ​

...unknown[]

Returns ​

void

Example ​

ts
const bot = new WeixinBot({ debug: console.debug })

longPollTimeoutMs? ​

optional longPollTimeoutMs?: number

Defined in: bot/src/types.ts:271

Long-poll timeout in ms

Default ​

ts
35000

session? ​

optional session?: SessionStorage

Defined in: bot/src/types.ts:294

Session persistence storage.

The main package is runtime-agnostic and only accepts a SessionStorage object. For file-based storage in Node.js, import fileSession from @weixin-ts/bot/node.

When set, token is automatically saved after login and loaded on next start. The session is automatically deleted when the server reports expiry.

Example ​

ts
import { WeixinBot } from '@weixin-ts/bot'
import { fileSession } from '@weixin-ts/bot/node'

const bot = new WeixinBot({
  session: fileSession('.weixin-bot.session.json'),
})

token? ​

optional token?: string

Defined in: bot/src/types.ts:261

Bot authentication token (can be obtained via login())


version? ​

optional version?: string

Defined in: bot/src/types.ts:269

Client version string (e.g. '1.0.0')

Released under the MIT License.