weixin-ts / bot/src / WeixinBotOptions
Interface: WeixinBotOptions
Defined in: bot/src/types.ts:259
Configuration options for the WeixinBot client
Properties
apiTimeoutMs?
optionalapiTimeoutMs?:number
Defined in: bot/src/types.ts:273
Regular API timeout in ms
Default
15000appId?
optionalappId?:string
Defined in: bot/src/types.ts:267
iLink App ID
baseUrl?
optionalbaseUrl?:string
Defined in: bot/src/types.ts:263
API base URL
Default
'https://ilinkai.weixin.qq.com'cdnBaseUrl?
optionalcdnBaseUrl?:string
Defined in: bot/src/types.ts:265
CDN base URL
Default
'https://novac2c.cdn.weixin.qq.com/c2c'debug?
optionaldebug?: (...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
const bot = new WeixinBot({ debug: console.debug })longPollTimeoutMs?
optionallongPollTimeoutMs?:number
Defined in: bot/src/types.ts:271
Long-poll timeout in ms
Default
35000session?
optionalsession?: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
import { WeixinBot } from '@weixin-ts/bot'
import { fileSession } from '@weixin-ts/bot/node'
const bot = new WeixinBot({
session: fileSession('.weixin-bot.session.json'),
})token?
optionaltoken?:string
Defined in: bot/src/types.ts:261
Bot authentication token (can be obtained via login())
version?
optionalversion?:string
Defined in: bot/src/types.ts:269
Client version string (e.g. '1.0.0')