Webhook Retries
When sending a webhook, PlayHQ will expect to receive a 200 HTTP status code response to indicate that an endpoint has successfully received the webhook and its data.
If no response is received or the response code is outside of the 2xx successful range, the webhook will be requeued for later delivery. Multiple retries will be attempted, with a increasing delay following each subsequent failed attempt at delivery in order to provide an opportunity for the endpoint or network conditions to improve.
Multiple delivery
Because messages can be delivered multiple times due to not receiving a successful response code, it is possible for a single webhook message to be received by an endpoint multiple times. There are a few possible ways to deal with this.
- Most messages will be idempotent, representing the full current state of a record. So in many cases processing the same message multiple times is completely fine.
- All webhooks will contain a
messageId
field, which will remain the same for each delivery attempt. So thismessageId
could be used to detect whether you have previously handled the given message.
Out-of-order delivery
Effort will generally be taken to deliver events in the order they were raised within the platform. However because there is a delay introduced before failed messages are redelivered, it is still possible for out-of-date messages to arrive after a subsequent message has invalidated its content.
- All webhooks will contain an
eventRaisedDateTime
field, which indicates the time at which the event occurred in PlayHQ. ThiseventRaisedDateTime
field could be used alongside theentityId
field to determine if this is the most recent event for this entity, and throw away any older data