Repository navigation
feat(add_ons): Add lifecycle webhooks - #6308
Merged
groyoh merged 4 commits intoOct 19, 2026
Merged
Conversation
groyoh
reviewed
Oct 15, 2026
groyoh
left a comment
Contributor
There was a problem hiding this comment.
Some points may block the merge: the
- The branch is based on a
mainfrom early September and needs a rebase.spec/models/webhook_endpoint_spec.rbwas added onmainsince then and fails with this change (see the inline comment). - The new webhooks are not documented in getlago/lago-openapi (
src/webhooks/hasbillable_metric_created.yamlbut nothing for add-ons). A matching PR there would let SDK users and the docs see the payload.
AddOn create/update/destroy fired no webhooks and produced no activity
logs at all, unlike sibling catalog resources Plan/BillableMetric/
Coupon, which all fire *.created/*.updated/*.deleted webhooks.
Adds Webhooks::AddOns::{Created,Updated,Deleted}Service mirroring the
existing BillableMetrics/Coupons webhook services, registers them in
SendWebhookJob::WEBHOOK_SERVICES, and wires the SendWebhookJob calls
into AddOns::{Create,Update,Destroy}Service.
## Context Webhook endpoints can only subscribe to the event types declared in `config/webhook_event_types.yml`. The `add_on.*` webhooks were added to `SendWebhookJob::WEBHOOK_SERVICES` without being declared there, so an endpoint that selects its events could not subscribe to them, and the webhook form did not list them. `spec/models/webhook_endpoint_spec.rb` also requires every handler type to be declared. ## Description `add_on.created`, `add_on.updated` and `add_on.deleted` are declared under a new `Add Ons` category. The category has no dash because its GraphQL enum key is built from it (`ADD_ONS`). The GraphQL schema was dumped again, since `EventTypeEnum` and `EventCategoryEnum` are built from this file.
## Context The add-on endpoints of the REST API serialize add-ons with their `taxes`, but the `add_on.*` webhook payloads did not. An update that only changed `tax_codes` sent an `add_on.updated` whose payload looked unchanged. ## Description The add-on webhooks now serialize with `includes: %i[taxes]`, so the webhook object matches the API object.
groyoh
force-pushed
the
feature/add-on-lifecycle-webhooks
branch
from
October 15, 2026 17:03
70e7886 to
803dcfe
Compare
## Context The add-on webhook specs only checked a few keys of the payload, mostly by type, through the `creates webhook` shared example, which ignores the keys it is not given. A field missing from the payload, renamed or with a wrong value was not caught. ## Description Each spec now builds an add-on with explicit values and one applied tax, and compares the whole payload with `eq`, including every field of the serialized tax.
groyoh
approved these changes
Oct 19, 2026
groyoh
added a commit
to getlago/lago-openapi
that referenced
this pull request
Oct 19, 2026
## Context lago-api sends `add_on.created`, `add_on.updated` and `add_on.deleted` webhooks once getlago/lago-api#6308 is merged. The payload is the add-on object with its taxes, the same one the add-on endpoints return. These webhooks are not documented yet. ## Description The three webhooks are documented with `AddOnObject` as payload, following the billable metric and plan webhooks. This PR should be merged after getlago/lago-api#6308.
Contributor
|
Thanks for you contribution @avanish-garg ! |
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.
Context
Creating, updating or deleting an add-on sent no webhook, unlike plans, billable metrics and features.
Description
Three webhooks are added:
add_on.created,add_on.updatedandadd_on.deleted, sent by the create, update and destroy services. The payload is the add-on object with itstaxes, the same object the add-on endpoints return, so an update that only changes the taxes is visible in the payload.The types are declared in
config/webhook_event_types.ymlunder a newAdd Onscategory, so a webhook endpoint can subscribe to them and the webhook form lists them. The category name has no dash because the GraphQL enum key is built from it (ADD_ONS). The GraphQL schema was regenerated. Endpoints that listen to all events receive the new webhooks without any change.The webhook specs compare the whole payload, so a missing or renamed field is caught.
Fixes #6309