Is it possible to retry all failed webhook requests?

I had an issue on my side receiving the webhook requests and processing what I need. It was fixed but would be great If I could re-trigger all failed requests, instead of clicking one by one.
Is it possible for someway?

2 Likes

Hey Lucas,
Just to be sure, are you talking about the Redeliver button when you say “re-trigger” a request?

Yes, exactly this button.

But my question is if exists another way to reprocess many requests at the same time.

1 Like

I’m not aware of a built-in way. You can create a custom script that would do this:

  1. Through the API, get the list of the webhooks events at
    https://your-discourse.com/admin/api/web_hook_events/X.json
    Where X is your webhook ID.

  2. The endpoint lists the 50 last events. Use the offset query parameter to go further in the list. For example:
    https://your-discourse.com/admin/api/web_hook_events/1.json?offset=50

  3. Loop through every returned event. For each event, do a POST request to
    https://your-discourse.com/admin/api/web_hooks/2/events/XXX/redeliver
    Where XXX is the event’s ID.

  4. Because of the API rate limit, wait at least a few seconds between each API call.

Tested and working :+1:

And thanks @Lucas_Alves for learning me about the offset parameter :slight_smile:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.