gmail@1.1.1
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.
Param | Type | Description |
---|---|---|
options | Options | Customized options including desired contents and query. |
This operation writes the following keys to state:
State Key | Description |
---|---|
data | The returned message objects, of the form { messageId, contents } |
processedIds | An 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
Name | Type | Description |
---|---|---|
[type] | string | Message content type. Valid types: from, date, subject, body, archive, file. |
[name] | string | A custom description for the content type. |
[archive] | RegExp | string | Identifier 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 | string | Identifier 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] | number | Maximum number of characters to retrieve from the content. |
Options
Configurable options provided to the Gmail adaptor.
Properties
Name | Type | Default | Description |
---|---|---|---|
[query] | string | Gmail 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] | string | The user account to retrieve messages from. Defaults to the authenticated user. | |
[maxResults] | int | Maximum number of messages to process per request. Default is 1000. |