Skip to content

feat(webhooks): add event replay endpoint - #274

Merged
gabrielmfern merged 6 commits into
mainfrom
feat/webhook-event-replay
Sep 3, 2026
Merged

feat(webhooks): add event replay endpoint#274
gabrielmfern merged 6 commits into
mainfrom
feat/webhook-event-replay

Conversation

@gabrielmfern

@gabrielmfern gabrielmfern commented Sep 3, 2026

Copy link
Copy Markdown
Member

Adds POST /webhooks/{webhook_id}/events/{event_id}/replay (webhooks/replay-event), which queues one more delivery of a webhook event to its webhook. Placed next to get_event / get_event_async, same argument style.

def replay_event(cls, webhook_id: str, event_id: str) -> ReplayEventResponse
async def replay_event_async(cls, webhook_id: str, event_id: str) -> ReplayEventResponse

ReplayEventResponse is { object: "webhook_event", id: str }.

import resend

resend.api_key = "re_xxxxxxxxx"

replayed = resend.Webhooks.replay_event(
    "4dd369bc-aa82-4ff3-97de-514ae3000ee0", "msg_1srOrx2ZWZBpBUvZwXKQmoEYga2"
)
print(replayed["id"])

Also adds a replay call to examples/webhooks.py.

Spec PR: resend/resend-openapi#112
API PR: https://github.com/resend/resend-monorepo/pull/9535
Docs page: https://resend.com/docs/api-reference/webhooks/replay-event

Tests

The ResendBaseTest fixture mocks Request.make_request(url), which hides the verb, and the verb is the only thing separating replay_event from get_event. The tests therefore swap resend.default_http_client / resend.default_async_http_client for a mock client and assert method == "post" plus the exact URL, the same shape as TestSuppressionsRequestBody. The setUp/tearDown is copied rather than lifted into conftest.py on purpose: this is the second copy per mode, not the third.

Checks

  • tox -e lint (flake8): passed
  • tox -e mypy: passed, no issues in 181 files
  • tox -e py (pytest): 626 passed

Not verified live

No call was made against the API (write endpoint, no key configured for this task). The tests pin the verb and path; the only remaining assumption is the response body shape, which is pinned by the spec (ReplayWebhookEventResponse).

No version bump; that happens in a separate chore PR.

Part of DEV-2005.

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

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread tests/webhooks_async_test.py Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 1 file (changes from recent commits).

Requires human review: Auto-approval blocked by 1 unresolved issue from previous reviews.

Re-trigger cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 2 files (changes from recent commits).

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Requires human review: Adds a public POST endpoint that triggers an additional webhook delivery. Human review is needed for the product and operational implications of replay semantics and its external API contract.

Re-trigger cubic

Comment thread tests/webhooks_test.py
@gabrielmfern
gabrielmfern marked this pull request as ready for review September 3, 2026 20:25

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 2 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread tests/webhooks_async_test.py Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 2 files (changes from recent commits).

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Requires human review: Adds a new public POST endpoint that queues an additional webhook delivery. Human review is needed for the product and operational semantics of replay and the new external API contract.

Re-trigger cubic

@gabrielmfern
gabrielmfern merged commit 50ea04f into main Sep 3, 2026
20 checks passed
@gabrielmfern
gabrielmfern deleted the feat/webhook-event-replay branch September 3, 2026 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants