In this blog, we will see how to use Add to calendar link in Salesforce Marketing cloud email which will download an iCal or ICS file with all the information filled in dynamically using Ampscript and JavaScript.
We will achieve this using Cloud page. When customer clicks on the add to calendar link in the email then ICS file will automatically get downloaded.
You can use this concept not only to download ICS file but also txt, html and other files as well!
We will be using ICS file version 2.0. You can find a nice overview of ICS file format over here.
Below is the code which you can add it to the landing page:
If you are just confused about what properties you want to define in ICS file then you can find the complete properties here. You can use the same cloud page for different events as well by passing parameters in the cloud pages.
Now you can see using little snipped of JavaScript & ampscript we can make dynamic ICS file. Below is the GIF on how it works:
Please feel free to let me know if you find this article useful and leave your feedback/comment in case of any queries.
Happy Learning!