Troubleshooting Webhooks

So this is more of an informative post than a plea for help, as I’ve figured it out myself already.

I decided I wanted Patreon to send a webhook to my Discord for each kind of pledge event to notify me. I created a webhook via their Create Webhook page (not programatically), and then set about doing my code.

  • Note: Signature doesn’t match? Make sure your signature is being passed as a bytestring, decoded from utf-8.

Soon, using the test webhooks, I got everything working. It was reliably firing when I used a test … then failed on actual webhook fires. Upon digging in, here is what I’ve noticed:

The test webhooks have a completely different payload than the actual webhooks. For example:

  • while you can access the campaign_total_cents in the test hooks, it is nowhere to be seen in the actual hooks.
  • what is listed as pledge_amount_cents in the test hook is currently_entitled_amount_cents in the actual hook. Nowhere is the previous key mentioned.
  • sometimes the orders of nested dictionaries change between each posted hook!

So, to add to the recent sentiment of “maybe don’t use the test webhooks” – yeah, maybe don’t use the test webhooks. Make a dummy account and do your testing with a buck or two that way. It sucks that we have to do that, but the existing tests are not a reliable way to test.

I am a baby coder, so if I got anything wrong feel free to correct me in the replies. But at least if someone is struggling with their webhooks, maybe this info will help them explore more options.

And as a side note, I hope someday Patreon POSTs will stop triggering twice, once with a $0 pledge and once with the actual pledge amount.

Godspeed y’all.

1 Like