JSON Bulk Download
Apoioedu Tech
Function for bulk downloading JSON files from module executions from past scenario runs
Log In
gis souza
//n8n receives several items, let's go through each of them
for (const item of $ input.all ()) {
//1. Here we capture the data that comes from Google Calendar
//Note: Make sure that the name of the fields below matches what the Calendar node gives you
const CustomerName = item.json.summary || “Client”;
const DateTime = new Date (item.json.start.dateTime) .toLocaleString ('en-GB', {
day: '2-digit',
month: 'long',
hour: '2-digit',
minute: '2-digit'
});
//2. We extracted the phone. If it's not in the summary, we try to get it from another field
const phone = item.json.description? item.json.description.match (/\ d {10.15}/): “”;
//3. We assemble the formatted text for WhatsApp
const message =
Hi $ {CustomerName}! Your waxing appointment is confirmed! 🎉\n\n
+📅 Date & Time: $ {DateTime}\n
+📝 Service: Waxing Treatment\n
+💳 Payment Status: Pending\n\n
+We look forward to seeing you! If you need to cancel or reschedule, please let us know.
;//4. We created the new fields that the next node (WhatsApp) will read
item.json .client_name = CustomerName;
item.json .client_phone = telephone;
item.json .message_text = message;
}
return $ input.all ();