Skip to content

KMsgRoutingConfig

Defined in: packages/messaging/src/k-msg.ts:67

Configuration for routing messages to specific providers.

Controls how KMsg selects which provider to use for each message type. Routing is resolved in this order: explicit providerId > byType mapping > defaultProviderId > first provider that supports the message type.

const routing: KMsgRoutingConfig = {
defaultProviderId: 'solapi',
byType: {
ALIMTALK: 'iwinv',
SMS: ['solapi', 'iwinv'],
},
strategy: 'round_robin',
};

optional byType?: Partial<Record<MessageType, string | string[]>>

Defined in: packages/messaging/src/k-msg.ts:73

Map of message types to provider IDs. Can be a single provider ID or an array for load balancing. When an array is provided, the strategy determines which provider is selected.


optional defaultProviderId?: string

Defined in: packages/messaging/src/k-msg.ts:79

Default provider ID to use when no type-specific routing is configured and no explicit providerId is provided in the send options.


optional strategy?: RoutingStrategy

Defined in: packages/messaging/src/k-msg.ts:85

Strategy for selecting from multiple providers when byType contains an array.

"first"