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 exportshandle(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 exportsdeliver(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.