cdwyer Posted May 25, 2017 Posted May 25, 2017 Hi all, I am trying to add a button to my website that allows customers to 'subscribe' to our calendar. Currently, the button just downloads the .ics file and adds the events in our calendar to the customers own calendar but doesn't automatically update when we add new events. Has anyone successfully added a 'subscribe' button that will actually grant customers access to our calendar where they will receive live updates? Any help would be very much appreciated. Thank you!
SimonHooker Posted May 25, 2017 Posted May 25, 2017 (edited) Hi there, I've had a lot of .... fun implementing this functionality. The main problem that you will come across is that you have no control over how frequently or infrequently Google polls the calendar feeds. Typically it seems to poll about once every 24 hours which is far from ideal. You will struggle to get it fully-live. There are solutions out there that can help you with this but you will still find yourself up against how infrequently Google imports the data. That caveat aside, there is an undocumented method of requesting that Google add a calendar, which is that you send the user to the following URL (if you click this you will see it try to add the dummy URL as a calendar): https://calendar.google.com/calendar/render?cid=http://www.yourdomain-here.com/some/link/to/an/ics/file.ics Here's where it gets a little complicated. First up, Google does not accept a https URL there. It will successfully redirect http to https though so don't worry about that if your webserver is set up to properly redirect. Secondly, especially if you have any url parameters, make sure that your cid parameter is properly URI encoded. Finally, Google Calendar likes to just not do anything if the ical feed does not validate. Expect to spend a long time tweaking your feed to get it to validate just right for google. If you search around you can find plenty of online tools to validate your data though. I recommend using at least a couple of them, as none of them seem wholly reliable however if you can get your feed to validate in more than one you're probably on the right tracks. This method used to be documented but all aforementioned documentation seems to have disappeared from the internet a couple of years ago. There is a second way which can potentially work but relies on users clicking the right buttons in their browser. If you direct the user to webcal://www.yourdomain-here.com/some/link/to/an/ics/file.ics then, depending on their browser settings, that will get picked up by their calendar software. There's also an option for Outlooks web client but that's another story. Good luck! Edited May 25, 2017 by SimonHooker 1
cdwyer Posted May 25, 2017 Author Posted May 25, 2017 Thank you very much for this, I will go away and have a look at everything you have highlighted!
mavhc Posted September 21, 2017 Posted September 21, 2017 Add a webcal:// link to your ics file for iOS etc users, the straight http link to the ics file will just import a static list of events
jthompson Posted September 21, 2017 Posted September 21, 2017 How about this? This is what we do to publish our terms dates for anyone to add to Google Calendar. In Google Calendar: Share this Calendar (drop down next to the calendar name) Make this calendar public (tickbox) Calendar Details Under Calendar Address, grab the HTML link. The HTML link shows the calendar as a webpage, but there's a "+Google Calendar" button in the bottom right which will allows the user to add the calendar to their own Google account (i.e. subscribe to it). It all works nicely if they add their Google account to an iPhone, Mac, etc.
mavhc Posted September 21, 2017 Posted September 21, 2017 I provide 3 links, Subscribe on GCal (https://www.google.com/calendar/render?cid=http%3A%2F%2F....) for people with a google account webcal://... draft standard, works on apple stuff and a plain link to the ics file, for people who know what they're doing
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now