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)