Skip to content

Commit b3c7665

Browse files
committed
Add documentation for the WebhookCallDispatchedEvent
1 parent 49d9d1d commit b3c7665

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ WebhookCall::create()
116116
->dispatch();
117117
```
118118

119-
This will send a post request to `https://other-app.com/webhooks`. The body of the request will be JSON encoded version of the array passed to `payload`. The request will have a header called `Signature` that will contain a signature the receiving app can use [to verify](https://github.com/spatie/laravel-webhook-server#how-signing-requests-works) the payload hasn't been tampered with.
119+
This will send a post request to `https://other-app.com/webhooks`. The body of the request will be JSON encoded version of the array passed to `payload`. The request will have a header called `Signature` that will contain a signature the receiving app can use [to verify](https://github.com/spatie/laravel-webhook-server#how-signing-requests-works) the payload hasn't been tampered with. Dispatching a webhook call will also fire a `WebhookCallDispatchedEvent`.
120120

121121
If the receiving app doesn't respond with a response code starting with `2`, the package will retry calling the webhook after 10 seconds. If that second attempt fails, the package will attempt to call the webhook a final time after 100 seconds. Should that attempt fail, the `FinalWebhookCallFailedEvent` will be raised.
122122

@@ -384,6 +384,7 @@ WebhookCall::create()
384384
### Events
385385

386386
The package fires these events:
387+
- `WebhookCallDispatchedEvent`: the webhook call has been initially dispatched to the queue.
387388
- `WebhookCallSucceededEvent`: the remote app responded with a `2xx` response code.
388389
- `WebhookCallFailedEvent`: the remote app responded with a non `2xx` response code, or it did not respond at all
389390
- `FinalWebhookCallFailedEvent`: the final attempt to call the webhook failed.
@@ -396,9 +397,12 @@ All these events have these properties:
396397
- `headers`: the headers that were sent. This array includes the signature header
397398
- `meta`: the array of values passed to the webhook with [the `meta` call](#adding-meta-information)
398399
- `tags`: the array of [tags](#adding-tags) used
400+
- `uuid`: a unique string to identify this call. This uuid will be the same for all attempts of a webhook call.
401+
402+
Except for the `WebhookCallDispatchedEvent`, all events have these additional properties:
403+
399404
- `attempt`: the attempt number
400405
- `response`: the response returned by the remote app. Can be an instance of `\GuzzleHttp\Psr7\Response` or `null`.
401-
- `uuid`: a unique string to identify this call. This uuid will be the same for all attempts of a webhook call.
402406

403407
## Testing
404408

0 commit comments

Comments
 (0)