Skip to main content

gmail@1.1.1

getContentsFromMessages(options)

This adaptor exports the following from common:

alterState()
combine()
cursor()
dataPath()
dataValue()
each()
field()
fields()
fn()
fnIf()
http
lastReferenceValue()
merge()
sourceValue()

Functions

getContentsFromMessages

getContentsFromMessages(options) ⇒ Operation

Downloads contents from messages of a Gmail account.

ParamTypeDescription
optionsOptionsCustomized options including desired contents and query.

This operation writes the following keys to state:

State KeyDescription
dataThe returned message objects, of the form { messageId, contents }
processedIdsAn array of string ids processed by this request

Example: Get a message with a specific subject

getContentsFromMessages(
{
query: 'subject:my+test+message'
}
)

Example: Get messages after a specific date, with subject and report.txt attachment

getContentsFromMessages(
{
query: 'after:15/01/2025',
contents: [
'subject',
{ type: 'file', name: 'metadata', file: 'report.txt'}
]
}
)

Interfaces

MessageContent

Used to isolate the type of content to retrieve from the message.

Properties

NameTypeDescription
[type]stringMessage content type. Valid types: from, date, subject, body, archive, file.
[name]stringA custom description for the content type.
[archive]RegExp | stringIdentifier to isolate the desired attachment when type is 'archive'. Use a regular expression for pattern matching or a string for a literal match. Required if type is 'archive'.
[file]RegExp | stringIdentifier to isolate the desired attachment when type is 'file' or 'archive'. Use a regular expression for pattern matching or a string for a literal match. Required if type is 'file' or 'archive'.
[maxLength]numberMaximum number of characters to retrieve from the content.

Options

Configurable options provided to the Gmail adaptor.

Properties

NameTypeDefaultDescription
[query]stringGmail search query string.
[contents]Array.<(string|MessageContent)>['from', 'date', 'subject', 'body']An array of strings or MessageContent objects used to specify which parts of the message to retrieve.
[processedIds]Array.<string>Ignore message ids which have already been processed.
[email]stringThe user account to retrieve messages from. Defaults to the authenticated user.
[maxResults]intMaximum number of messages to process per request. Default is 1000.