Skip to main content

Placeholder

The placeholder in the following table are available for substitution in strings, depending on the scope which are defined as follows:

Environment Placeholder

These placeholder are valid globally and can also be used for internal purposes before processing starts (e.g. during adapter initialization).

KeyTitleDescriptionExample
date.nowCurrent TimestampThe current timestamp. Use "${<key>:date::<format>}" to format the date/time using a custom date-fns format strings (default: "yyyy-MM-dd HH:mm:ss")."2023-06-26 09:00:00"
env.runModeRunmodeThe runMode used for processing."safe-mode"
env.timezoneTimezoneThe timezone used for processing."Etc/UTC"
lib.descriptionLibrary DescriptionThe description of the Gmail Processor library.""
lib.nameLibrary NameThe name of the Gmail Processor library."gmail-processor"
lib.versionLibrary VersionThe version of the Gmail Processor library."0.0.0"
user.emailUser EmailThe email address of the active user."my.email@gmail.com"

Processing Placeholder

These placeholder are valid globally during any processing phase.

KeyTitleDescriptionExample
timer.startTimeTimer Start TimeThe start timestamp of the processing script. Use "${<key>:date::<format>}" to format the date/time using a custom date-fns format strings (default: "yyyy-MM-dd HH:mm:ss")."2023-06-26 09:00:00"
variables.customVarVariable customVarA custom defined variable. Custom variables defined at global.variables to better manage recurring substitution values."Custom value"

Thread Placeholder

These placeholder are valid during processing a GMail thread and matching messages + attachments.

KeyTitleDescriptionExample
thread.firstMessageSubjectThread SubjectThe subject of the first message in the thread. See GmailThread.getFirstMessageSubject() reference docs."Message Subject 1"
thread.hasStarredMessagesStarred Messagestrue if the thread has any starred messages. See GmailThread.hasStarredMessages() reference docs."false"
thread.idThread IDThe ID of the thread. See GmailThread.getId() reference docs."threadId123"
thread.indexThread IndexThe index number (0-based) of the thread."0"
thread.isImportantImportant Threadtrue if the thread is marked as important. See GmailThread.isImportant() reference docs."false"
thread.isInChatsChat Threadtrue if the thread is labeled a chat. See GmailThread.isInChats() reference docs."false"
thread.isInInboxInbox Threadtrue if the thread is in the inbox. See GmailThread.isInInbox() reference docs."true"
thread.isInPriorityInboxPriority Inbox Threadtrue if the thread is in the priority inbox. See GmailThread.isInPriorityInbox() reference docs."false"
thread.isInSpamSpam Threadtrue if the thread is marked as spam. See GmailThread.isInSpam() reference docs."false"
thread.isInTrashTrash Threadtrue if the thread is marked as spam. See GmailThread.isInTrash() reference docs."false"
thread.isUnreadUnread Threadtrue if the thread has any unread messages. See GmailThread.isUnread() reference docs."true"
thread.labelsThread LabelsThe user-created labels on the thread. See GmailThread.getLabels() reference docs.""
thread.lastMessageDateThread DateThe date of the thread's most recent message. See GmailThread.getLastMessageDate() reference docs. Use "${<key>:date::<format>}" to format the date/time using a custom date-fns format strings (default: "yyyy-MM-dd HH:mm:ss")."2019-05-02 07:15:28"
thread.matchedthread Regex MatchesThe overall matching result for all conditions in the match config."true"
thread.messageCountThread Message CountThe number of messages in the thread. See GmailThread.getMessageCount() reference docs."2"
thread.permalinkThread PermalinkThe permalink for the thread. See GmailThread.getPermalink() reference docs."some-permalink-url"
thread.urlThread URLThe URL of the thread."https://mail.google.com/mail/u/...
threadConfig.indexThread Config IndexThe index number (0-based) of the thead config."0"

Message Placeholder

These placeholder are valid during processing a GMail message and matching attachments.

KeyTitleDescriptionExample
message.bccMessage BCCThe comma-separated recipients bcc'd on the message. See GmailMessage.getBcc() reference docs."message-bcc@example.com"
message.bodyMessage BodyThe body of the message. See GmailMessage.getBody() reference docs."<p>Message body with contained ...
message.body.match.1message.body Regex Match Group 1The matching regex group number as defined in the match config (e.g.: "(?<url>https://raw\\.githubusercontent\\.com/ahochsteger/gmail-processor/main/src/e2e-test/files/(?<filename>[0-9A-Za-z_-]+\\.txt))")."https://raw.githubusercontent.c...
message.body.match.2message.body Regex Match Group 2The matching regex group number as defined in the match config (e.g.: "(?<url>https://raw\\.githubusercontent\\.com/ahochsteger/gmail-processor/main/src/e2e-test/files/(?<filename>[0-9A-Za-z_-]+\\.txt))")."plain-text-from-repo.txt"
message.body.match.filenamemessage.body Regex Match Group filenameThe matching named regex group name as defined in the match config (e.g.: "(?<url>https://raw\\.githubusercontent\\.com/ahochsteger/gmail-processor/main/src/e2e-test/files/(?<filename>[0-9A-Za-z_-]+\\.txt))")."plain-text-from-repo.txt"
message.body.match.urlmessage.body Regex Match Group urlThe matching named regex group name as defined in the match config (e.g.: "(?<url>https://raw\\.githubusercontent\\.com/ahochsteger/gmail-processor/main/src/e2e-test/files/(?<filename>[0-9A-Za-z_-]+\\.txt))")."https://raw.githubusercontent.c...
message.ccMessage CCThe comma-separated recipients cc'd on the message. See GmailMessage.getCc() reference docs."message-cc@example.com"
message.dateMessage DateThe date and time of the message. See GmailMessage.getDate() reference docs. Use "${<key>:date::<format>}" to format the date/time using a custom date-fns format strings (default: "yyyy-MM-dd HH:mm:ss")."2019-05-02 07:15:28"
message.fromSenderThe sender of the message. See GmailMessage.getFrom() reference docs."message-from@example.com"
message.from.domainSender DomainThe sender domain of the message. See GmailMessage.getFrom() reference docs."example.com"
message.from.match.1message.from Regex Match Group 1The matching regex group number as defined in the match config (e.g.: "(.+)@example.com")."message-from"
message.idMessage IDThe ID of the message. See GmailMessage.getId() reference docs."message-id"
message.indexMessage IndexThe index number (0-based) of the message."0"
message.isDraftDraft Messagetrue if the message is a draft. See GmailMessage.isDraft() reference docs."false"
message.isInChatsChat Messagetrue if the message is a chat. See GmailMessage.isInChats() reference docs."false"
message.isInInboxInbox Messagetrue if the message is in the inbox. See GmailMessage.isInInbox() reference docs."true"
message.isInPriorityInboxPriority Inbox Messagetrue if if the message is in the priority inbox. See GmailMessage.isInPriorityInbox() reference docs."false"
message.isInTrashTrash Messagetrue if the message is in the trash. See GmailMessage.isInTrash() reference docs."false"
message.isStarredStarred Messagetrue if the message is starred. See GmailMessage.isStarred() reference docs."false"
message.isUnreadUnread Messagetrue if the message is unread. See GmailMessage.isUnread() reference docs."true"
message.matchedmessage Regex MatchesThe overall matching result for all conditions in the match config."true"
message.plainBodyMessage Plain BodyThe plain body of the message. See GmailMessage.getPlainBody() reference docs.""
message.replyToMessage Reply ToThe reply-to address of the message (usually the sender). See GmailMessage.getReplyTo() reference docs."message-reply-to@example.com"
message.subjectMessage SubjectThe subject of the message. See GmailMessage.getSubject() reference docs."Message Subject 1"
message.subject.match.1message.subject Regex Match Group 1The matching regex group number as defined in the match config (e.g.: "Message (?<myMatchGroup>.*)")."Subject 1"
message.subject.match.myMatchGroupmessage.subject Regex Match Group myMatchGroupThe matching named regex group name as defined in the match config (e.g.: "Message (?<myMatchGroup>.*)")."Subject 1"
message.toMessage ToThe comma-separated recipients of the message. See GmailMessage.getTo() reference docs."message-to@example.com"
message.urlMessage URLThe URL of the message."https://mail.google.com/mail/u/...
messageConfig.indexMessage Config IndexThe index number (0-based) of the message config."0"

Attachment Placeholder

These placeholder are valid during processing a GMail attachment.

KeyTitleDescriptionExample
attachment.contentTypeAttachment Content TypeThe content type of the attachment. See GmailAttachment.getContentType() reference docs."application/pdf"
attachment.contentType.match.1attachment.contentType Regex Match Group 1The matching regex group number as defined in the match config (e.g.: "application/(?<appType>.*)")."pdf"
attachment.contentType.match.appTypeattachment.contentType Regex Match Group appTypeThe matching named regex group name as defined in the match config (e.g.: "application/(?<appType>.*)")."pdf"
attachment.hashAttachment HashThe SHA1 content hash for the attachment. See GmailAttachment.getHash() reference docs."aa0b8cc192a5d8d5b5d8ecda24fd096...
attachment.indexAttachment IndexThe index number (0-based) of the attachment."0"
attachment.isGoogleTypeGoogle Type Attachmenttrue if this attachment is a Google Workspace file (Sheets, Docs, etc.). See GmailAttachment.isGoogleType() reference docs."false"
attachment.matchedattachment Regex MatchesThe overall matching result for all conditions in the match config."true"
attachment.nameAttachment NameThe name of the attachment. See GmailAttachment.getName() reference docs."attachment1.pdf"
attachment.name.match.1attachment.name Regex Match Group 1The matching regex group number as defined in the match config (e.g.: "attachment(?<attNr>[0-9]+)\\.pdf")."1"
attachment.name.match.attNrattachment.name Regex Match Group attNrThe matching named regex group name as defined in the match config (e.g.: "attachment(?<attNr>[0-9]+)\\.pdf")."1"
attachment.sizeAttachment SizeThe size of the attachment. See GmailAttachment.getSize() reference docs."18"
attachmentConfig.indexAttachment Config IndexThe index number (0-based) of the attachment config."0"

Action Placeholder

These placeholder are valid after certain actions have been executed.

KeyTitleDescriptionExample
attachment.docsFile.stored.downloadUrlStored Download URLThe download URL of the stored OCR docs file (using action attachment.extractText)""
attachment.docsFile.stored.idStored IDThe ID of the stored OCR docs file (using action attachment.extractText)"created-docs-file-id"
attachment.docsFile.stored.locationStored LocationThe location of the stored OCR docs file (using action attachment.extractText)"created-docs-file"
attachment.docsFile.stored.urlStored URLThe URL of the stored OCR docs file (using action attachment.extractText)""
attachment.extractedExtracted TextThe extracted text from the attachment (using action attachment.extractText)"...\nInvoice date: 2024-03-13\n...
attachment.extracted.match.1attachment.extracted Regex Match Group 1The matching regex group number as defined in the match config (e.g.: "Invoice date:\\s*(?<invoiceDate>[0-9-]+)\\s*Invoice number:\\s*(?<invoiceNumber>[0-9]+)")."2024-03-13"
attachment.extracted.match.2attachment.extracted Regex Match Group 2The matching regex group number as defined in the match config (e.g.: "Invoice date:\\s*(?<invoiceDate>[0-9-]+)\\s*Invoice number:\\s*(?<invoiceNumber>[0-9]+)")."12345678"
attachment.extracted.match.invoiceDateattachment.extracted Regex Match Group invoiceDateThe matching named regex group name as defined in the match config (e.g.: "Invoice date:\\s*(?<invoiceDate>[0-9-]+)\\s*Invoice number:\\s*(?<invoiceNumber>[0-9]+)")."2024-03-13"
attachment.extracted.match.invoiceNumberattachment.extracted Regex Match Group invoiceNumberThe matching named regex group name as defined in the match config (e.g.: "Invoice date:\\s*(?<invoiceDate>[0-9-]+)\\s*Invoice number:\\s*(?<invoiceNumber>[0-9]+)")."12345678"

Date Expressions

These are the supported date expressions that can be used in date substitutions like {{message.date|offsetDate('lastDayOfMonth-2d')|formatDate('yyyy-MM-dd HH:mm:ss')}}.

ExpressionDescription
endOfDay
See function endOfDay of date-fns.
endOfDecade
See function endOfDecade of date-fns.
endOfHour
See function endOfHour of date-fns.
endOfISOWeek
See function endOfISOWeek of date-fns.
endOfISOWeekYear
See function endOfISOWeekYear of date-fns.
endOfMinute
See function endOfMinute of date-fns.
endOfMonth
See function endOfMonth of date-fns.
endOfQuarter
See function endOfQuarter of date-fns.
endOfSecond
See function endOfSecond of date-fns.
endOfToday
See function endOfToday of date-fns.
endOfTomorrow
See function endOfTomorrow of date-fns.
endOfWeek
See function endOfWeek of date-fns.
endOfYear
See function endOfYear of date-fns.
endOfYesterday
See function endOfYesterday of date-fns.
formatDate
See function format of date-fns.
join
lastDayOfDecade
See function lastDayOfDecade of date-fns.
lastDayOfISOWeek
See function lastDayOfISOWeek of date-fns.
lastDayOfISOWeekYear
See function lastDayOfISOWeekYear of date-fns.
lastDayOfMonth
See function lastDayOfMonth of date-fns.
lastDayOfQuarter
See function lastDayOfQuarter of date-fns.
lastDayOfWeek
See function lastDayOfWeek of date-fns.
lastDayOfYear
See function lastDayOfYear of date-fns.
nextFriday
See function nextFriday of date-fns.
nextMonday
See function nextMonday of date-fns.
nextSaturday
See function nextSaturday of date-fns.
nextSunday
See function nextSunday of date-fns.
nextThursday
See function nextThursday of date-fns.
nextTuesday
See function nextTuesday of date-fns.
nextWednesday
See function nextWednesday of date-fns.
offsetDate
parseDate
See function parse of date-fns.
previousFriday
See function previousFriday of date-fns.
previousMonday
See function previousMonday of date-fns.
previousSaturday
See function previousSaturday of date-fns.
previousSunday
See function previousSunday of date-fns.
previousThursday
See function previousThursday of date-fns.
previousTuesday
See function previousTuesday of date-fns.
previousWednesday
See function previousWednesday of date-fns.
roundToNearestHours
See function roundToNearestHours of date-fns.
roundToNearestMinutes
See function roundToNearestMinutes of date-fns.
startOfDay
See function startOfDay of date-fns.
startOfDecade
See function startOfDecade of date-fns.
startOfHour
See function startOfHour of date-fns.
startOfISOWeek
See function startOfISOWeek of date-fns.
startOfISOWeekYear
See function startOfISOWeekYear of date-fns.
startOfMinute
See function startOfMinute of date-fns.
startOfMonth
See function startOfMonth of date-fns.
startOfQuarter
See function startOfQuarter of date-fns.
startOfSecond
See function startOfSecond of date-fns.
startOfToday
See function startOfToday of date-fns.
startOfTomorrow
See function startOfTomorrow of date-fns.
startOfWeek
See function startOfWeek of date-fns.
startOfWeekYear
See function startOfWeekYear of date-fns.
startOfYear
See function startOfYear of date-fns.
startOfYesterday
See function startOfYesterday of date-fns.