Created
June 12, 2024 19:53
-
-
Save HubSpotHanevold/2892f723598399ca76d33494970bb237 to your computer and use it in GitHub Desktop.
Putting calendar meeting times into an email
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {# NOTE THESE CAN ALL BE ADJUSTED TO USE PLACEHOLDER VALUES INSTEAD OF DEFINED IN THE CODE #} | |
| {# START AND END TIMES FOR THE EVENT #} | |
| {% set google_start_time = "T230000Z" %} | |
| {% set google_end_time = "T240000Z" %} | |
| {% set outlook_start_time = "T23:00:00+00:00"|urlencode %} | |
| {% set outlook_end_time = "T24:00:00+00:00"|urlencode %} | |
| {# STATIC VALUES - DEFINED #} | |
| {% set event_title = "Sample webinar title"|urlencode %} | |
| {% set event_description = "Sample webinar description (will go in description area of invite)"|urlencode %} | |
| {# VALUES FROM CONTACT RECORD #} | |
| {% set event_location = contact.SWITCH_OUT_FOR_PROPERTY_INTERNAL_NAME %} | |
| {% set event_start_date = contact.SWITCH_OUT_FOR_PROPERTY_INTERNAL_NAME %} | |
| {% set google_event_start_datetime = event_start_date|format_date('yyyyMMdd') + google_start_time %} | |
| {% set google_event_end_datetime = event_start_date|format_date('yyyyMMdd') + google_end_time %} | |
| {% set outlook_event_start_datetime = event_start_date|format_date('yyyy-MM-dd') + outlook_start_time %} | |
| {% set outlook_event_end_datetime = event_start_date|format_date('yyyy-MM-dd') + outlook_end_time %} | |
| {# END VARIABLES #} | |
| {# BUILD LINKS FOR EACH CALENDAR TYPE #} | |
| {% set google_cal_url = "https://calendar.google.com/calendar/render?action=TEMPLATE&dates=" + google_event_start_datetime + "%2F" + google_event_end_datetime + "&details=" + event_description + "&location=" + event_location + "&text=" + event_title %} | |
| {% set outlook_cal_url = "https://outlook.live.com/calendar/0/action/compose?allday=false&body=" + event_description + "&location=" + event_location + "&subject=" + event_title + "&rru=addevent&path=%2Fcalendar%2Faction%2Fcompose" + "&startdt=" + outlook_event_start_datetime + "&enddt=" + outlook_event_end_datetime %} | |
| {# CREATE BUTTONS THAT HAVE THE URL SET AS THE CALENDAR LINKS FROM ABOVE #} | |
| <div style="float: left; width: 100%; text-align: center; margin-top: 1px; margin-bottom: 1px;"> | |
| <div style="float: left; width: 100%; margin-bottom: 1px;"> | |
| Add to calendar: | |
| </div> | |
| <div style="float: left; width: 100%;"> | |
| <a href="{{ google_cal_url }}" title="Save Event in my Calendar" style="margin: 10px; padding: 10px; background-color: #ffffff; color: white; text-decoration: none; border-radius: 2px;"><img src="https://21420236.fs1.hubspotusercontent-na1.net/hubfs/21420236/Calendar%20Buttons/google-calendar.png" style="width: 50px;"></a> | |
| <a href="{{ outlook_cal_url }}" title="Save Event in my Calendar" style="margin: 10px; padding: 10px; background-color: #ffffff; color: white; text-decoration: none; border-radius: 2px;"><img src="https://21420236.fs1.hubspotusercontent-na1.net/hubfs/21420236/Calendar%20Buttons/outlook.png" style="width: 50px;"></a> | |
| </div> | |
| </div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment