Menu

Part 5: I wrote the guide that explains how an API calls you back.
📰

Part 5: I wrote the guide that explains how an API calls you back.

DEV Community: api·Joyce Foster·4 days ago
#AtvvbmfL
#devtoapi#devto#dev#troyal#webhooks
Reading 0:00
15s threshold

What if your API could call you?

That's what webhooks do, and I just wrote the webhooks guide for Troyal, my fictional royalty-tracking API. This follows the error codes guide, the changelog and the Jira board from last time.

An API mostly consists of you asking it for things. Webhooks are designed to flip that narrative so that Troyal tells you when something happens, like a royalty statement being generated, and so a developer doesn't have to keep checking.

The guide covers:

Setting up an endpoint and getting a signing secret.

The five events Troyal can send.

What an event looks like (the payload).

How to check a request really came from Troyal, with a short code example.

What happens when a delivery fails, and how retries work.

The part that took the most care was the signature check.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.