home > support > API > send booking email
Send one of the pre-configured email templates.
Will send to the customer/agent/other email addresses as configured in TourCMS (in Channel Manager > Email Templates).
For use by Tour Operator accounts. Marketplace agents can use this endpoint only if they have permission and are sending the proper email type.
Endpoint | /c/booking/email/send |
Formats | XML |
Example | URL: /c/booking/email/send.xml POST data:
|
Verb | POST |
PHP examples use the PHP Client Library with SimpleXML
object send_booking_email ( SimpleXmlElement $booking_data, int $channel )
// 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
// 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
XML Node | Notes | ||||||||
---|---|---|---|---|---|---|---|---|---|
booking |
The root XML element
|
XML Node | Notes |
---|---|
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. |