Skip to main content

gmail@1.0.0

getContentsFromMessages(userId, userOptions)

This adaptor exports the following from common:

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

Functions

getContentsFromMessages

getContentsFromMessages(userId, userOptions) ⇒ function

Requests contents from messages of a Gmail account.

Returns: function - A function that processes the state.

ParamTypeDescription
userIdstringThe email address of the account to retrieve messages from.
userOptionsOptionsCustomized options including desired contents and query.

Example

getContentsFromMessages(
'test@tester.com',
{
query: 'in:inbox subject:my+test+message',
desiredContents: ['date', 'from', 'subject', { type: 'body', maxLength: 50 }]
}
)

Interfaces

DesiredContent

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

Properties

NameTypeDefaultDescription
typestringMessage content type. Valid types: from, date, subject, body, archive, file.
[name]stringnullA custom description for the content type. Optional.
[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. Optional.

Options

Configurable options provided to the Gmail adaptor.

Properties

NameTypeDefaultDescription
userIdstringThe email address of the Gmail account.
[query]stringnullCustom query to limit the messages result. Adheres to the Gmail search syntax. Optional.
[desiredContents]Array.<(string|DesiredContent)>['from', 'date', 'subject', 'body']An array of strings or DesiredContent objects used to specify which parts of the message to retrieve. Optional, default is ['from', 'date', 'subject', 'body'].
[processedIds]Array.<string>Ignore message ids which have already been processed. Optional.