Hi, I am trying to create and appointment booking bot for WhatsApp.
I want to create the a Dynamic Block for getting Upcoming Dates so that people can select the date they want to book and appointments.
i tried asking ChatGPT for generating script
function getUpcomingDates(daysCount) {
const today = new Date();
const upcomingDates = [];
for (let i = 1; i <= daysCount; i++) {
let futureDate = new Date();
futureDate.setDate(today.getDate() + i);
// Format the date as 'YYYY-MM-DD'
const formattedDate = futureDate.toISOString().split('T')[0];
upcomingDates.push(formattedDate);
}
// Set the upcoming dates in a Typebot variable
setVariable('upcomingDates', upcomingDates);
}
// Call the function to get 5 upcoming dates and store them in 'upcomingDates'
getUpcomingDates(5);
but it dint work, is there any solution or other way around to approach this ?