I managed to setup SMS notifications for new booking requests etc, but when trying to include tokens in the SMS only these are working “user_name”, “listing_title” and “booking_dates” “booking_url”, however when i tried to get the “listing.location” “booking.phone” and more it came back empty, any solution for this?
Please provide more details on how you added this functionality and we will try to help (with PHP snippets, etc.). Also, please note that if some tokens work, then other tokens should work correctly if you have passed those tokens correctly to the PHP snippet. Alternatively, it may be that there is no location field or the booking does not have a phone attribute.
Thanks for your reply, however the tokens do work in my emails, so indeed they excised, im trying to do it using this php code, and only the title and user name are being populated correctly,
also wondering how can i target the phone number saved in the vendors profile (using a user attribute to save a number, not only for vendors)
Thank you very much,
// Extract tokens from the email object
$tokens = $email->get_tokens();
error_log('Extracted Tokens: ' . print_r($tokens, true));
// Extract details
$user_name = $tokens['user_name'] ?? 'Guest';
$listing_title = $tokens['listing_title'] ?? 'Unknown Listing';
$listing_location = $tokens['listing_location']->location->value ?? 'Unknown Location';
$booking_guests = $tokens['booking_guests']->guest->value ?? 'Unknown Guests';
$booker_phone = $tokens['booking_phone1']->phone1->value ?? 'Unknown Phone';
// Prepare SMS message
$message = sprintf(
"Hello %s, you have a new booking request for %s located at %s. Number of Guests: %s. Booker's Phone: %s. Please view online to approve or decline. Heimishe Apartments.",
$user_name,
$listing_title,
$listing_location,
$booking_guests,
$booker_phone
);
I have added a attribute to every user called “Phone Number”, so i want to retrieve that field so the SMS should be sent there for booking requests to the vendor and booking approved to the guest
I have managed to retrieve the recipients profile details, so now i can send the SMS to their phone number saved in profile, as of now im all done, thanks.