Webhooks in .NET 8 Explained 🔧, Secure Your APIs 🛡️


Hey Reader,

Today, we're diving into webhooks and how to build them with .NET 8, a topic that has intrigued many of you, especially those enrolled in the .NET Web Academy.

🔗 Building Webhooks with .NET 8 on YouTube

In my newest video, I show you how to set up webhooks using .NET 8. We start with the basics, explaining webhooks as simple ways to make your web apps do more in real-time. I'll walk you through creating a webhook in Visual Studio for a fun project: tracking achievements in video games.

video preview

💡 Quick Guide for Readers

If you prefer a quick read, here's the gist:

  • Webhooks are parts of your web API that respond when certain things happen.
  • We made a sample webhook that lets you know when a gamer achieves something.
  • Keeping your webhooks safe is key. We did this by using an API key, ensuring only approved requests can reach our webhook.

🚀 Applying It: Keep Your Services Safe

Using webhooks with API keys lets you safely mix different systems, automate jobs, and make user experiences better across various applications.

Setting this up is straightforward with an HTTP header by using a custom X-API-KEY value.

Here's a simple way to check this API key in your Web API controller:

You could also use middleware to check the API key for every request.


If you have questions, feel free to reply to this email. I'm here for more tutorials and to answer any questions.

Thanks so much to our community and my Patrons for your support. You are the foundation of this newsletter and my channel. Stay safe, have fun coding, and remember - the best part is creating something new! 💻

Take care,

Patrick


Patrick God

Become a .NET & Blazor expert with weekly tutorials featuring best practices and the latest improvements, right in your inbox.

Read more from Patrick God
video preview

Hey Reader, If you're building apps with Blazor, you've probably asked yourself this: 👉 Should I use SSR, Blazor Server, or WebAssembly? It’s a common question - and I get it a lot. So I made a brand-new YouTube video walking you through how to choose the best one for your app. 🎥 Watch it here: If you're building a Blazor app or planning to do so soon, this should help clear up a lot of confusion. Let me know what you think, and feel free to reply if you have any questions. Take care, Patrick...

video preview

Hey Reader, You may have seen the recent blog post from Jimmy Bogard (creator of MediatR and AutoMapper) announcing that these libraries are going commercial. And to be clear, I fully support that. Time is money, and supporting your family always comes first. BUT… In most of my projects, I don’t actually use everything MediatR offers. I usually just need a small part of it, the classic "send a request, get a response" pattern. So I thought: why not build a simple version myself? 👉 That’s...

video preview

Hey Reader, In my last video, I showed you how to build a CRUD app using Vertical Slice Architecture and controllers in .NET 9. But… What if you could do the same thing - cleaner, simpler, and without all that controller clutter? 👉 That’s exactly what I show you in my brand-new video: In this one, you’ll learn how to: Use Minimal APIs instead of controllers Keep your Program.cs neat and tidy Stay fully organized with the Vertical Slice Architecture Work with Carter, a super helpful library...