Skip to content

WebhookDelivery and WebhookDeliveryAttempt objects #173

Description

@Benzilla

WebhookDelivery and WebhookDeliveryAttempt objects

Goal

Define the WebhookDelivery and WebhookDeliveryAttempt objects within the shared-types folder.

Proposed Solution

Add WebhookDeliveryAttempts. WebhookDelivery objects as a first step for #[ISSUE]

The objects would roughly look like this - however it is okay for the implemetation to differ if there are any other ideas. We should add comments similar to other types in the shared-types folder:

export interface WebhookDelivery {
  id: string;
  event_id: string;
  webhook_endpoint_id: string;
  status: 'pending' | 'retrying' | 'succeeded' | 'failed';
  next_attempt_at: number | null;
  delivered_at: number | null;
  claim_until: number | null;
  attempts: WebhookDeliveryAttempt[];
}
export interface WebhookDeliveryAttempt {
  attempt_number: number;
  attempted_at: number;
  completed_at: number;
  result: 'succeeded' | 'http_error' | 'timed_out' | 'network_error';
  http_status: number | null;
  duration_ms: number;
  error: string | null;
  url: string;
}

A recovered delivery attempt might look like this:

{
  "id": "whd_z_123",
  "event_id": "evt_z_123",
  "webhook_endpoint_id": "we_z_123",
  "status": "succeeded",
  "next_attempt_at": null,
  "delivered_at": 1789240915,
  "claim_until": null,
  "attempts": [
    {
      "attempt_number": 1,
      "attempted_at": 1789237274,
      "completed_at": 1789237278,
      "result": "http_error",
      "http_status": 500,
      "duration_ms": 3693,
      "error": "HTTP 500",
      "url": "https://example.com/webhooks"
    },
    {
      "attempt_number": 2,
      "attempted_at": 1789240915,
      "completed_at": 1789240918,
      "result": "succeeded",
      "http_status": 200,
      "duration_ms": 3206,
      "error": null,
      "url": "https://example.com/webhooks"
    }
  ]
}

Acceptance criteria

  • All tests still pass
  • The objects are added to the shared-types folder with the correct comments.
  • The objects are well defined with the goal of completing [Epic] Webhook retry system #172.
  • Only these new types are added to the shared-types folder, no other changes are required.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions