# Booking Created or Updated Webhook

All new bookings or any change that affect bookings previously created should trigger a call to a Wherewolf endpoint, this will cause Wherewolf to fetch the new or updated details.

## Cancellations
A cancellation or deletion also needs to trigger a call to Wherewolf, this is required so any pending jobs can be also cancelled.

**Note:** already checked-in guests will not have their details updated.

## Headers:
- `Content-Type: application/json` required to indicate the body structure.

## Body:
- `id` id to indicate the booking to be fetched.
- `key` API key provided by Wherewolf.
- `pool` string to identify the target Wherewolf app.

## Request example

```
curl -X POST \
  https://api.wherewolf.co.nz/integration/cache \
  -H 'Content-Type: application/json' \
  -d '{\n        "id": "ABC123",\n        "key": "api_key_provided_by_wherewolf",\n        "pool": "wherewolf_app_identifier"\n}'
```

## Response example

```
{
  "success": true,
  "bookings": [\
    {\
      "id": "ABC123",\
      ...\
      "web": {\
        "preArrival": "https://mono.wherewolf.co.nz/QWER12"\
      }\
    }\
  ]
}
```

## Response structure details:
- `success` indicates if we were able to process the payload.
- `bookings` is an array that either will contain 1 item to describe the received booking or be empty. A success response with an empty array indicates Wherewolf accepted the booking but the booking is being ignored, some causes for Wherewolf to ignore bookings are: there is no valid configuration for the product/activity of the booking or the booking status does not indicate it is an active and enabled for use.
- `bookings[0].web.preArrival` when present, is the link that participants of the booking can use to sign waivers. This link can be stored by the booking system and then shared with the participants of the booking. NOTE this might not be present if Wherewolf is not configured with the correct TsCs for the activities/products specified in the booking.
- `bookings[0].web.base` when present, is the link that participants of the booking can use to sign waivers. This link can be stored by the booking system and then shared with the participants of the booking. NOTE this might not be present if Wherewolf is not configured with the correct TsCs for the activities/products specified in the booking.

## Pre-arrival links `preArrival` vs `base`:
`preArrival` is the legacy name given to these links, newer apps will return with `base` instead of `preArrival`. When `base` is present, it should be used instead of `preArrival`.
