feat(webhooks): add event replay endpoint

Merged
GA
2mo ago
+32-7

Adds WebhookSvc::replay_event for POST /webhooks/{webhook_id}/events/{event_id}/replay, next to get_event, plus the ReplayWebhookEventResponse type (re-exported from resend_rs::types). Replaying queues one more delivery of the event to the webhook, same as the dashboard's Replay button; manual replays do not schedule automatic retries.

Offered for the maintainer's review. Part of the webhook event replay rollout (DEV-2005).

pub async fn replay_event(&self, webhook_id: &str, event_id: &str) -> Result<ReplayWebhookEventResponse>
let replayed = resend
    .webhooks
    .replay_event(
        "4dd369bc-aa82-4ff3-97de-514ae3000ee0",
        "msg_1srOrx2ZWZBpBUvZwXKQmoEYga2",
    )
    .await?;
println!("{}", replayed.id);

References:

Checks run locally:

  • cargo build: ok
  • cargo fmt --check: ok
  • cargo clippy --all-targets -- -Dwarnings: ok (async, --no-default-features --features rustls-tls, and --features blocking)
  • cargo test webhooks:: (async and --features blocking): offline tests pass. webhooks::test::all needs RESEND_API_KEY and was not run.

Not done: no live call against the endpoint (write endpoint, no key configured), so the response shape is taken from the spec PR. No new test: the response type is a two-field derive with nothing to regress, and the live all test cannot manufacture a deliverable event. No version bump, matching #101.

Linear: https://linear.app/resend/issue/DEV-2014