Call a Connector from your app
Read a Connector's OpenAPI and call its functions from your app's server for the person signed in to your app, so one app can use another app's Connector.
A Connector (until recently called a tool server) is built once and can be used from agents, from AI assistants and from apps. This page is about apps: your app’s server calls another Connector’s functions over HTTP, as the person who is signed in to your app.
A typical case is two apps in the same organization: a customer service app looks up and creates customers through the CRM app’s Connector, instead of reading the CRM’s database.
What you need
- Your app requires sign-in, so it knows who is using it (see Single sign-on for your app).
- The Connector runs in your organization, for example as a service in another app.
- The functions you call are exposed: an organization owner or admin has
exposed each one with a minimum role (
dibbla functions expose, or from the Connector’s page).
1. Get the OpenAPI
Every Connector has an OpenAPI 3.1 document. It lists each function you can
call, with its input as the request body, its output as result in the answer,
and the errors it can return.
Open the Connector in Dibbla and choose Use it. Under From your app you
can download the OpenAPI, copy it, and copy a ready fetch or curl example
for one of its functions. Feed the document to your code generator or to your
coding agent.
The same document is on the API, for the signed-in caller:
GET https://api.<domain>/api/wf/slim/functions/<connector>/openapi.json
The document describes the Connector. It is not a promise that every person may call every function: that is decided on each call (below).
2. Call a function
POST https://api.<domain>/api/wf/slim/functions/<connector>/<function>/invoke
Authorization: Bearer <the signed-in person's Dibbla session>
Content-Type: application/json
{"inputs": {"name": "Ada Lovelace", "email": "[email protected]"}}
The call is made as the person signed in to your app. Your app’s server
forwards their Dibbla session — the auth_token cookie the platform sets on
your app’s domain — unchanged, as a bearer token. The Connector sees who the
person is (not your app), and the platform checks their access on every call.
// On your app's server (Node / Express), for the person signed in to your app.
app.post("/customers", async (req, res) => {
const session = req.cookies.auth_token; // forward as it is, never log or store it
const response = await fetch(
"https://api.<domain>/api/wf/slim/functions/crm/create_customer/invoke",
{
method: "POST",
headers: {
Authorization: `Bearer ${session}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
inputs: { name: req.body.name, email: req.body.email },
}),
},
);
if (!response.ok) {
const { error } = await response.json();
return res.status(response.status).json({ error });
}
const { result } = await response.json();
res.json(result);
});
A successful call answers 200:
{
"invocation_id": "5f0c…",
"status": "completed",
"duration_ms": 42,
"result": { "id": "cus_123", "name": "Ada Lovelace" }
}
Forwarding the session is the one thing you may do with that cookie, and only like this:
- only from your app’s server, never from code that runs in the browser;
- only to the
/api/wf/slim/functions/…address of your own Dibbla; - never log it, store it, or send it to any other service.
Do not decode it either: the headers are how your app learns who is signed in.
3. Who may call
A function can be called when it is exposed, and the person’s role in the organization is at or above the function’s minimum role. Otherwise:
| Status | code | Means |
|---|---|---|
404 | NOT_FOUND | No such function, or it is not exposed. The two look the same on purpose. |
403 | FORBIDDEN | The function is exposed, but the person’s role is below its minimum role. |
Show the person that they lack access rather than retrying. Access per Connector — who may use which Connector, the way an app’s access list works — is coming and will then decide these answers; your code does not need to change.
Errors
Every error is JSON, {"error": "…", "code": "…"}:
| Status | code | Means |
|---|---|---|
400 | VALIDATION_FAILED | The body is not {"inputs": {…}}, a required input is missing (details names it), or a reserved input was set. |
401 | UNAUTHORIZED | No session, or it has expired: send the person through sign-in again. |
403 | FORBIDDEN | The person’s role is too low for this function. |
404 | NOT_FOUND | No such function, or not exposed. |
413 | PAYLOAD_TOO_LARGE | The body is larger than 64 KiB. |
502 | UPSTREAM_FAILED | The Connector answered with an error. |
504 | TIMEOUT | The Connector did not answer within 30 seconds. |
Calls from the browser
Code running in the browser on your app’s own address can call
/api/wf/slim/functions/<connector>/<function>/invoke on that same address
with no token at all: the person’s session goes along by itself. Prefer your
server, where you control what is sent.
Apps without sign-in
A public app has nobody signed in, so it has no session to forward and cannot call a Connector this way.