-
-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Webhooks #165
base: main
Are you sure you want to change the base?
feat: Webhooks #165
Conversation
This is the trait that you'll use on events in order to send a webhook for it. You'll need to implement the getWebhookPayload and getWebhookEventName methods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is amazing, thanks @danjohnson95! I've not yet reviewed in my laptop, but aside from this one question, it looks pretty great!
@danjohnson95 okay, I had a moment to check on this PR. Here's my feedback:
|
Thanks for the review @jbrooksuk!
Nice, I've made this change now. I initially put it in a section on the right because the Save button goes underneath the Attempts section. It could potentially be a bit confusing if a webhook has a long list of attempts and the Save button requires a scroll to see it.
Good spot. How about something like how GitHub manages it, with an additional click to change the secret? or did you have something else in mind?
Done! I had a dig around in the Filament source to see how we can output HTML in the helperText and came up with a decent solution - I've created the |
@danjohnson95 thanks for implementing these changes. I couldn't immediately see anything in the docs about showing the panel under the save button. Maybe we could make the width condition whether you're editing a webhook or not? Either leave the secret field empty as to not update it, or have a button to change it (which could open an action modal) would be fine. |
@danjohnson95 I've just fixed the tests, but one thing I've noticed is that the "Edit Secret" button is visible when creating a webhook, we should make it conditional to the Edit page. |
Looks like that's a Filament bug! I've raised a PR to fix it. |
Thanks @danjohnson95! |
👋 Sorry for the giant PR here, got a bit carried away.
This PR introduces the webhooks functionality ✨ (Resolves #106)
It's using Spatie's library under the hood to handle sending and retries, but here's a brief overview of what it's doing:
SendsWebhook
trait.SendsWebhook
trait, theDispatchWebhooks
action will take it from here.DispatchWebhooks
will call thegetWebhookEventName
andgetWebhookPayload
methods on the event to build up the webhook call.WebhookAttempt
.This means from the user point of view, they just need to:
And they'll see a log of all the recent webhook attempts made to that endpoint.
From a Cachet contributor point of view, in order to make something webhookable, simply:
SendsWebhook
traitgetWebhookPayload()
andgetWebhookEventName()
methods.Let me know if you have any questions or suggestions!