Create a live iCalendar feed (ics)

Is there way for Wappler to create an iCal feed file (.ics)? I have a database of a schedule of events, and I am wanting to create a live iCalendar feed of the events. Any suggestions?

1 Like

Anyone any ideas on this one?

1 Like

I actually just put this in a couple weeks ago as a module using https://www.npmjs.com/package/ics

1 Like

Care to share the module?

I haven’t really built it to share (specific to my use case, no documentation, doesn’t support all the features), but happy to provide it to get you started. It creates an .ics file for the event, which you can then use in a File Download action.

ics_module.zip (2.2 KB) etc.)

1 Like

I’d love to see this as a Feature Request. I would love to be able to do this but it is way beyond my capabilities.

Perhaps some sort of .csv converter? Seems that is a popular way to go and we can already download .csv files.

https://www.google.com/search?q=create+ics+file+from+csv

1 Like

Thanks @mebeingken will take a look

Why not create a request then? Go Brad!

1 Like

Because I am not sure what to request exactly as I am clueless to if this can even be done. Would also need to export to other calendar such as Android and Windows which I no exactly nothing about their calendars. :wink:

1 Like

We work with PHP and not Nodejs… so dont know if this will be a solution for you guys…

@brad @Hyperbytes

but happy to share this with you… it creates a vcs but im sure you can just change it to ics… not sure

We just pass the variables that is needed to our PHP page… and it generates it…
Just change the “variables” to what you need it to be…

    	<?php
$EventNameFile = $_GET['event_name'];
$EventNameFile = preg_replace('/\s+/', '_', $EventNameFile);
$Filename = $EventNameFile . ".vcs";
header("Content-Type: text/x-vCalendar");
header("Content-Disposition: inline; filename=$Filename");

$startdate = $_GET['event_start_date'];
$enddate = $_GET['event_end_date'];

$starttime = $_GET['arrival_time'];
$endtime = $_GET['end_time'];

$combined_starttime = "$startdate" . "$starttime";
$combined_endtime = "$enddate" . "$endtime";

$unixstarttime = strtotime($combined_starttime);
$unixendtime = strtotime($combined_endtime);

$vCalStart = date("Ymd\THi00", $unixstarttime);
$vCalEnd = date("Ymd\THi00", $unixendtime);

$vEvent = $_GET['event_name'];
$vLocation = $_GET['venue_city'];
$vContactPerson = $_GET['contact_person_name'];
$vContactEmail = $_GET['contact_person_email'];
$vContactNumber = $_GET['contact_person_mobile'];
$vContent = $_GET['template_wording_register'];
?>
BEGIN:VCALENDAR
VERSION:1.0
PRODID:<?php echo $vEvent . "\n"; ?>
TZ:-07
BEGIN:VEVENT
SUMMARY:<?php echo $vEvent . "\n"; ?>
DTSTART:<?php echo $vCalStart . "\n"; ?>
DTEND:<?php echo $vCalEnd . "\n"; ?>
LOCATION:<?php echo $vLocation . "\n"; ?>
DESCRIPTION;ENCODING=QUOTED-PRINTABLE:=
<?php echo $vContent; ?>
=0D=0A=0D=0AFor more information, please contact <?php echo $vContactPerson; ?> on <?php echo $vContactEmail; ?> or <?php echo $vContactNumber; ?>.
END:VEVENT
END:VCALENDAR
1 Like

Anyone done this with Node? I got it to work in PHP…

But im new to the Node side of things… anybody tried it…

Here you have a nodejs library.

You could build a custom extension for it. Could be useful for others and it’s a nice way to learn. Remember, nodejs is just javascript running on a server :wink:

1 Like

thanks Jon… busy converting my php site that i was dreading to node… so far so good… just one or two things i did in php that i have no clue about in node… but ill get there… but ill post a full review on your infamous topic " Why I stopped creating PHP projects with Wappler and why you probably should too" … heheh … just to list my experience…

thanks for the help.

1 Like

Hi thanks for providing this module…
I have installed it…
I have installed npm ics
Could you perhaps share your settings / eg screenshot?
As I want to figure out where im going wrong…

Can anybody … do a small screen grab on how to execute the node once i have installed it…
I have watched videos on youtube… but im missing something clearly…
Once i have installed the npm… i create a file eg… app.js in the root…

but this is where i get totally stuck… how do you execute or call this node app.js ???
In the terminal i type node app.js… it outputs correctly in the log…

My question is… now on my page… say index.js within the (VIEWS) folder… how do i “execute” this app.js to run? sorry if this is a stupid question… but i have to ask as this is where i dont understand…

Anybody that can do a video on how to do this one? So that i can learn and do the next one?

The extension expects a datetime formatted value (eg .formatDate('yyyy-MM-dd HH:mm')

1 Like

Thanks Ken - Much appreciated… it helped me alot… thank you for this

Thanks to Ken for this Module. @mebeingken

I have updated it a little bit to allow for Location * Not required
And also added a default value in the date so that one can see the format it needs to be.

ken1

You can download it here …
ics-modules-updated.zip (1.6 KB)