🦥 What the heck is a webhook?

Read on our website

Hello friends!

Welcome to this week’s Sloth Bytes. I hope you had a great week.

I want your thoughts on this

I plan on adding more visuals/diagrams in the future because I think visuals are very helpful.

I have 2 designs and wanted to know which one you prefer:

Option 1

Option 2

Which design do you prefer?

This will help me with future visuals/diagrams

Login or Subscribe to participate in polls.

🦥 No sponsor this week, just vibes.

But if you want to reach 50,000+ developers, founders, and tech lovers who actually open their emails — this is the place.

🦥 What the Heck is a Webhook?

Webhooks are actually one of those concepts that sound way more complicated than they are. Once you "get it," you'll start seeing use cases for them everywhere.

So what is it?

A webhook is a URL on your server that another service POSTs to when an event occurs.

Think of it as a mailbox. You give them your address, they drop off a letter (HTTP POST request) whenever something interesting happens.

Easy to understand analogy

Everyone has experienced or heard of this situation.

“Are we there yet? Are we there yet? Are we there yet?”

Your parents wanted to throw you out the window. You're wasting everyone's energy asking the same question every 30 seconds when nothing has changed.

Webhooks (The Smart Way): "We'll tell you when we get there. Now sit back and shut up."

You’ll get notified when something actually happens. Everyone's happy.

That's what webhooks do.

Instead of your app constantly asking another service "got any updates for me?" the service tells YOU when something actually happens.

Real examples

  • Stripe: Payment succeeded? Webhook tells you instantly.

  • Slack: Bot mentioned? Webhook hits your server.

  • Discord: New message? Webhook forwards it.

How Webhooks Work

  1. You create an endpoint on your server (a URL that accepts POST requests)

  2. You register that URL with the service

  3. Something happens on their end (payment, code push, etc.)

  4. They send an HTTP POST to your URL with the data

  5. Your server processes it

That's literally it. Just one service sending an HTTP request to another.

Code example

I switched to images to reduce email clipping!

Security: Always Verify Signatures

Here's the scary part: anyone can POST to your webhook URL.

How do you know it's actually from Stripe and not some random person messing with you?

Webhook signatures. Services sign their webhooks with a secret key.

Always verify these before processing:

It's like checking someone's ID before letting them into your house.

Building Your Own Webhook System

So you want to send webhooks to YOUR users when stuff happens in your app?

Here's the fundamentals that you need:

1. Let Users Subscribe

2. Send Signed Webhooks

3. Trigger When Events Happen

Common Questions

"What if my server is down when the webhook fires?"

Most services retry failed webhooks for hours or days.

 Stripe retries for up to 3 days, but you should monitor your endpoint because if it's consistently failing, you're missing data.

"Can I test webhooks locally?"

Yes!

Lots of services have ways to test locally, but you can also use ngrok to create a public tunnel to your localhost.

"What if the same webhook gets sent twice?"

This happens all the time. Networks hiccup, timeouts occur, services retry.

Make your handlers idempotent.

Which means design it in a way to ensure you get consistent results!

In this case, even if webhook gets sent twice, it should output the same result as the first time.

The Bottom Line

Webhooks = "we'll tell you when we get there" instead of "are we there yet? are we there yet?"

Not magic. Not complicated. Just HTTP requests at the right time.

Thanks to everyone who submitted!

Find the Itinerary in Alphabetical Order

You are given a list of airline tickets, where each ticket is a pair [from, to] representing a flight from one airport to another.

Your task is to reconstruct the complete travel route in the correct order.

All trips start from airport "A".

If there are multiple possible routes, return the one that comes first in alphabetical order (when read as a single string).

Examples

findPath([["C", "F"], ["A", "C"], ["I", "Z"], ["F", "I"]])
output = ["A", "C", "F", "I", "Z"]

findPath([["A","C"],["A","B"],["C","B"],["B","A"],["B","C"]]
output = ["A","B","A","C","B","C"]
# Another valid route is ["A","C","B","A","B","C"],
# but it comes later alphabetically.

findPath([["Y", "L"], ["D", "A"], ["A", "D"], ["R", "Y"], ["A", "R"]])
output = ["A", "D", "A", "R", "Y", "L"]

Notes

  • Every ticket must be used exactly once.

  • There will always be at least one valid route.

  • When comparing routes alphabetically, for example:
    ["A", "B"] < ["A", "C"].

How To Submit Answers

Reply with

  • A link to your solution (github, twitter, personal blog, portfolio, replit, etc)

  • or if you’re on the web version leave a comment!

  • If you want to be mentioned here, I’d prefer if you sent a GitHub link or Replit!

Weekly Update: Idea for the newsletter

Every now and then, I want to share the process behind what I’m building with this newsletter.

Right now it's just me writing everything.

But what if I brought in other engineers sometimes?

People building cool things, solving tricky problems, or just wanting to share what they've learned.

Maybe short interviews. Maybe guest written posts. Maybe just a "here's how I solved this hard problem" section.

It'd keep the same Sloth Bytes vibe: simple, honest, practical, but with more voices and perspectives.

Why?

There are only so many topics I can explain well.  

I'd rather bring in people who can teach you/show you things I can't, rather than trying to explain concepts I don't fully understand yet just to keep the content flowing.

So I'm curious what you think:

Would you want to see other engineers featured here?

Login or Subscribe to participate in polls.

I’ll read every response and I plan on replying to everyone who writes back!

I want to really understand what you think and make this newsletter the highest quality it can be.

But that’s all from me!

Have a great week, be safe, make good choices, and have fun coding.

If I made a mistake or you have any questions, feel free to comment below or reply to the email!

See you all next week.

What'd you think of today's email?

Login or Subscribe to participate in polls.

Want to advertise in Sloth Bytes?

If your company is interested in reaching an audience of 50k developers and programming enthusiasts, you may want to advertise with us here.

Reply

or to participate.