Quick Start
This article introduces how to use CloudBase CLI to quickly manage integration configurations.
What is an Integration
An integration is a capability provided by CloudBase that allows you to bind third-party services or custom business logic to cloud functions, enabling more flexible business scenarios.
Quick Experience
1. Install and Login to CLI
npm install -g @cloudbase/cli
tcb login
2. Query Available Integration Types (Optional)
If you don't know which integration types are available, you can query first:
# Query all available integration types
tcb integration types
# Filter by auth type code
tcb integration types --auth-type-code weixinpaydc
3. Initialize Integration Configuration (Optional)
If you want to manage integrations through configuration files, you can first initialize the integration configuration template:
# Interactively initialize the integration; the argument is the instance name
tcb config init integration stripe-test
# Specify the integration type
tcb config init integration stripe-test --type stripe-pay
# Set the keyId yourself
tcb config init integration stripe-test --keyid stripe-test-a1b2c3d4
After initialization, a cloudbaserc.json configuration file is generated with a keyId already derived from the instance name. You can edit this file to fill in specific configuration values, and then use tcb config update integration to push to the cloud.
Tip: Managing integrations through configuration files enables version control and team collaboration. If you just want to quickly try it out, you can skip to step 4 and use commands to create integrations.
4. Create an Integration
# Create integration from configuration file (interactive confirmation for batch creation)
tcb integration create
# Create only the given integration: the positional argument can be a name or a keyId (keyId is matched first)
tcb integration create stripe-test
# Skip confirmation, batch create all integrations in the configuration file
tcb integration create --yes
5. View Integration List
# View all integrations in the current environment
tcb integration list
# Output in JSON format
tcb integration list --json
6. Bind to Cloud Function
For ready-to-use cloud function template code (including WeChat Pay, Official Account OAuth, and other scenarios — with cloud function source, frontend sample, and minimal runnable demo), see Sample Projects & References and clone the official example projects before running the command below.
# Bind integration to cloud function
tcb integration bind-resource key-xxx --function my-function
7. View Integration Details
# Query by Key ID
tcb integration get key-xxx
8. Update Integration
Update integration configuration through configuration file:
# Edit the integrations configuration in cloudbaserc.json
# Then execute the following command to push to the cloud
tcb config update integration key-xxx
Tip: For more configuration update methods, see Push configuration.
9. Delete Integration
# Delete specified integration
tcb integration delete key-xxx
Common Commands
| Command | Description |
|---|---|
tcb integration types | Query available integration types |
tcb integration create | Create an integration |
tcb integration list | Query integration list |
tcb integration get | Query integration details |
tcb config update integration | Update integration configuration |
tcb integration bind-resource | Bind to cloud function |
tcb integration delete | Delete an integration |
Next Steps
- Create Integration - Learn detailed parameters for creating integrations
- Query Integration List - Learn how to query and filter integrations
- Bind to Cloud Function - Learn how to bind integrations to cloud functions