Hi everyone,
I’m integrating Wix Bookings V2 into my site and trying to send a confirmation email to clients when a booking is made and confirmed via backend code. Here’s what I’ve done so far:
export async function makeBooking(slot, contactDetails) {
const { booking } = await bookingsV2.createBooking({
totalParticipants: 1,
contactDetails,
bookedEntity: { slot },
});
const options = {
participantNotification: {
notifyParticipants: true
}
};
const result = await confirmBooking(booking._id, booking.revision, options);
console.log('[DBG] confirmBooking:', result);
return booking;
}
async function confirmBooking(bookingId, revision, options) {
try {
const elevatedConfirmBooking = elevate(bookingsV2.confirmBooking);
const result = await elevatedConfirmBooking(bookingId, revision, options);
console.log('[DBG] confirmBooking:', result);
return result;
} catch (error) {
console.error('[ERR] confirmBooking:', error);
return null;
}
}
The booking status returns as "CONFIRMED" is visible in my calendar and participantNotification.notifyParticipants is set to true. Everything looks correct in the logs.
numberOfParticipants":1,“status”:“CREATED”,“paymentStatus”:“UNDEFINED”,“selectedPaymentOption”:“UNDEFINED”,“participantNotification”:{“notifyParticipants”:true,"
numberOfParticipants":1,“status”:“CONFIRMED”,“paymentStatus”:“UNDEFINED”,“selectedPaymentOption”:“UNDEFINED”,“participantNotification”:{“notifyParticipants”:true,"
All email notifications are toggled ON under Bookings > Notifications You Send.
The service is set to automatically confirm bookings. The site is published, not in preview mode. The email is valid and tested with multiple providers. I use the normal booking system of wix for now and the email notification works. But i need more custom API bookings.
Despite all of this, no confirmation email is being sent to the email that booked. I also tried setting up a Wix Automation with the trigger “Booking Confirmed” and action “Send email to client,” but that didn’t work either.
How do I make my code to book and send an confirm email?
Thanks in advance,