DEV Community

Dinesh S
Dinesh S

Posted on • Updated on

How I built SetProgress - Part 4 Webhooks

In the last few posts I have explained how I built waitlist, progress bar & the automation. In this post, I will talk about how & why I added Webhooks to the app.

Webhook Integration

In the previous post I wrote about how I automated 100DaysOfCode progress. That automation is very limited as it just works only based on HashTags. The idea of adding a Webhooks endpoint was born from there.

Implementing this is quite simple. All I have to do is to expose an api /api/users/external-progress which accepts currentProgress in the request body. Users have to send their currentProgress to this endpoint to update their progress.

The api is pretty simple, but how do we identify the user whose progress is to be updated?

Here is where the unique secret comes in handy. Each user gets a secret which is unique to them. They have to set this key in the header of the endpoint. You might ask why secret and why not user id? User Id can be obtained easily which allows a bad actor to update the progress of another user. We don't want that, hence the secret. If user feels that their secret is compromised, then they can generate a new one from the settings page.

Now that we have an endpoint, users can make use of NoCode tools like Zapier, Integromat, Integrately etc to automate their progress updates.

Use cases

  • Update MRR
  • Update your running mileage

Top comments (0)