Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save HubSpotHanevold/f2d228209839437a97b0bfb9ca0a97e0 to your computer and use it in GitHub Desktop.
Save HubSpotHanevold/f2d228209839437a97b0bfb9ca0a97e0 to your computer and use it in GitHub Desktop.
{# 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