DEV Community

Nasrul Hazim Bin Mohamad
Nasrul Hazim Bin Mohamad

Posted on

Webhook: Part IV

So, we know how to create Webhook Provider application and Webhook Consumer application. So, what's next?

Here am sharing part of my experience developing both kind of application.

Webhook Provider

Provide an interface to store webhook consumers information

This is useful when your consumer are getting bigger. You need a way, to maintain it easily.

Provide options to consumer to choose what kind of Webhook events

I did not explain well on this, but basically what kind of event you want to listen to from Webhook provider - such as on user creation/update, new subscription, etc.

So, you Webhook Provider application don't have to send all webhook consumers. Only send to those subscribe to the particular events.

Webhook Consumer

Provide An Interface to Generate the Secret Key

You don't have to think of what secret key to use, let the codes do the work. Random string, 32 characters will be good.

Conclusion

So far it's a challenge for me to understand and manage what's needed for my team, to develop applications that can communicate well. I don't want to use API calls, as it's require maintaining the API token / key, plus there's other new applications want to use the same information. Hence, using webhook is much easier approach, just a little bit of learning curve.

Source Code can be found here:

p/s: I might come up with a small package to handle Webhook Consumers and Secret Key.

Top comments (0)