Couchbase

Run N1QL queries and upsert documents in Couchbase.

Data and storageCredentials form5 actionsAll integrations

On this page
  1. Connect
  2. Call it from a workflow
  3. Actions (5)
  4. upsert_document
  5. delete_document
  6. get_document
  7. insert_document
  8. query
  9. Details

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.

FieldTypeDescription
connectionStringrequiredtextCouchbase connection string (e.g. couchbase://localhost)
usernamerequiredtextCluster username
passwordrequiredsecretCluster password
bucketNamerequiredtextDefault 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.

Workflow
// 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);
});
Try it from your agent
{
  "name": "integrations",
  "arguments": {
    "project_id": "<project-id>",
    "action": "call",
    "piece": "couchbase",
    "piece_action": "upsert_document",
    "input": {
      "bucket": "<bucket>",
      "document": {}
    },
    "env": "dev"
  }
}
From another backend (connector proxy)
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.

InputTypeDescription
bucketrequiredid (picked from your account)Select the bucket
scopeoptionalid (picked from your account)Select the scope (leave empty for default)
collectionoptionalid (picked from your account)Select the collection (leave empty for default)
documentIdoptionaltextUnique identifier for the document. Leave empty to auto-generate.
documentrequiredJSONThe JSON document to store
expiryoptionalnumberDocument expiration time in seconds. Leave empty for no expiry.
durabilityLeveloptionalone of "0" | "1" | "2" | "3"How durable the write should be before returning success
timeoutoptionalnumberOperation timeout in milliseconds

delete_document

Delete Document. Remove a document by its ID

InputTypeDescription
bucketrequiredid (picked from your account)Select the bucket
scopeoptionalid (picked from your account)Select the scope (leave empty for default)
collectionoptionalid (picked from your account)Select the collection (leave empty for default)
documentIdrequiredid (picked from your account)Select an existing document or type a custom ID
durabilityLeveloptionalone of "0" | "1" | "2" | "3"How durable the write should be before returning success
timeoutoptionalnumberOperation timeout in milliseconds

get_document

Get Document. Retrieve a document by its ID

InputTypeDescription
bucketrequiredid (picked from your account)Select the bucket
scopeoptionalid (picked from your account)Select the scope (leave empty for default)
collectionoptionalid (picked from your account)Select the collection (leave empty for default)
documentIdrequiredid (picked from your account)Select an existing document or type a custom ID
timeoutoptionalnumberOperation timeout in milliseconds

insert_document

Insert Document. Create a new document. Fails if document already exists.

InputTypeDescription
bucketrequiredid (picked from your account)Select the bucket
scopeoptionalid (picked from your account)Select the scope (leave empty for default)
collectionoptionalid (picked from your account)Select the collection (leave empty for default)
documentIdoptionaltextUnique identifier for the document. Leave empty to auto-generate.
documentrequiredJSONThe JSON document to store
expiryoptionalnumberDocument expiration time in seconds. Leave empty for no expiry.
durabilityLeveloptionalone of "0" | "1" | "2" | "3"How durable the write should be before returning success
timeoutoptionalnumberOperation timeout in milliseconds

query

Execute SQL++ Query. Run a SQL++ (N1QL) query with optional vector search filters

InputTypeDescription
bucketrequiredid (picked from your account)Select the bucket
scopeoptionalid (picked from your account)Select the scope (leave empty for default)
queryrequiredlong textSELECT statement with optional positional parameters ($1, $2, etc.). Do not include LIMIT or OFFSET.
argumentsoptionalarrayValues for positional parameters ($1, $2, etc.) in the query
vectorFiltersoptionalarrayFilter results by vector similarity (requires vector index)
vectorOrderoptionalarrayOrder results by vector similarity (requires vector index)
limitoptionalnumberMaximum number of results to return
offsetoptionalnumberNumber of results to skip
scanConsistencyoptionalone of "not_bounded" | "request_plus"Query consistency level
timeoutoptionalnumberOperation 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