Schedule HTTP requests to be executed in the future.
⚠️ Experimental Service: This is a free, experimental service provided as-is with no guarantees. Use with caution.
import { delay } from "https://esm.town/v/std/delay/client.ts";
// Delay by 5 minutes
await delay.schedule({
url: "https://myapp.com/webhook",
delaySeconds: 300,
});
// Or schedule for a specific time
await delay.schedule({
url: "https://myapp.com/webhook",
method: "POST",
headers: { "Authorization": "Bearer token" },
body: { orderId: 123 },
executeAt: "2024-12-25T10:00:00Z",
});
await fetch("https://delay.val.run", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
url: "https://myapp.com/webhook",
delaySeconds: 300,
}),
});
curl -X POST https://delay.val.run \ -H "Content-Type: application/json" \ -d '{"url": "https://myapp.com/webhook", "delaySeconds": 300}'
Schedule a delayed HTTP request.
| Field | Type | Required | Description |
|---|---|---|---|
url | string | Yes | Target URL to send the request to |
method | string | No | HTTP method (default: "POST") |
headers | object | No | Headers to include in the request |
body | any | No | Request body (JSON or string) |
delaySeconds | number | * | Seconds to delay before executing |
executeAt | string | * | ISO 8601 timestamp to execute at |
* Either delaySeconds or executeAt is required (not both)
{ "id": "550e8400-e29b-41d4-a716-446655440000", "scheduledFor": "2024-01-15T10:05:00.000Z", "status": "scheduled" }
The TypeScript client provides a convenient wrapper around the API.
import { delay } from "https://esm.town/v/std/delay/client.ts";
Schedule a request with full configuration options.
const result = await delay.schedule({
url: "https://api.example.com/webhook",
method: "POST",
headers: { "X-Custom-Header": "value" },
body: { data: "payload" },
delaySeconds: 60,
});
Convenience method to schedule by delay duration.
await delay.delayBy("https://api.example.com/webhook", 300);
// With additional options
await delay.delayBy("https://api.example.com/webhook", 300, {
method: "PUT",
body: { updated: true },
});
Convenience method to schedule for a specific time.
await delay.delayUntil("https://api.example.com/webhook", new Date("2024-12-25T10:00:00Z"));
// Or with an ISO string
await delay.delayUntil("https://api.example.com/webhook", "2024-12-25T10:00:00Z");
MIT