home > support > API > send booking email

Send booking email

Send one of the pre-configured email templates.

Notes

Will send to the customer/agent/other email addresses as configured in TourCMS (in Channel Manager > Email Templates).

For use by Tour Operator accounts only (not Marketplace Agents).

REST info

Endpoint/c/booking/email/send
FormatsXML
ExampleURL: /c/booking/email/send.xml
 
POST data:
<?xml version="1.0"?>
<booking>
	<booking_id>12345</booking_id>
	<email_type>1</email_type>
</booking>
VerbPOST


 Code samples

PHP examples use the PHP Client Library with SimpleXML

Description

object send_booking_email ( SimpleXmlElement $booking_data, int $channel )


Parameters

$booking_data
SimpleXmlElement containing the booking data
$channel
ID number for the channel the booking is being made with

Example


// Set the channel this booking will be made with
$channel = 3930;

// Start building the booking XML
$booking_data = new SimpleXMLElement('<booking />');

// Set the ID for the booking to send an email as
$booking_data->addChild('booking_id', 'BOOKING_ID_HERE');

// Set the email template type to send, as configured via Channel Manager > Email templates
$booking_data->addChild('email_type', 'EMAIL_TYPE_HERE');

// Query the TourCMS API, sending one of the pre-configured email templates
$result = $tourcms->send_booking_email($booking_data, $channel);

// Check the result, will be "OK" if the the email has been sent without errors
switch ($result->error) {
    case "OK":
		// Print a success message
	    print "Thanks, the email has been sent.";
	    break;
	default:
		// Some other problem (could check error to see what)
	    print "Sorry, unable to send the email at this time.";
	    break;
}
			

Thanks, the email has been sent.
			

C# examples use the .Net Client Library

Code sample here soon

VB examples use the .Net Client Library

Code sample here soon

NodeJS examples use the NodeJS Wrapper

Example

// Trigger booking email
TourCMS.sendBookingEmail({
    channelId: 3930,
    booking: {
      booking_id: 12920,
      email_type: 1
    },
    callback: function(response) {
      console.log(response.error);
    }
  });
OK

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


 Post fields

Post fields
XML NodeNotes
booking

The root XML element

XML NodeNotes
booking_idThe ID for the booking to send an email as
email_typeThe email template type to send, as configured via Channel Manager > Email templates:
 
1 - New booking email
2 - Provisional email
3 - Confirmed booking email #1
4 - Pre-trip #1 email
5 - Post-trip #1 email
6 - Expired quotation email
7 - Expired provisional email
8 - Ad-hoc mass email
9 - Balance due SOON email
10 - Balance due NOW email
11 - Balance OVERDUE email
12 - Quotation booking chaser email
13 - Provisional booking chaser email
14 - Mid-trip email
15 - Booking anniversary email
16 - Post-trip #2 email
17 - Payment acknowledgement email
18 - Deposit chaser email
19 - Pre-trip #2 email
20 - Pre-trip #5 email
21 - Supplier notification (Confirmed)
22 - Payment failed email
23 - Pre-trip #3 email
24 - Pre-trip #4 email
28 - Confirmed booking email #2
29 - Cancel email #1
30 - Cancel email #2
31 - Payment refund email
32 - Supplier notification (Cancel)

 
Response fields

Response fields
XML NodeNotes
request Confirmation of the request that you sent
error Any error message returned, if there is no error this will just contain the text OK.

More information