question

mark-2 avatar image
mark-2 asked

Is there more documentation on webhooks?

I have been experimenting with intercepting PlayStream events with a Webhook. Is there more documentation for this?

The HTTP endpoint must accept a POST method and the contents of body is stringified JSON of the PlayStream event and not base64 encoded.

Is the Webhook always called once per PlayStream event?

Anything else I should know?

PlayStream
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
brendan avatar image
brendan answered

Yes, that's pretty much the whole of it - all calls are to the Web API endpoint you specify, the body of the message is specifically the JSON body of the event, and the webhook is called for any event that matches the filter you specify. We'll get the webhook page updated with a brief summary of this.

8 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

mark-2 avatar image mark-2 commented ·

How do HTTP status codes returned by the Webhook affect the PlayFab caller of the Webhook? Does it always expect 200? If the Webhook responds with a code (200, 400, 404, 500, 503 or others) will it signal PlayFab caller to try back later?

0 Likes 0 ·
brendan avatar image brendan mark-2 commented ·

We do expect to get a 200 back, yes. If the response is anything other than a 200, we will retry the call up to 4 times.

0 Likes 0 ·
mark-2 avatar image mark-2 brendan commented ·

What are the retry time periods? Send, if not 200 OK then wait 5 minutes and try again ...

Let's say I POST request A to the webhook (result of PlayStream event A) and get a 500 error. The 5 minute wait before retry is for the entire webhook correct? Not just for request A? So PlayStream events B, C, D, etc. are blocked from going through the webhook until request A gets a 200 status code?

If after 4 tries the webhook doesn't return a 200 for request A, then what happens? Does it then try 4 times for request B? Do you have to do anything to reset a webhook that has failed 4 times?

0 Likes 0 ·
Show more comments
Heartman avatar image Heartman commented ·

Sorry to resurrect this thread but we are interested in the answer to the question left unanswered here:

If a webhook is taking very long will this block this or even all webhooks from subsequent events from being called in the meanwhile?

Also what when it is waiting for a retry?

0 Likes 0 ·
brendan avatar image brendan Heartman commented ·

The webhook logic retries using an exponential backoff if the endpoint fails to respond. It will do this for 24 hours. If the server at the endpoint still isn't responding after 24 hours, the event will be dropped from the queue.

0 Likes 0 ·
Heartman avatar image Heartman commented ·

What I mean is, let's say event A happens and 10 seconds after A event B happens

The webhook called by event A need 2 minutes to complete and reply 200

Will the webhook for event B be called straightaway or will it have to wait 1 minutes and 50 seconds for the call of event A to complete first?

0 Likes 0 ·
brendan avatar image brendan Heartman commented ·

The webhook call will be made for event B as soon as it is ingested. If event A is waiting on a re-try, that does mean event B may be sent to your endpoint before event A.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.