Skip to main content
Each side of a connector runs one function: one file of your Node.js or Python, or a preset’s code. The inbound function runs on every request to the connector’s URL and decides whether it is genuine and which agents hear of it. The deliver function runs on every attempt of every message an agent sends through the connector and posts it to its destination. Both get the connector’s secrets; neither touches sessions or messages itself.

Set a function

set takes code, or a preset whose code for the side and runtime it copies, with its default params when you give none. It answers once the new version is published, so the next request or attempt runs it; every set raises the side’s version. functions.get(side) returns the code, the runtime, and the params, and functions.delete(side) removes the function: the inbound side then answers every request 503, and the outbound side refuses every send. The two sides are separate code with separate versions.

Inbound contract

The code exports handle(req, ctx), which may be async in Node.js:

What the signature presets check

Each also accepts the secret previous during a rotation, and measures a replay’s timestamp against ctx.replay.receivedAt.

Deliver contract

The code exports deliver(msg, ctx), which may be async in Node.js:
A thrown error, a timeout, or an answer outside these shapes counts as retryable. Delivery is at least once: an attempt whose answer is lost is tried again with the same msg.id. A deliver function that posts in several steps, such as a long message split in parts, answers its progress with a retryable error, and the next attempt resumes from ctx.progress instead of posting twice.

Test before you save

connector.functions.test(side, request) runs the saved version, or draft: { runtime, code, params }, and returns the result with the last 4 KiB the code logged. An inbound test runs on event: { headers, query, body } or on a recorded deliveryId, records nothing, and delivers nothing. An outbound test runs on message: { address, text, attachments? } and delivers for real, to the address given, without recording an outbox message.

Where functions run

Functions run on AWS Lambda, one per side, with no AWS permissions and no environment variables; they may open outbound connections. What they print reaches you only through a test. Nothing kept in memory survives from one request to the next.