Comments (9)
@djanda97 Great! Yep this issue is still available! You should be all set on the frontend side beside that DeveloperTab you pointed out.
Looping in @diego-escobedo to check if there is anything else on the backend.
from lotus.
Hey David! Sorry for the late response, missed this one. Looks like the right path for the backend. I'll add in a few other things you might find useful.
- Webhooks need to be registered with the webhooks server (Svix) before being used, here's where we do it in the code:
lotus/backend/lotus/settings.py
Line 665 in 335b69d
- https://raw.githubusercontent.com/uselotus/lotus/442db21387ebaf47c65d6bf2fdb569d12abcd97d/docs/webhooks/webhooks.mdx the current documentation page we have for webhooks. Unfortunately, we don't have a great way of displaying the schema for the response objects in our mintlify docs atm, so what we do is: Run management command
python manage.py generate_schema
, copy paste the openapi spec into a different openapi renderer, and screenshot it. In the case of an existing response schema (like we have for invoices), we just link them to the appropriate place in the docs.
In terms of where you'd actually be putting the x_webhook()
calls imported from the webhooks file:
- Subscriptions ending / being cancelled happen mostly at:
Line 468 in 335b69d
- Subscription renewal happens at
lotus/backend/metering_billing/invoice.py
Line 254 in 335b69d
- Customer creation happens at
Line 212 in 335b69d
Doing all of the webhooks at once might be too much to chew off / review in a single PR, so perhaps spinning them out one issue at a time might end up being easier.
Let me know if you need any more details or if you're curious about how the webhooks work in more detail! Happy to discuss.
from lotus.
Thanks for the info! I agree that trying to implement all the new webhooks would be a bit much to tackle in a single PR, so I'll start with the customer created webhook & reach out when I have any questions after diving into the code!
from lotus.
Great! Awesome to hear and excited to review next week.
from lotus.
Yeah! @djanda97 Feel free to create some more issues, we treated this one as just customer-created. You can use the same issue format and create and self-assign to as many as you are up for!
from lotus.
Hi @mnida!
If this issue is still available, I would like to work on it. After cloning the repo and poking around the codebase for a while, I found a few files that look like a good starting point for adding new webhooks.
Backend:
- https://github.com/uselotus/lotus/blob/main/backend/metering_billing/utils/enums/enums.py#L183
- https://github.com/uselotus/lotus/blob/main/backend/metering_billing/webhooks.py
- https://github.com/uselotus/lotus/blob/main/backend/api/serializers/webhook_serializers.py
Frontend:
Do you have a recommendation for other files (either backend or frontend) to look into that will require editing for adding new webhooks?
Cheers,
David
from lotus.
Hey @djanda97 checking in to see how the issue is going?
from lotus.
Hi @mnida, so far so good! I've created a draft PR that registers the customer created webhook with the webhook server (svix) and adds it to the WEBHOOK_TRIGGER_EVENTS
class. The bulk of the implementation is something I plan to get to this upcoming week.
from lotus.
Is your feature request related to a problem? Please describe. Users want webhooks for these events:
* when a subscription ends/is cancelled * when a subscription is created * when a subscription is renewed * customer created
Describe the solution you'd like In the backend add this webhook functionality using our alerts framework and svix.
In the frontend simply add the checkbox in the create webhook url form.
Now that #539 is merged, could the subscription related webhooks be split up into different issues so that they could be worked on individually? I would be interested in implementing a few more now that I've done it once before and know the general locations where code would need to be added 😄
from lotus.
Related Issues (20)
- Community Integrations HOT 1
- Feat: Quickstart Loading bar in sidebar HOT 1
- Re-enable taxes for generate_balance_adjustment_invoice
- Move Cost Analysis into Custom Viewset HOT 1
- Improve Code Formatting and Copy on Quickstart page HOT 1
- Route to original page after login HOT 3
- difference between lotus and stigg.io ? HOT 3
- Bulk tiers broke plan creation with components HOT 2
- Is this project still active? HOT 4
- Addons description field required on backend HOT 1
- Subscription endpoint 500 HOT 3
- Problem adding a filter to the metric
- Project status HOT 1
- Error creating new customer when address specified
- Docker compose `SVIX_DB_DSN` does not use `POSTGRES_USER`
- Improper documentation of API authentication
- Multiple billable accounts HOT 2
- Inquiry Regarding Switching Dependency from Redpanda to Kafka HOT 2
- Self hosting error
- error while following docker steps
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lotus.