From 04bb2413b51d9ef94fbfa6630c17830de6b94775 Mon Sep 17 00:00:00 2001 From: alphaeusmote <41258468-alphaeusmote@users.noreply.replit.com> Date: Thu, 10 Apr 2025 02:02:46 +0000 Subject: [PATCH] Enhance webhook management by adding retry functionality and improved logging Replit-Commit-Author: Agent Replit-Commit-Session-Id: 9111ef36-26c8-4085-84ca-a35dc1fec1b5 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/7083d608-d6d3-4a6a-9a27-6286c5109627/b9fbc26f-a14f-43d9-a5be-61c2452dfa24.jpg --- client/src/pages/webhooks.tsx | 60 +++++++++++++++++++++++++++++++---- 1 file changed, 53 insertions(+), 7 deletions(-) diff --git a/client/src/pages/webhooks.tsx b/client/src/pages/webhooks.tsx index 318c816..313e8a9 100644 --- a/client/src/pages/webhooks.tsx +++ b/client/src/pages/webhooks.tsx @@ -233,6 +233,33 @@ export default function WebhooksPage() { }, }); + // Retry webhook delivery mutation + const retryWebhookDeliveryMutation = useMutation({ + mutationFn: async (logId: string) => { + const res = await apiRequest("POST", `/api/webhook-logs/${logId}/retry`); + return await res.json(); + }, + onSuccess: (data) => { + toast({ + title: "Webhook delivery retried", + description: "The webhook delivery has been retried successfully.", + }); + // Refresh the logs to show the new retry attempt + queryClient.invalidateQueries({ + queryKey: ["/api/webhooks", currentWebhookId, "logs"], + }); + // Reset the selected log + setSelectedLog(null); + }, + onError: (error: Error) => { + toast({ + title: "Error retrying webhook", + description: error.message, + variant: "destructive", + }); + }, + }); + // Fetch webhook delivery logs const { data: webhookLogs = [], @@ -272,6 +299,10 @@ export default function WebhooksPage() { const handleTestWebhook = (id: string) => { testWebhookMutation.mutate(id); }; + + const handleRetryWebhook = (logId: string) => { + retryWebhookDeliveryMutation.mutate(logId); + }; const handleEditClick = (webhook: Webhook) => { setCurrentWebhook(webhook); @@ -855,13 +886,28 @@ export default function WebhooksPage() {

Delivery Details

- +
+ {!selectedLog.status && ( + + )} + +