3 ms·
Also, in your documentation, please show what the webhook events will look like since developers actually want to write code and not guess at what we will get.
by madamelic 10y ago
Also, in your documentation, please show what the webhook events will look like since developers actually want to write code and not guess at what we will get.
cough Stripe. (https://stripe.com/docs/api#events https://stripe.com/docs/api#events)
- enraged_camel 10y agoYou don't have to guess anything. Stripe lets you send test webhooks to the endpoint you specify[1]. You can set up something like ngrok[2] on your localhost to examine the headers and bodies, then write your code to parse them accordingly. [1]http://i.imgur.com/oCpxYwE.png http://i.imgur.com/oCpxYwE.png [2]https://ngrok.com/ https://ngrok.com/
- madamelic 10y agoYeah, that is one method. I also learned about services that will set up test webhooks without having to go about setting up a server, etc. I think I might use that, but I still think that docs should at least explain what will get sent. Maybe that is a bit too verbose in Stripe's case though.
- brandur 10y agoThe implication was meant to be that the information under `data/object` is simply a full representation of another API resource of the type on which the event occurred, and that you can look elsewhere in the documentation to see exactly what each type will look like (you can see a subscription embedded in the sample response for example). Fair enough that we could rewrite this to be more explicit about that though! We'll see what we can do to make that section more clear. (I work for Stripe.)
- madamelic 10y agoThis is what I love. I purposefully talk about Stripe on here just because I know Stripe people browse HN. Stripe is great though. :)