TourCMS, a leading online booking and channel management solution is operated by Palisis.

Contact Info

Palisis AG
Florastrasse 18A
8610 Uster
support@palisis.com
+41 44 533 40 40

Follow Us

home > support > API > Trigger Booking Webhook

Trigger Booking Webhook

Manually trigger a booking notification webhook on demand for a booking.

Notes

For use by Tour Operators only (not Marketplace Agents). If you modify a booking via the API you can use this method to notify your configured integrations of the change, allowing them to pull in the latest details.

Currently only the asynchronous modified_booking event can be triggered. The event must be enabled on at least one asynchronous webhook (it is inactive by default) whose channel and tour scope match the booking — TourCMS will queue a notification to each matching webhook and return the list of URLs notified.

The modified_booking event is not intended for cancellations, payments or redemptions, those have separate events already.

REST info

Call /api/booking/webhook/trigger
Formats XML
Example URL: /api/booking/webhook/trigger.xml
 
POST data:
<?xml version="1.0"?>
<booking>
  <booking_id>12345</booking_id>
  <event>modified_booking</event>
</booking>
Verb POST

Post fields

The following fields should be posted as XML when calling the API, both are required.

Post fields
XML Node Notes
booking_id TourCMS ID for the booking to notify about. It can also be its UUID in case it has one.
event The webhook event to trigger. Currently only modified_booking is accepted.

Code samples

PHP examples use the PHP Client Library with SimpleXML

Description

object trigger_booking_webhook ( int $booking, string $event, int $channel )


Parameters

$booking
ID number (or UUID) for the booking to notify about
$event
The webhook event to trigger (currently only modified_booking)
$channel
ID number for the channel the booking belongs to

Example

// Set the channel ID
$channel = 3930;
// Which booking to notify about
$booking = 1234;
// The event to trigger
$event = "modified_booking";

// Call TourCMS API, triggering the webhook notification
$result = $tourcms->trigger_booking_webhook($booking, $event, $channel);

// Check the result, will be "OK" if the notification(s) were queued
if ($result->error == "OK") {
    // Print out each webhook URL that was notified
    foreach ($result->webhook_notifications->webhook_url as $url) {
        echo $url . "\n";
    }
} else {
    // Some problem, e.g. NO_MATCHING_DATA / NO_MATCHING_EVENT / UNPROCESSABLE_EVENT
    print $result->error_message;
}
https://www.example.com/webhook

NodeJS examples use the NodeJS Wrapper


Example

TourCMS.triggerBookingWebhook({
  channelId: 3930,
  booking: {
    booking_id: 1234,
    event: "modified_booking"
  },
  callback: function(response) {
    console.log(response.error);
  }
});
OK

Looking for sample code in a different language? TourCMS and community provided API libraries

Implementing yourself? Check the REST info for this endpoint.

Try it

Enter your TourCMS API credentials below to call the Trigger Booking Webhook endpoint.

Take care, submitting this form will modify live data!


            
            

Response fields

Response fields
XML Node Notes
request Confirmation of the request that you sent
error OK if the notification(s) were queued, otherwise NOTOK (see error_message).
error_message Only present when error is NOTOK. One of the error codes below.
webhook_notifications Only present on success. Contains a webhook_url child node for each webhook endpoint URL queued to be notified.


Error messages

Error messages
error_message Notes
NO_MATCHING_DATA No booking was found for the supplied booking id / uuid on this channel.
NO_MATCHING_EVENT The supplied event is not a recognised booking event.
UNPROCESSABLE_EVENT The event exists but cannot be triggered on demand yet (currently only modified_booking can).
INSUFFICIENT_BOOKING_USER_PERMISSION The API user does not have permission to edit this booking.


Response example

<?xml version="1.0" encoding="UTF-8"?>
<response>
  <request>POST /api/booking/webhook/trigger.xml</request>
  <error>OK</error>
  <webhook_notifications>
    <webhook_url>https://www.example.com/webhook</webhook_url>
  </webhook_notifications>
</response>

More information