Skip to Content
Runbase

Writing a connector

Build workflow nodes with @getrunbase/node-sdk and defineNode.

A connector is a package that exports one or more nodes. Each node becomes a workflow node named node.<id>, listed in the nodes reference. Nodes run in the functions sandbox: no disk, no environment, network limited to the declared domains, secrets limited to the declared names.

Package layout

connectors/acme/package.json
{
  "name": "@getrunbase-connectors/acme",
  "version": "0.1.0",
  "license": "MIT",
  "type": "module",
  "runbase": { "entry": "index.ts", "label": "Acme" },
  "dependencies": { "@getrunbase/node-sdk": "workspace:*", "zod": "^4.6.7" }
}

Connectors are discovered in connectors/ and in node_modules/@getrunbase-connectors/ (or the folders listed in RUNBASE_CONNECTORS_DIRS).

Defining a node

connectors/acme/index.ts
import { z } from "zod";
import { defineNode } from "@getrunbase/node-sdk";

export default defineNode({
  id: "acme.create_ticket",
  label: "Create an Acme ticket",
  description: "Creates a support ticket in Acme.",
  inputs: z.object({ title: z.string().min(1), body: z.string() }),
  outputs: z.object({ id: z.string() }),
  auth: { secrets: ["ACME_TOKEN"], domains: ["api.acme.com"] },
  examples: [{ input: { title: "Hi", body: "" } }],
  run: async (input, ctx) => {
    const res = await ctx.fetch("https://api.acme.com/tickets", {
      method: "POST",
      headers: { authorization: `Bearer ${ctx.secrets.ACME_TOKEN}` },
      body: JSON.stringify(input),
    });
    if (!res.ok) throw new Error(`Acme failed (${res.status})`);
    return { id: ((await res.json()) as { id: string }).id };
  },
});
  • id is <connector>.<action> in lowercase.
  • branches (default ["ok"]) lists the outputs; return { branch, output } to route.
  • sideEffect defaults to true when a domain is declared: the node is simulated in dry runs.

Testing and publishing

pnpm runbase node init acme --dir connectors  # creates the skeleton
pnpm runbase node test connectors/acme        # validates, runs the examples, checks the bundle
pnpm runbase node dev connectors/acme         # reruns test on every change
pnpm runbase node registry connectors         # updates connectors/registry.json
pnpm runbase node publish connectors/acme     # tests, then publishes to npm

Connectors are MIT-licensed. The connectors/slack package is a complete example.

On this page