Configuration File - Integration
The integrations field in cloudbaserc.json declares Integration Center configurations (Weixin Pay, Official Account, AI tools, etc.). Integration Center handles credential storage, callback verification, and signing as platform-side concerns, so your business code only consumes the SDK or HTTP surface.
| Property | Value |
|---|---|
| Type | Array<Integration> |
| Description | Each element describes the configuration of an integration (keyId, authTypeCode, envVariables, etc.) |
Sub-fields
| Field | Type | Required | Description |
|---|---|---|---|
keyId | String | Yes | Unique identifier of the integration instance, used to match an existing instance in the cloud; unique within an envId |
name | String | No | Integration instance name (display only); defaults to keyId when not set |
authTypeCode | String | Yes | Integration type code, determines which SCF template Integration Center deploys. Query available values with tcb integration types |
description | String | No | Integration instance description |
envVariables | Object | No | Integration-related credential-type env vars, managed by Integration Center (do not hard-code in business code) |
demoCodeFunctionName | String | No | Cloud function name to bind |
Common authTypeCode Values
| Value | Description |
|---|---|
weixinpaydc | Weixin Mini Program Pay |
weixinpaynative | Weixin Native Pay |
weixinpayjsapi | Weixin JSAPI Web Pay |
wechatoa | Weixin Official Account |
agentmp / agentpa | AI Agent (Mini Program / Official Account) |
envVariables Credential Fields
(fields vary by authTypeCode):
- Weixin Pay:
MCH_ID+API_KEY(or certificate) - Official Account:
APP_ID+APP_SECRET - For any given integration, see the console for the exact required fields
Some integrations support additional params via
authConfig(public key, callback URL allowlist, etc.); see the Integration Center console for details.For platform background, capability overview, and comparison with traditional integration, see Integration Center Overview; the latest available
authTypeCodevalues and fields are in the Integration Center console.
Example
{
"integrations": [
{
"keyId": "myPayment",
"authTypeCode": "weixinpaydc",
"envVariables": {
"MCH_ID": "1234567890",
"API_KEY": "your-api-key"
}
}
]
}
Read Field Values from a File (@ File Reference Syntax)
Some fields (such as WeChat Pay's privateKey, apiV3Key, etc.) are usually multi-line text or long sensitive content (e.g., PEM-format private keys). Writing them directly into JSON requires manually escaping line breaks as \n, which is tedious and error-prone.
The CLI supports using the @ prefix in envVariables values to reference a file directly. The file content is automatically read as the field value when creating or updating:
{
"integrations": [
{
"keyId": "key-abc123",
"authTypeCode": "weixinpaydc",
"envVariables": {
"appId": "wx1234567890",
"apiV3Key": "@./secrets/apiv3key.txt",
"privateKey": "@./secrets/apiclient_key.pem"
}
}
]
}
File reference syntax:
| Syntax | Meaning |
|---|---|
@./certs/key.pem | Relative path (relative to the directory where cloudbaserc.json is located) |
@/absolute/path/key.pem | Absolute path |
A plain string not starting with @ | Treated as a literal value (you must escape line breaks as \n yourself) |
Notes:
- BOM and leading/trailing whitespace are automatically stripped when reading file content, keeping formats like PEM clean.
- If the referenced file does not exist or cannot be read, the CLI will report an error and abort the operation. Please check that the path is correct.
- This syntax can be used in both
tcb integration createandtcb config update integration. - It is recommended to add key files to
.gitignoreto avoid committing sensitive credentials to the repository.
Related Commands
- Create Integration:
tcb integration create - Push Integration Configuration:
tcb config update integration - Initialize Integration Configuration:
tcb config init integration