Automate API requests with Database Webhooks in Supabase
HTML-код
- Опубликовано: 8 сен 2024
- For the introductory video on PostgreSQL functions, check out 👉 • Create PostgreSQL Func...
Webhooks are an awesome concept that allow us to automate communications between multiple third-party services, and keep all of our data in sync! In Supabase, we can use Function Hooks to automatically call an API endpoint anytime data in our PostgreSQL database changes.
Database Webhooks combine two concepts covered in previous videos - making a http request and subscribing to particular events in the database, like insert, update or delete. In this video, Jon Meyers ( / jonmeyers_io ) demonstrates how we can use Database Webhooks, together with Next.js API routes, to create a customer in Stripe, anytime a new user signs into our application.
This is part of a series of videos about functions in PostgreSQL, check out the rest of the playlist to learn more: • PostgreSQL Functions
💰 Get really good at Supabase and build a SaaS product (free course): egghead.io/cou...
---
Learn more about Supabase 👇
🕸 Website: supabase.com/
🏁 Get started: app.supabase.com/
📄 Docs: supabase.com/docs
🐙 Github: github.com/sup...
💬 Discord: discord.supaba...
🐦 Twitter: / supabase
Jon Meyers 👇
🕸 Website: jonmeyers.io/
🎥 RUclips Channel: / jonmeyers
🐦 Twitter: / jonmeyers_io
---
What are some strategies for protecting the API so that it can only accept requests coming from the supabase function hook request.
There was an option to pass in extra headers in function hook. You could for example pass in APIKEY header with some secret value and then use that header to verify that requests on next.js side.
Yeah, but that doesn't handle authorization (you can't use dynamic values, as far as I can tell outside of the body.request for the row)... I suppose if it's for the express purpose of creating a new user, that might be fine, but that still seems insecure to me.
Amazing presenters of Supabase very informative videos!
Would you PLEASE make a video explaining best practices for handling time + timezones in & out of Supabase ?
If you could add some specifics regarding Flutterflow and how it handles the issue - and how the two could come together - apart from helping my particular non coder situation could be the ONE video on the internet that shows best practices and rules to handle the "time" issue once and for all.
PLEASE! 🤞 😅 🤕
Very timeley for what I am working on. Thanks for the videos on this.
Awesome! Glad you liked it! 🙌
I just want to say I love your way of explaining things. It's very clear. Thank you, it was very helpful.
How about authenticating function hooks HTTP endpoints?
This seems very out of date. Also, no mention of how to test / set this up locally?
Can’t we post directly to the stripe api endpoints from supabase, without the need to post to a front facing app like you did in the example?
Thanks
You’re most welcome!
Quick, clear and concise. Thank you!
is there any chance the function hook failed to perform the request?
Hey Jon, fantastic tutorial, thank you very much! I am wondering two things mainly:
1) Is there a way to version-control your hooks, function calls, triggers etc that you walk us through and then `supabase deploy hooks`, similar to firebase works? Version controlling them would be awesome!
2) What is the best way to access all the logs going through such event-driven architecture, ie. hooks, triggers? Is it possible from the dashboard? Or is Logflare's acquisition going to allow that soon? :)
Keep it up!
under the net schema of your database
ooooh i was waiting for this!!!!! thanks!!
You’re welcome! Glad you liked it!
Can we do the same thing in plpg functions and triggers
I was just about to ask this
Really helpful thanks.
very cool
Awesome. Planing on creating the same tutorial for nuxt?
I want to invoke functions as per prompt entered in chat. Any logic or reference document will be really helpful.
Well Done.
If I had to save the email on Stripe, how would you recommend doing that. Great tutorial!
I'm confused what's the difference between fucntion hooks and edge functions
why didn.t the like button glow when you said hit the like button or is it the aussie accent?
Hello,
Is it possible to do the opposite?
How to retrieve data from webhook (e.g. WooCommerce webhook or Stripe webhook) to save in supabase?
Why wouldn't it? Just call supabase insert from your webhook.
How to implement the same project in Angular? Please make a full video on Angular
Missing explanation for the whole code