Integration
The Integration service provides CRUD capabilities for integration templates and integration instances (UserKey). It wraps the cloud API (
tcb2018-06-08), and every request carriesBusiness='integration'.Access it via
manager.integration, for example:const { integration } = new CloudBase({secretId: 'Your SecretId',secretKey: 'Your SecretKey',envId: 'Your envId' // Cloud Development environment ID, available in the Tencent Cloud Base console})NoteThis service is a thin wrapper over the cloud API: it does not interpret template fields, does not encrypt/decrypt sensitive fields, and does not perform orchestration such as "binding resources". The template structure, encryption keys, and upper-layer interactions are handled by the caller (CLI / console); the caller assembles the final configuration into the
ExtJSON string.
listTemplates
1. Description
Function: Get the list of integration templates (UserKey templates)
Declaration: listTemplates(params?: IListTemplatesParams): Promise<IGetUserKeyTemplateListResult>
2. Input Parameters
IListTemplatesParams
| Field | Required | Type | Description |
|---|---|---|---|
| offset | No | Number | Offset, default 0 |
| limit | No | Number | Limit, default 100 |
| authTypeCode | No | String | Filter by auth type code |
| authTypeName | No | String | Filter by auth type name |
| business | No | String | Business type; pass integration for the integration center |
3. Response
IGetUserKeyTemplateListResult
| Field | Required | Type | Description |
|---|---|---|---|
| RequestId | No | String | Unique request ID |
| TotalCount | Yes | Number | Total templates |
| KeyTemplateList | Yes | Array<IUserKeyTemplate> | Template list |
IUserKeyTemplate
| Field | Required | Type | Description |
|---|---|---|---|
| AuthTypeCode | Yes | String | Auth type code (template key) |
| AuthTypeName | Yes | String | Auth type name (template display name) |
| Ext | Yes | String | Template dynamic info as JSON string, includes fields definitions |
| AuthURL | No | String | Auth URL (for OAuth-type templates) |
| Icon | No | String | Template icon |
| State | No | String | Status |
| RedirectURI | No | String | Redirect URI |
4. Example
const res = await integration.listTemplates({
limit: 20,
business: 'integration'
})
console.log(res.KeyTemplateList)
listUserKeys
1. Description
Function: Get the list of integration instances (UserKey)
Declaration: listUserKeys(params?: IListUserKeysParams): Promise<IGetUserKeyListResult>
2. Input Parameters
IListUserKeysParams
| Field | Required | Type | Description |
|---|---|---|---|
| name | No | String | Filter by name (fuzzy match) |
| authTypeCode | No | String | Filter by auth type code |
| offset | No | Number | Offset, default 0 |
| limit | No | Number | Limit, default 100 |
| business | No | String | Business type; pass integration for the integration center |
3. Response
IGetUserKeyListResult
| Field | Required | Type | Description |
|---|---|---|---|
| RequestId | No | String | Unique request ID |
| TotalCount | Yes | Number | Total instances |
| UserKeyList | Yes | Array<IUserKeyInfo> | Instance list |
IUserKeyInfo
| Field | Required | Type | Description |
|---|---|---|---|
| Name | Yes | String | Integration instance name |
| KeyID | Yes | String | Integration instance ID (unique) |
| AuthTypeCode | Yes | String | Auth type code |
| AuthTypeName | Yes | String | Auth type name |
| Ext | Yes | String | Config JSON string (contains encrypted sensitive values) |
| Description | No | String | Description |
| Status | No | String | Status |
| TicketID | No | String | OAuth-type auth ticket id |
| DemoCodeFunctionName | No | String | Bound sample code cloud function name |
| BindServiceList | No | Object | Bound service list (grouped by Mcp / Apis / Other) |
| CreateAt | No | String | Creation time (ISO 8601) |
| UpdateAt | No | String | Update time (ISO 8601) |
4. Example
const res = await integration.listUserKeys({
name: 'my-key',
business: 'integration'
})
console.log(res.UserKeyList)
getUserKey
1. Description
Function: Get a single integration instance
Declaration: getUserKey(params: IGetUserKeyParams): Promise<IGetOneUserKeyResult>
2. Input Parameters
IGetUserKeyParams
| Field | Required | Type | Description |
|---|---|---|---|
| keyId | Yes | String | Integration instance ID |
| needPwd | No | Boolean | When true, returns the encrypted value of sensitive fields; default false |
| business | No | String | Business type; pass integration for the integration center |
3. Response
IGetOneUserKeyResult
| Field | Required | Type | Description |
|---|---|---|---|
| RequestId | No | String | Unique request ID |
| UserKeyInfo | Yes | IUserKeyInfo | Integration instance detail |
See listUserKeys for the
UserKeyInfofield definitions.
4. Example
const res = await integration.getUserKey({
keyId: 'my-key-id',
business: 'integration'
})
console.log(res.UserKeyInfo)
createUserKey
1. Description
Function: Create an integration instance
Declaration: createUserKey(params: ICreateUserKeyParams): Promise<ICreateUserKeyResult>
extis the final JSON string written to the backend. The caller assembles it from template fields (including encrypted sensitive fields); the SDK does not parse or modify it and passes it to the cloud API as-is.
2. Input Parameters
ICreateUserKeyParams
| Field | Required | Type | Description |
|---|---|---|---|
| name | Yes | String | Integration instance name |
| authTypeCode | Yes | String | Auth type code |
| description | No | String | Description |
| ext | No | String | Config JSON string (contains encrypted sensitive values) |
| keyId | No | String | Specify the instance ID (generated by backend if omitted) |
| ticketId | No | String | OAuth-type auth ticket id |
| demoCodeFunctionName | No | String | Bound sample code cloud function name |
| runtimeConfig | No | Record<string, any> | Agent cloud function config |
| business | No | String | Business type; pass integration for the integration center |
3. Response
ICreateUserKeyResult
| Field | Required | Type | Description |
|---|---|---|---|
| RequestId | No | String | Unique request ID |
| CreateResult | Yes | Number | Create result (0 means success) |
| DemoCodeFunctionName | No | String | Sample code cloud function name |
4. Example
const res = await integration.createUserKey({
name: 'my-payment',
authTypeCode: 'weixinpaydc',
ext: JSON.stringify({ appId: 'xxx', secret: 'encrypted-value' }),
business: 'integration'
})
console.log(res)
updateUserKey
1. Description
Function: Update an integration instance
Declaration: updateUserKey(params: IUpdateUserKeyParams): Promise<IUpdateUserKeyResult>
The caller is responsible for merging
extwith the existing value before passing it. Ifextis omitted, the backend keeps the existingExtunchanged.
2. Input Parameters
IUpdateUserKeyParams
| Field | Required | Type | Description |
|---|---|---|---|
| keyId | Yes | String | Integration instance ID |
| name | No | String | Integration instance name |
| authTypeCode | No | String | Auth type code |
| description | No | String | Description |
| ext | No | String | Config JSON string (contains encrypted sensitive values) |
| demoCodeFunctionName | No | String | Bound sample code cloud function name (used by bind-resource) |
| runtimeConfig | No | Record<string, any> | Agent cloud function config |
| business | No | String | Business type; pass integration for the integration center |
3. Response
IUpdateUserKeyResult
| Field | Required | Type | Description |
|---|---|---|---|
| RequestId | No | String | Unique request ID |
| UpdateResult | Yes | Number | Update result (0 means success) |
4. Example
const res = await integration.updateUserKey({
keyId: 'my-key-id',
description: 'updated description',
business: 'integration'
})
console.log(res)
deleteUserKey
1. Description
Function: Delete an integration instance
Declaration: deleteUserKey(params: IDeleteUserKeyParams): Promise<IDeleteUserKeyResult>
2. Input Parameters
IDeleteUserKeyParams
| Field | Required | Type | Description |
|---|---|---|---|
| keyId | Yes | String | Integration instance ID |
3. Response
IDeleteUserKeyResult
| Field | Required | Type | Description |
|---|---|---|---|
| RequestId | No | String | Unique request ID |
| DeleteResult | Yes | Number | Delete result (0 means success) |
4. Example
const res = await integration.deleteUserKey({
keyId: 'my-key-id'
})
console.log(res)