-
Notifications
You must be signed in to change notification settings - Fork 11
Extra Customization
The script supports a number of customizable options that are configured using the constants declared at the very top of the script.
This section of code will look similar to the following:
const NAME_NOTION = "Name";
const DATE_NOTION = "Date";
const TAGS_NOTION = "Tags";
const LOCATION_NOTION = "Location";
const DESCRIPTION_NOTION = "Description";
const EVENT_ID_NOTION = "Event ID";
const CALENDAR_NAME_NOTION = "Calendar";
const CALENDAR_ID_NOTION = "Calendar ID";
const LAST_SYNC_NOTION = "Last Sync";
const ARCHIVE_CANCELLED_EVENTS = true;
const DELETE_CANCELLED_EVENTS = true;
const IGNORE_RECENTLY_PUSHED = true;
const CANCELLED_TAG_NAME = "Cancelled/Removed";
const IGNORE_SYNC_TAG_NAME = "Ignore Sync";
If you're even just a little familiar with coding, then you should be able to modify these without much issue. If not, please read the formatting instructions and terminology guide below before continuing!
Formatting instructions and terminology guide:
A constant in this context is simply a type of variable that won't be modified during runtime execution. Technically the constants that we care about for these customization options are specifically global constants which just means the entire script can access them. Realistically you just need to understand that the constants we are referring to are just a special kind of variable. A variable being something that we can assign a value to, like how you might say x is a variable with the value 1 with x = 1.
This script uses the Google Apps Script platform/language which is based on JavaScript so if you're familiar with that, note that Google Apps Script syntax is very much like JavaScript's! In Google Apps Script, the platform/language that this script uses, a constant syntax will look something like: const NAME_NOTION = "Name";
. Notice the const
keyword at the very start denoting that this variable named NAME_NOTION
is a constant, with a value of "Name"
. Since this is a constant, the script can read the value of the variable with the name NAME_NOTION
, but it will not be able to overwrite its value later. Furthermore, notice the semicolon (;
) at the end of the line! The semicolon denotes the end of a statement. Note that this does imply that statements can be multiple lines in case the author wishes to format it as such, but with the correct semicolon placement, the logical meaning of that statement is the same if it is spread out between multiple lines or exists on a single line.
tl;dr: const VARIABLE_NAME = VALUE;
Boolean options only have two valid values. Either true
or false
. When you set a constant to a variable, do not put anything around the word true or false.
String options can be set to have a value of any sequence of characters. Do note that you need to surround your sequence of characters with quotation marks when you assign it to a variable, even if you do not have any empty spaces in your String.
These customization options can be either enabled or disabled (true/false). They must be either set to true
or false
.
Default = true
Whether or not pages tagged as removed/cancelled should be archived by the script.
Default = true
Whenever or not events marked as canceled in GCal should be tagged as removed/cancelled and then archived by the script.
Default = true
Whenever or not events recently synchronized from Notion to GCal should be synchronized back from GCal to Notion in the same script instance. Note that disabling this option can cause duplicate pages in Notion!
Default = false
This option is deprecated. For instructions on triggering a full sync, see the FAQ.
Whether or not a full sync should be done when pulling events from GCal. Should only really be used when events are missing. The sync token is discarded, and the GCal API will list as many events as it can when called, ignoring whenever or not those events have been updated or are new.
These options are defined using strings! Remember to surround your entry using quotation marks! "
To change the property and tag names from the default ones used by the script, not only do you need to change them in Notion, but you also need to change the corresponding constant in the script. All these constants are declared at the very start of the script and are in all caps. Make sure the strings you set these constants to exactly match the corresponding property/tag name you are using in your Notion database!
For the corresponding constants for property names see the database properties reference table on the setup page.
For the corresponding constants for tag names, see the tags reference table on the setup page.
These options are defined using integer values.
Default = 1825
This constant determines the restriction for how many days into the future the script will fetch events from GCal for. Note that due to GCAL API limitations, changes to this value has no effect until a full sync operation is performed. See the FAQ for information on how to execute a full sync. Also note that the date restriction is not a shifting one. The actual date used for the max date restriction is calculated during the full sync using the date at the time of that full sync, and the value of this constant at the time of execution.
Default = 30
This constant determines the restriction for how many days into the past the script will fetch events from GCal for. Note that due to GCAL API limitations, changes to this value has no effect until a full sync operation is performed. See the FAQ for information on how to execute a full sync. Also note that the date restriction is not a shifting one. The actual date used for the min date restriction is calculated during the full sync using the date at the time of that full sync, and the value of this constant at the time of execution.