home > support > API > webhooks > Booking Notification

Booking Notification Webhook

Notes

Called when one of several events happens on a booking (see "Triggers" below). Useful if you wish to:

  • Create your own vouchers
  • Syncronize a payment in TourCMS to your accounting system
  • Syncronize a new booking in TourCMS to an external reservation system
  • Syncronize customer data from a booking to an external CRM system

Triggers

One of the following events, related to the Flag notifications staff receive:

  • new_confirmed_staff - A new "Confirmed" status booking, made by staff *
  • new_confirmed_web - A new "Confirmed" status booking, made via the booking engine / API *
  • new_provisional_staff - A new "Provisional" status booking, made by staff *
  • new_provisional_web - A new "Provisional" status booking, made via the booking engine / API *
  • new_quotation_staff - A new "Quotation" status booking, made by staff *
  • new_quotation_web - A new "Quotation" status booking, made by the booking engine / API *
  • cancelled - A booking is cancelled
  • expq_quotation - A "Quotation" status booking is expired
  • expp_provisional - A "Provisional" status booking is expired
  • token_success - Successful payment from email request for payment (token)
  • token_failure - Unsuccessful payment from email request for payment (token)

* "New" booking notifications are also triggered when an existing booking changes status, e.g. a booking changing from "Provisional" to "Confirmed" would trigger the new_confirmed_web / _staff event.

Generally, the three primary events you should code for are: new_confirmed_web, new_confirmed_staff, cancelled

URL

Configure your URL in Configuration & Setup > Webhooks and TourCMS will immediately begin calling it when any of the above trigger.

Payload (Query string)

TourCMS appends query string parameters to your URL containing basic booking information (see table below), further details could then be obtained by calling the Show Booking API method.

The query string parameters may be extended in the future without warning.

Payload details

Payload details
KeyNotes
event Which of the Triggers caused the hook to fire
account_id TourCMS Account ID
account_name Name of the TourCMS Account
channel_id TourCMS Channel ID
booking_id TourCMS ID for the Booking (unique per account, not over the entire TourCMS system)


Payload example

Assuming you configure TourCMS with the following URL:

https://www.example.com/notify

TourCMS will call the following URL when a newly confirmed booking 1234 is made via the web on channel 3930 in account 4069 (testoperator):

https://www.example.com/notify?event=new_confirmed_web&account_id=4069&account_name=testoperator&channel_id=3930&booking_id=1234

The following sample PHP code shows grabs the TourCMS Booking ID and Channel ID from the query string (payload):

$booking_id = (int)$_GET['booking_id'];
$channel_id = (int)$_GET['channel_id'];

These could then be passed to the Show Booking API to get full details of the booking:

$result = $tourcms->show_booking($booking_id, $channel_id);
print_r($result);

Don't forget to ensure your code returns a 200 status response, that's the default in most cases unless there is an error. If you aren't sure you can check the status you are currently returning by entering a test URL in httpstatus.io.

Expected response

TourCMS looks for a 200 status code response, within 30 seconds of your code commencing.

If we do NOT receive this status code, the webhook will be called again until we do, or until 14 days of constant attempts have passed

Response format

n/a currently.

In the future TourCMS may allow adding a message to the booking audit trail. If you wish to future proof yourself for this, ensure you return a 200 status code on success and you may write out a message in JSON now, the format would be:


{
"text": "Your message goes here"
}

More information