Overview
Update an existing event. Only pending events can be updated.
import { cuey } from "cuey";
const updatedEvent = await cuey.events.update("event-id", {
webhook_url: "https://api.example.com/webhook",
scheduled_at: "2025-01-01T00:00:00Z",
payload: {
message: "Updated message",
},
});
Parameters
The UUID of the event to update.
The full URL of the webhook endpoint to call. Must be a valid HTTP/HTTPS URL.
HTTP method to use for the webhook request. Options: GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS. Defaults to POST.
ISO 8601 timestamp when the event should execute. Must be in the future.
Custom headers to include in the webhook request. Object with string keys and values.
Payload to send with the webhook request. Can be any JSON-serializable object.
Retry configuration for failed webhook attempts.Show RetryConfig properties
Maximum number of retry attempts. Range: 1-10.
Initial backoff delay in milliseconds. Range: 100-5000.
Backoff strategy. Options: exponential, linear.
Response
The updated event object.
{
"id": "event-uuid-here",
"cron_id": null,
"retry_of": null,
"scheduled_at": "2025-01-01T00:00:00Z",
"executed_at": null,
"status": "pending",
"webhook_url": "https://api.example.com/webhook",
"method": "POST",
"headers": null,
"payload": {
"message": "Updated message"
},
"retry_config": null,
"response_status": null,
"response_headers": null,
"response_body": null,
"response_duration": null,
"response_error": null,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-16T12:00:00Z",
"team_id": "team-uuid-here"
}
Errors
Only pending events can be updated. Events that are processing, successful, or failed cannot be updated.
NotFoundError: If the event doesn’t exist
BadRequestError: If the event is not in pending status
ValidationError: If the update data is invalid (e.g., scheduled_at is in the past)
UnauthorizedError: If API key is invalid or missing
Examples
Update Event Schedule
import { cuey } from "cuey";
const event = await cuey.events.get("event-id");
if (event.status === "pending") {
const updated = await cuey.events.update(event.id, {
webhook_url: event.webhook_url,
method: event.method,
scheduled_at: new Date(Date.now() + 120000).toISOString(), // 2 minutes from now
payload: {
message: "Updated!",
},
});
console.log("Event updated:", updated.id);
}