Skip to main content

integrations

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.

PropertyValue
TypeArray<Integration>
DescriptionEach element describes the configuration of an integration (keyId, authTypeCode, envVariables, etc.)

Sub-fields​

FieldTypeRequiredDescription
keyIdStringYesUnique identifier of the integration instance, used to match an existing instance in the cloud; unique within an envId
nameStringNoIntegration instance name (display only); defaults to keyId when not set
authTypeCodeStringYesIntegration type code, determines which SCF template Integration Center deploys. Query available values with tcb integration types
descriptionStringNoIntegration instance description
envVariablesObjectNoIntegration-related credential-type env vars, managed by Integration Center (do not hard-code in business code)
demoCodeFunctionNameStringNoCloud function name to bind

Common authTypeCode Values​

ValueDescription
weixinpaydcWeixin Mini Program Pay
weixinpaynativeWeixin Native Pay
weixinpayjsapiWeixin JSAPI Web Pay
wxvirtualpayWeixin Virtual Payment
wechatoaWeixin Official Account
agentmp / agentpaAI 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 authTypeCode values 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:

SyntaxMeaning
@./certs/key.pemRelative path (relative to the directory where cloudbaserc.json is located)
@/absolute/path/key.pemAbsolute 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 create and tcb config update integration.
  • It is recommended to add key files to .gitignore to avoid committing sensitive credentials to the repository.