From d94f2f83fb1b822839e158dba2b4431e297162f4 Mon Sep 17 00:00:00 2001 From: Skylar Ittner Date: Wed, 28 Jan 2026 02:22:30 -0700 Subject: [PATCH] Add webhook APIs --- README.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ebd53dd..ffa60d9 100644 --- a/README.md +++ b/README.md @@ -440,4 +440,21 @@ Various useful helper functions. * `time.toDateString(timestamp)`: Get a localized date string for a UNIX timestamp. * `time.toTimeString(timestamp)`: Get a time string for a UNIX timestamp, for example, "2:01 PM". * `uuid.v4()`: Generate a version 4 UUID string, for example, "fcca5b12-6a11-46eb-96e4-5ed6365de977". -* `uuid.short()`: Generate a 16-character random alphanumeric string, for example, "4210cd8f584e6f6c". \ No newline at end of file +* `uuid.short()`: Generate a 16-character random alphanumeric string, for example, "4210cd8f584e6f6c". +* `async http.webhook.geturl(sourcename)`: Returns a URL that can be used as a webhook target/endpoint for third-party integrations. The `sourcename` is a unique identifier for the webhook. There is a limit on webhook payload size; large payloads over 500KB will be rejected by the server. +* `async http.webhook.poll(sourcename)`: Returns an array of webhook payloads received by the webhook URL generated by `geturl(sourcename)`. +* `async http.webhook.ack(webhookid)`: Acknowledge a webhook payload, clearing it from the list returned by `poll`. + +##### Webhook poll result format: + +```javascript +[ + { + id: 123, // Unique ID. Used for ack(webhookid). + timestamp: 1234567890, // UNIX timestamp (in seconds) of when the data was received by the webhook URL. + source: "sourcename", + headers: "{'Content-Type': 'application/json'}", JSON string of all the HTTP headers sent to the webhook URL. + body: "", Entire HTTP request body sent to the webhook URL. + } +] +``` \ No newline at end of file