Couchbase
Run N1QL queries and upsert documents in Couchbase.
On this page
Connect
Auth type: Credentials form (custom_auth). Pass the fields the provider needs (listed below) as the connection's credentials. They are sealed at rest.
| Field | Type | Description |
|---|---|---|
connectionStringrequired | text | Couchbase connection string (e.g. couchbase://localhost) |
usernamerequired | text | Cluster username |
passwordrequired | secret | Cluster password |
bucketNamerequired | text | Default bucket to operate on |
- From your agent: integrations {action: "connect", piece, credentials, env} stores the credentials for dev, prod or all. Answers name the fields, never the values.
- Or set the integration's project secrets with the secrets tool (SLACK_BOT_TOKEN, DISCORD_WEBHOOK_URL, TELEGRAM_BOT_TOKEN, TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN …): a call uses the connection, else those secrets. integrations {action: "catalog", piece} lists which ones work.
- Try one action now with integrations {action: "call", piece, piece_action, input}. It really sends.
Call it from a workflow
step.ctx.integrations.invoke("couchbase", action, input) resolves with the provider's answer and rejects when Couchbase isn't connected or refuses. Wrap it in step.run so a retry sends once. See step.ctx. Its actions run through the integration runner, which the server's operator turns on: integrations {action: "catalog", piece: "couchbase"} says whether yours can call it.
// workflows/notify.ts: call Couchbase when a booking is confirmed
import { on } from "@appbricx/workflows";
export const tellCouchbase = on.transition("booking", "status", "confirmed", async (_event, step) => {
// Recorded once: a retry doesn't send it twice. Rejects when Couchbase isn't connected.
const output = await step.run("Couchbase", () =>
step.ctx.integrations.invoke("couchbase", "upsert_document", {
"bucket": "<bucket>",
"document": {}
}),
);
step.ctx.log("Couchbase answered", output);
});{
"name": "integrations",
"arguments": {
"project_id": "<project-id>",
"action": "call",
"piece": "couchbase",
"piece_action": "upsert_document",
"input": {
"bucket": "<bucket>",
"document": {}
},
"env": "dev"
}
}curl -X POST "$APP_ORIGIN/__appbricx/connector-proxy/couchbase/upsert_document" \
-H "Authorization: Bearer $APP_KEY" \
-H "content-type: application/json" \
-d '{"props":{"bucket":"<bucket>","document":{}}}'Actions
upsert_document
Upsert Document. Create or update a document. Creates if it doesn't exist, updates if it does.
| Input | Type | Description |
|---|---|---|
bucketrequired | id (picked from your account) | Select the bucket |
scopeoptional | id (picked from your account) | Select the scope (leave empty for default) |
collectionoptional | id (picked from your account) | Select the collection (leave empty for default) |
documentIdoptional | text | Unique identifier for the document. Leave empty to auto-generate. |
documentrequired | JSON | The JSON document to store |
expiryoptional | number | Document expiration time in seconds. Leave empty for no expiry. |
durabilityLeveloptional | one of "0" | "1" | "2" | "3" | How durable the write should be before returning success |
timeoutoptional | number | Operation timeout in milliseconds |
delete_document
Delete Document. Remove a document by its ID
| Input | Type | Description |
|---|---|---|
bucketrequired | id (picked from your account) | Select the bucket |
scopeoptional | id (picked from your account) | Select the scope (leave empty for default) |
collectionoptional | id (picked from your account) | Select the collection (leave empty for default) |
documentIdrequired | id (picked from your account) | Select an existing document or type a custom ID |
durabilityLeveloptional | one of "0" | "1" | "2" | "3" | How durable the write should be before returning success |
timeoutoptional | number | Operation timeout in milliseconds |
get_document
Get Document. Retrieve a document by its ID
| Input | Type | Description |
|---|---|---|
bucketrequired | id (picked from your account) | Select the bucket |
scopeoptional | id (picked from your account) | Select the scope (leave empty for default) |
collectionoptional | id (picked from your account) | Select the collection (leave empty for default) |
documentIdrequired | id (picked from your account) | Select an existing document or type a custom ID |
timeoutoptional | number | Operation timeout in milliseconds |
insert_document
Insert Document. Create a new document. Fails if document already exists.
| Input | Type | Description |
|---|---|---|
bucketrequired | id (picked from your account) | Select the bucket |
scopeoptional | id (picked from your account) | Select the scope (leave empty for default) |
collectionoptional | id (picked from your account) | Select the collection (leave empty for default) |
documentIdoptional | text | Unique identifier for the document. Leave empty to auto-generate. |
documentrequired | JSON | The JSON document to store |
expiryoptional | number | Document expiration time in seconds. Leave empty for no expiry. |
durabilityLeveloptional | one of "0" | "1" | "2" | "3" | How durable the write should be before returning success |
timeoutoptional | number | Operation timeout in milliseconds |
query
Execute SQL++ Query. Run a SQL++ (N1QL) query with optional vector search filters
| Input | Type | Description |
|---|---|---|
bucketrequired | id (picked from your account) | Select the bucket |
scopeoptional | id (picked from your account) | Select the scope (leave empty for default) |
queryrequired | long text | SELECT statement with optional positional parameters ($1, $2, etc.). Do not include LIMIT or OFFSET. |
argumentsoptional | array | Values for positional parameters ($1, $2, etc.) in the query |
vectorFiltersoptional | array | Filter results by vector similarity (requires vector index) |
vectorOrderoptional | array | Order results by vector similarity (requires vector index) |
limitoptional | number | Maximum number of results to return |
offsetoptional | number | Number of results to skip |
scanConsistencyoptional | one of "not_bounded" | "request_plus" | Query consistency level |
timeoutoptional | number | Operation timeout in milliseconds |
Details
- Id
couchbase- Category
- Data and storage
- Tags
- database, nosql, document, distributed
- Package
@activepieces/piece-couchbase@0.1.4- Runs
- Through the integration runner