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/0...
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 u...
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.co...
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.co...
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/0...
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.aa0b8cc192a5d8d5b5d8ecda24fd0961...
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)...<br>Invoice date: 2024-03-13<br>Inv...
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:date:lastDayOfMonth-2d:yyyy-MM-dd HH:mm:ss}.

ExpressionDescription
endOfDaySee function endOfDay of date-fns.
endOfDecadeSee function endOfDecade of date-fns.
endOfHourSee function endOfHour of date-fns.
endOfISOWeekSee function endOfISOWeek of date-fns.
endOfISOWeekYearSee function endOfISOWeekYear of date-fns.
endOfMinuteSee function endOfMinute of date-fns.
endOfMonthSee function endOfMonth of date-fns.
endOfQuarterSee function endOfQuarter of date-fns.
endOfSecondSee function endOfSecond of date-fns.
endOfTodaySee function endOfToday of date-fns.
endOfTomorrowSee function endOfTomorrow of date-fns.
endOfYearSee function endOfYear of date-fns.
endOfYesterdaySee function endOfYesterday of date-fns.
lastDayOfDecadeSee function lastDayOfDecade of date-fns.
lastDayOfISOWeekSee function lastDayOfISOWeek of date-fns.
lastDayOfISOWeekYearSee function lastDayOfISOWeekYear of date-fns.
lastDayOfMonthSee function lastDayOfMonth of date-fns.
lastDayOfQuarterSee function lastDayOfQuarter of date-fns.
lastDayOfYearSee function lastDayOfYear of date-fns.
nextFridaySee function nextFriday of date-fns.
nextMondaySee function nextMonday of date-fns.
nextSaturdaySee function nextSaturday of date-fns.
nextSundaySee function nextSunday of date-fns.
nextThursdaySee function nextThursday of date-fns.
nextTuesdaySee function nextTuesday of date-fns.
nextWednesdaySee function nextWednesday of date-fns.
previousFridaySee function previousFriday of date-fns.
previousMondaySee function previousMonday of date-fns.
previousSaturdaySee function previousSaturday of date-fns.
previousSundaySee function previousSunday of date-fns.
previousThursdaySee function previousThursday of date-fns.
previousTuesdaySee function previousTuesday of date-fns.
previousWednesdaySee function previousWednesday of date-fns.
startOfDaySee function startOfDay of date-fns.
startOfDecadeSee function startOfDecade of date-fns.
startOfHourSee function startOfHour of date-fns.
startOfISOWeekSee function startOfISOWeek of date-fns.
startOfISOWeekYearSee function startOfISOWeekYear of date-fns.
startOfMinuteSee function startOfMinute of date-fns.
startOfMonthSee function startOfMonth of date-fns.
startOfQuarterSee function startOfQuarter of date-fns.
startOfSecondSee function startOfSecond of date-fns.
startOfTodaySee function startOfToday of date-fns.
startOfTomorrowSee function startOfTomorrow of date-fns.
startOfYearSee function startOfYear of date-fns.
startOfYesterdaySee function startOfYesterday of date-fns.