[ShanaBoo] [ Laravel ] Implement webhook system with signature verification and retry queue#4437
Closed
genesisrevelationinc-debug wants to merge 7 commits into
Closed
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds initial webhook infrastructure to send signed outbound webhook requests and persist delivery attempts.
Changes:
- Introduces
WebhookDispatcherservice to sign and POST webhook payloads while recording aWebhookDelivery. - Adds
WebhookandWebhookDeliveryEloquent models with relationships and attribute casting. - Adds a queued
DispatchWebhookJobto dispatch webhooks asynchronously.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| laravel/app/Services/WebhookDispatcher.php | Implements signing, HTTP dispatch, and delivery persistence helpers. |
| laravel/app/Models/WebhookDelivery.php | Adds delivery model with payload casting and webhook relationship. |
| laravel/app/Models/Webhook.php | Adds webhook configuration model and deliveries relationship. |
| laravel/app/Jobs/DispatchWebhookJob.php | Adds queued job wrapper to call the dispatcher. |
| { | ||
| $this->webhook = $webhook; | ||
| $this->event = $event; | ||
| $thishook->payload = $payload; |
Comment on lines
+24
to
+33
| $delivery = new WebhookDelivery(); | ||
| $delivery->webhook_id = $webhook->id; | ||
| $delivery->event = $event; | ||
| $delivery->payload = $payload; | ||
| $delivery->response_code = $response->status(); | ||
| $delivery->attempts = 1; | ||
| $delivery->delivered_at = now(); | ||
| $delivery->save(); | ||
|
|
||
| return $response->successful(); |
Comment on lines
+14
to
+22
| $signature = hash_hmac('sha256', json_encode($payload), $webhook->secret); | ||
| $headers = [ | ||
| 'X-Webhook-Signature' => $signature, | ||
| 'Content-Type' => 'application/json', | ||
| ]; | ||
|
|
||
| try { | ||
| $response = Http::withHeaders($headers) | ||
| ->post($webhook->url, $payload); |
|
|
||
| public function calculateNextRetryDelay(int $attempt): int | ||
| { | ||
| return pow(2, $attempt - 1) * 60; // Exponential backoff in seconds |
Comment on lines
+12
to
+22
| protected $fillable = [ | ||
| 'url', | ||
| 'secret', | ||
| 'events', | ||
| 'active', | ||
| ]; | ||
|
|
||
| protected $casts = [ | ||
| 'events' => 'array', | ||
| 'active' => 'boolean', | ||
| ]; |
Comment on lines
+54
to
+56
| } | ||
|
|
||
| ?> No newline at end of file |
Contributor
|
Unfortunately the changes in this PR didn't fully resolve the issue. Please rework your solution and submit a new pull request. Make sure to review the acceptance criteria in the linked issue and verify all conditions are met before resubmitting. See CONTRIBUTING.md for guidelines. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ShanaBoo Autonomous Fix
This PR was automatically generated by ShanaBoo Earn Engine to claim the $800.00 bounty on this issue.
Source: Github | Task: 4451695139
Closes #754
Auto-submitted by ShanaBoo CNS — NVIDIA NIM + Microsoft Agent Framework