Every event shares the same payload format. However, the data in the "data" property of the payload will be distinct as per the event type.
The standard envelope for webhook payloads is:
{ "event": "<event>", "data": { "event type data payload": "..." } }
Each event has its own data format. The data format is an exact copy of what the API would have returned when the event was triggered.
For more information on the API data responses, read the API docs here: http://iws.api.docs.painchek.com/painchek-api-user-guide/
Webhooks events are coupled with a corresponding API endpoint. When a webhook event is triggered, the data that was in the response to the client calling the API will be sent in the webhook.
This data is immutable. All retry sends of a webhook will contain the same data payload as the original attempt.
This ensures any change to the underlying data will not result in a change to the data the webhook sends for the specific event trigger.
The payload for an assessment_add event webhook might look like this:
POST /payload HTTP/1.1 X-PainChek-Webhook-Id: 45352119-04e5-4549-8245-79c27e156374 X-PainChek-WH-Delivery-Id: 72d3162e-cc78-11e3-81ab-4c9367dc0958 X-PainChek-WH-Signature: sha1=7d38cdd689735b008b3c702edd92eea23791c5f6 Content-Type: application/json { "event": "assessment_add", "data": { "uuid": "03824b1c-e7f4-4898-bc82-3ec7d39232f9", "patient": "9c2fa320-f080-4f2f-bc30-d5f2234c675e", "user": "c5fff8fd-e022-4ba4-a35d-ddee6b9fa276", "json_version": "v2", "created_at": "2018-04-16T00:42:01.714000Z", "modified_at": "2018-04-16T00:42:05.109000Z", "deleted_at": null, "update_stamp": 265901, "device": "85352119-04e5-4549-8245-79c27e1cddda", "device_id": "85352119-04e5-4549-8245-79c27e1cddda" "data": { "assessment": { "date": "2018-04-16T00:42:23.410248Z", "mode": "painchek", "pain_score": 0, "pain_level": "none", "is_editable": false, "timing": null }, "face": { "mode": "video", "initial_mode": "video", "camera": "front", "capture_seconds": 3, "frames": 20, "frame_errors": 0, "comment": null, "score": 0, "descriptors": { "brow_lowering": false, "cheek_raising": false, "tightening_eyelids": false, "wrinkling_nose": false, "raising_upper_lip": false, "pulling_corner_lip": false, "mouth_stretch": false, "parting_lips": false, "closing_eyes": false } }, "...": "..." }, } }