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
    ---

Комментарии • 32

  • @isaiahdahl
    @isaiahdahl 2 года назад +13

    What are some strategies for protecting the API so that it can only accept requests coming from the supabase function hook request.

    • @ValtteriKaresto
      @ValtteriKaresto 2 года назад +1

      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.

    • @AJax2012
      @AJax2012 2 года назад +3

      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.

  • @loucasi
    @loucasi Месяц назад

    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! 🤞 😅 🤕

  • @bdougie
    @bdougie 2 года назад +3

    Very timeley for what I am working on. Thanks for the videos on this.

    • @JonMeyers
      @JonMeyers 2 года назад

      Awesome! Glad you liked it! 🙌

  • @michaelpumo83
    @michaelpumo83 2 года назад

    I just want to say I love your way of explaining things. It's very clear. Thank you, it was very helpful.

  • @EasyAudioToursSoftware
    @EasyAudioToursSoftware Год назад +2

    How about authenticating function hooks HTTP endpoints?

  • @cordial
    @cordial 4 месяца назад +1

    This seems very out of date. Also, no mention of how to test / set this up locally?

  • @wheres_bears1378
    @wheres_bears1378 2 года назад +2

    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?

  • @ouss
    @ouss 2 года назад +3

    Thanks

    • @JonMeyers
      @JonMeyers 2 года назад

      You’re most welcome!

  • @oniscsadi
    @oniscsadi 2 года назад +1

    Quick, clear and concise. Thank you!

  • @yandearta
    @yandearta 2 года назад +2

    is there any chance the function hook failed to perform the request?

  • @34tttttaa
    @34tttttaa 2 года назад +4

    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!

  • @diegofrancofioravante97
    @diegofrancofioravante97 2 года назад +1

    ooooh i was waiting for this!!!!! thanks!!

    • @JonMeyers
      @JonMeyers 2 года назад

      You’re welcome! Glad you liked it!

  • @deepak.rocks.
    @deepak.rocks. Год назад +2

    Can we do the same thing in plpg functions and triggers

    • @seyzeffects
      @seyzeffects Год назад

      I was just about to ask this

  • @brucehe9517
    @brucehe9517 6 месяцев назад

    Really helpful thanks.

  • @stelsewhere3748
    @stelsewhere3748 6 месяцев назад

    very cool

  • @Vidzhut
    @Vidzhut Год назад +1

    Awesome. Planing on creating the same tutorial for nuxt?

  • @user-xd6ut8vm4d
    @user-xd6ut8vm4d 7 месяцев назад

    I want to invoke functions as per prompt entered in chat. Any logic or reference document will be really helpful.

  • @efrainjprada765
    @efrainjprada765 7 месяцев назад

    Well Done.

  • @thesobercoder
    @thesobercoder Год назад

    If I had to save the email on Stripe, how would you recommend doing that. Great tutorial!

  • @user-re8lt2gy3g
    @user-re8lt2gy3g Год назад

    I'm confused what's the difference between fucntion hooks and edge functions

  • @hakuna_matata_hakuna
    @hakuna_matata_hakuna Месяц назад

    why didn.t the like button glow when you said hit the like button or is it the aussie accent?

  • @stephanevallejo306
    @stephanevallejo306 2 года назад

    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?

    • @RiwenX
      @RiwenX Год назад

      Why wouldn't it? Just call supabase insert from your webhook.

  • @gtanmoy
    @gtanmoy 2 года назад

    How to implement the same project in Angular? Please make a full video on Angular

  • @disrael2101
    @disrael2101 2 года назад +4

    Missing explanation for the whole code