2022-08-17 08:50:24 -07:00
import { INodeProperties } from 'n8n-workflow' ;
2020-08-18 03:40:19 -07:00
2021-12-03 00:44:16 -08:00
export const messageOperations : INodeProperties [ ] = [
2020-08-18 03:40:19 -07:00
{
displayName : 'Operation' ,
name : 'operation' ,
type : 'options' ,
2022-05-20 14:47:24 -07:00
noDataExpression : true ,
2020-08-18 03:40:19 -07:00
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'message' ] ,
2020-08-18 03:40:19 -07:00
} ,
} ,
options : [
{
name : 'Delete' ,
value : 'delete' ,
2022-07-10 13:50:51 -07:00
action : 'Delete a message' ,
2020-08-18 03:40:19 -07:00
} ,
{
name : 'Get' ,
value : 'get' ,
2022-07-10 13:50:51 -07:00
action : 'Get a message' ,
2020-08-18 03:40:19 -07:00
} ,
{
2022-09-07 07:51:14 -07:00
name : 'Get Many' ,
2020-08-18 03:40:19 -07:00
value : 'getAll' ,
2022-09-08 08:10:13 -07:00
action : 'Get many messages' ,
2020-08-18 03:40:19 -07:00
} ,
{
name : 'Reply' ,
value : 'reply' ,
2022-07-10 13:50:51 -07:00
action : 'Reply to a message' ,
2020-08-18 03:40:19 -07:00
} ,
2022-06-03 10:23:49 -07:00
{
name : 'Send' ,
value : 'send' ,
2022-07-10 13:50:51 -07:00
action : 'Send a message' ,
2022-06-03 10:23:49 -07:00
} ,
2020-08-18 03:40:19 -07:00
] ,
default : 'send' ,
} ,
2021-12-03 00:44:16 -08:00
] ;
2020-08-18 03:40:19 -07:00
2021-12-03 00:44:16 -08:00
export const messageFields : INodeProperties [ ] = [
2020-08-18 03:40:19 -07:00
{
displayName : 'Message ID' ,
name : 'messageId' ,
type : 'string' ,
default : '' ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'message' ] ,
operation : [ 'get' , 'delete' ] ,
2020-08-18 03:40:19 -07:00
} ,
} ,
placeholder : '172ce2c4a72cc243' ,
} ,
{
displayName : 'Thread ID' ,
name : 'threadId' ,
type : 'string' ,
default : '' ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'message' ] ,
operation : [ 'reply' ] ,
2020-08-18 03:40:19 -07:00
} ,
} ,
placeholder : '172ce2c4a72cc243' ,
} ,
{
displayName : 'Message ID' ,
name : 'messageId' ,
type : 'string' ,
default : '' ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'message' ] ,
operation : [ 'reply' ] ,
2020-08-18 03:40:19 -07:00
} ,
} ,
placeholder : 'CAHNQoFsC6JMMbOBJgtjsqN0eEc+gDg2a=SQj-tWUebQeHMDgqQ@mail.gmail.com' ,
} ,
{
displayName : 'Subject' ,
name : 'subject' ,
type : 'string' ,
default : '' ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'message' ] ,
operation : [ 'reply' , 'send' ] ,
2020-08-18 03:40:19 -07:00
} ,
} ,
placeholder : 'Hello World!' ,
} ,
2021-01-07 02:58:28 -08:00
{
displayName : 'HTML' ,
name : 'includeHtml' ,
type : 'boolean' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'message' ] ,
operation : [ 'send' , 'reply' ] ,
2021-01-07 02:58:28 -08:00
} ,
} ,
default : false ,
2022-06-20 07:54:01 -07:00
description : 'Whether the message should also be included as HTML' ,
2021-01-07 02:58:28 -08:00
} ,
{
displayName : 'HTML Message' ,
name : 'htmlMessage' ,
type : 'string' ,
default : '' ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
includeHtml : [ true ] ,
resource : [ 'message' ] ,
operation : [ 'reply' , 'send' ] ,
2021-01-07 02:58:28 -08:00
} ,
} ,
2022-05-06 14:01:25 -07:00
description : 'The HTML message body' ,
2021-01-07 02:58:28 -08:00
} ,
2020-08-18 03:40:19 -07:00
{
displayName : 'Message' ,
name : 'message' ,
type : 'string' ,
default : '' ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'message' ] ,
operation : [ 'reply' , 'send' ] ,
2020-08-18 03:40:19 -07:00
} ,
} ,
2022-05-06 14:01:25 -07:00
description : 'Plain text message body' ,
2020-08-18 03:40:19 -07:00
} ,
{
displayName : 'To Email' ,
name : 'toList' ,
type : 'string' ,
default : [ ] ,
required : true ,
typeOptions : {
multipleValues : true ,
multipleValueButtonText : 'Add To Email' ,
} ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'message' ] ,
operation : [ 'reply' , 'send' ] ,
2020-08-18 03:40:19 -07:00
} ,
} ,
placeholder : 'info@example.com' ,
2022-05-06 14:01:25 -07:00
description : 'The email addresses of the recipients' ,
2020-08-18 03:40:19 -07:00
} ,
{
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'message' ] ,
operation : [ 'send' , 'reply' ] ,
2020-08-18 03:40:19 -07:00
} ,
} ,
default : { } ,
options : [
{
2022-09-08 05:44:34 -07:00
displayName : 'Attachment' ,
2020-08-18 03:40:19 -07:00
name : 'attachmentsUi' ,
2022-09-08 05:44:34 -07:00
placeholder : 'Add Attachment' ,
2020-08-18 03:40:19 -07:00
type : 'fixedCollection' ,
typeOptions : {
multipleValues : true ,
} ,
options : [
{
name : 'attachmentsBinary' ,
2022-09-08 05:44:34 -07:00
displayName : 'Attachment Binary' ,
2020-08-18 03:40:19 -07:00
values : [
{
2022-09-08 05:44:34 -07:00
displayName : 'Attachment Field Name (in Input)' ,
2020-08-18 03:40:19 -07:00
name : 'property' ,
type : 'string' ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
2022-09-08 05:44:34 -07:00
'Add the field name from the input node. Multiple properties can be set separated by comma.' ,
2020-08-18 03:40:19 -07:00
} ,
] ,
} ,
] ,
2022-04-22 09:29:51 -07:00
default : { } ,
2022-05-06 14:01:25 -07:00
description : 'Array of supported attachments to add to the message' ,
2020-08-18 03:40:19 -07:00
} ,
2021-04-30 12:44:46 -07:00
{
displayName : 'BCC Email' ,
name : 'bccList' ,
type : 'string' ,
2022-05-06 14:01:25 -07:00
description : 'The email addresses of the blind copy recipients' ,
2021-04-30 12:44:46 -07:00
typeOptions : {
multipleValues : true ,
multipleValueButtonText : 'Add BCC Email' ,
} ,
placeholder : 'info@example.com' ,
default : [ ] ,
} ,
{
displayName : 'CC Email' ,
name : 'ccList' ,
type : 'string' ,
2022-05-06 14:01:25 -07:00
description : 'The email addresses of the copy recipients' ,
2021-04-30 12:44:46 -07:00
typeOptions : {
multipleValues : true ,
multipleValueButtonText : 'Add CC Email' ,
} ,
placeholder : 'info@example.com' ,
default : [ ] ,
} ,
2021-07-30 07:26:57 -07:00
{
2022-09-08 05:44:34 -07:00
displayName : 'Override Sender Name' ,
2021-07-30 07:26:57 -07:00
name : 'senderName' ,
type : 'string' ,
placeholder : 'Name <test@gmail.com>' ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
2022-09-08 05:44:34 -07:00
'The name displayed in your contacts inboxes. It has to be in the format: "Display-Name <name@gmail.com>". The email address has to match the email address of the logged in user for the API.' ,
2021-07-30 07:26:57 -07:00
} ,
2020-10-22 06:46:03 -07:00
] ,
2020-08-18 03:40:19 -07:00
} ,
{
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'message' ] ,
operation : [ 'get' ] ,
2020-08-18 03:40:19 -07:00
} ,
} ,
default : { } ,
options : [
{
displayName : 'Format' ,
name : 'format' ,
type : 'options' ,
options : [
{
name : 'Full' ,
value : 'full' ,
2022-08-17 08:50:24 -07:00
description :
'Returns the full email message data with body content parsed in the payload field' ,
2020-08-18 03:40:19 -07:00
} ,
{
name : 'Metadata' ,
value : 'metadata' ,
2022-05-06 14:01:25 -07:00
description : 'Returns only email message ID, labels, and email headers' ,
2020-08-18 03:40:19 -07:00
} ,
{
name : 'Minimal' ,
value : 'minimal' ,
2022-08-17 08:50:24 -07:00
description :
'Returns only email message ID and labels; does not return the email headers, body, or payload' ,
2020-08-18 03:40:19 -07:00
} ,
{
name : 'RAW' ,
value : 'raw' ,
2022-08-17 08:50:24 -07:00
description :
'Returns the full email message data with body content in the raw field as a base64url encoded string; the payload field is not used' ,
2020-08-18 03:40:19 -07:00
} ,
{
name : 'Resolved' ,
value : 'resolved' ,
2022-08-17 08:50:24 -07:00
description :
'Returns the full email with all data resolved and attachments saved as binary data' ,
2020-08-18 03:40:19 -07:00
} ,
] ,
default : 'resolved' ,
description : 'The format to return the message in' ,
} ,
{
2022-09-08 05:44:34 -07:00
displayName : 'Attachment Prefix' ,
2020-08-18 03:40:19 -07:00
name : 'dataPropertyAttachmentsPrefixName' ,
type : 'string' ,
default : 'attachment_' ,
displayOptions : {
hide : {
2022-08-17 08:50:24 -07:00
format : [ 'full' , 'metadata' , 'minimal' , 'raw' ] ,
2020-08-18 03:40:19 -07:00
} ,
} ,
2022-08-17 08:50:24 -07:00
description :
'Prefix for name of the binary property to which to write the attachments. An index starting with 0 will be added. So if name is "attachment_" the first attachment is saved to "attachment_0"' ,
2020-08-18 03:40:19 -07:00
} ,
2020-10-22 06:46:03 -07:00
] ,
2020-08-18 03:40:19 -07:00
} ,
/* -------------------------------------------------------------------------- */
/* message:getAll */
/* -------------------------------------------------------------------------- */
{
displayName : 'Return All' ,
name : 'returnAll' ,
type : 'boolean' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'getAll' ] ,
resource : [ 'message' ] ,
2020-08-18 03:40:19 -07:00
} ,
} ,
default : false ,
2022-05-06 14:01:25 -07:00
description : 'Whether to return all results or only up to a given limit' ,
2020-08-18 03:40:19 -07:00
} ,
{
displayName : 'Limit' ,
name : 'limit' ,
type : 'number' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'getAll' ] ,
resource : [ 'message' ] ,
returnAll : [ false ] ,
2020-08-18 03:40:19 -07:00
} ,
} ,
typeOptions : {
minValue : 1 ,
maxValue : 500 ,
} ,
default : 10 ,
2022-05-06 14:01:25 -07:00
description : 'Max number of results to return' ,
2020-08-18 03:40:19 -07:00
} ,
{
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
default : { } ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'getAll' ] ,
resource : [ 'message' ] ,
2020-08-18 03:40:19 -07:00
} ,
} ,
options : [
{
2022-09-08 05:44:34 -07:00
displayName : 'Attachment Prefix' ,
2020-08-18 03:40:19 -07:00
name : 'dataPropertyAttachmentsPrefixName' ,
type : 'string' ,
default : 'attachment_' ,
displayOptions : {
hide : {
2022-08-17 08:50:24 -07:00
format : [ 'full' , 'ids' , 'metadata' , 'minimal' , 'raw' ] ,
2020-08-18 03:40:19 -07:00
} ,
} ,
2022-08-17 08:50:24 -07:00
description :
2022-09-08 05:44:34 -07:00
'Prefix for name of the binary property to which to write the attachment. An index starting with 0 will be added. So if name is "attachment_" the first attachment is saved to "attachment_0".' ,
2020-08-18 03:40:19 -07:00
} ,
{
displayName : 'Format' ,
name : 'format' ,
type : 'options' ,
options : [
{
name : 'Full' ,
value : 'full' ,
2022-08-17 08:50:24 -07:00
description :
'Returns the full email message data with body content parsed in the payload field' ,
2020-08-18 03:40:19 -07:00
} ,
{
name : 'IDs' ,
value : 'ids' ,
description : 'Returns only the IDs of the emails' ,
} ,
{
name : 'Metadata' ,
value : 'metadata' ,
2022-05-06 14:01:25 -07:00
description : 'Returns only email message ID, labels, and email headers' ,
2020-08-18 03:40:19 -07:00
} ,
{
name : 'Minimal' ,
value : 'minimal' ,
2022-08-17 08:50:24 -07:00
description :
'Returns only email message ID and labels; does not return the email headers, body, or payload' ,
2020-08-18 03:40:19 -07:00
} ,
{
name : 'RAW' ,
value : 'raw' ,
2022-08-17 08:50:24 -07:00
description :
'Returns the full email message data with body content in the raw field as a base64url encoded string; the payload field is not used' ,
2020-08-18 03:40:19 -07:00
} ,
{
name : 'Resolved' ,
value : 'resolved' ,
2022-08-17 08:50:24 -07:00
description :
'Returns the full email with all data resolved and attachments saved as binary data' ,
2020-08-18 03:40:19 -07:00
} ,
] ,
default : 'resolved' ,
description : 'The format to return the message in' ,
} ,
{
2022-09-08 05:44:34 -07:00
displayName : 'Include Spam and Trash' ,
2020-08-18 03:40:19 -07:00
name : 'includeSpamTrash' ,
type : 'boolean' ,
default : false ,
2022-06-20 07:54:01 -07:00
description : 'Whether to include messages from SPAM and TRASH in the results' ,
2020-08-18 03:40:19 -07:00
} ,
{
2022-06-20 07:54:01 -07:00
displayName : 'Label Names or IDs' ,
2020-08-18 03:40:19 -07:00
name : 'labelIds' ,
type : 'multiOptions' ,
typeOptions : {
loadOptionsMethod : 'getLabels' ,
} ,
2020-09-02 04:05:43 -07:00
default : [ ] ,
2022-08-17 08:50:24 -07:00
description :
'Only return messages with labels that match all of the specified label IDs. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2020-08-18 03:40:19 -07:00
} ,
{
displayName : 'Query' ,
name : 'q' ,
type : 'string' ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'Only return messages matching the specified query. Supports the same query format as the Gmail search box. For example, "from:someuser@example.com rfc822msgid:<somemsgid@example.com> is:unread". Parameter cannot be used when accessing the api using the gmail.metadata scope.' ,
2020-08-18 03:40:19 -07:00
} ,
] ,
} ,
2021-12-03 00:44:16 -08:00
] ;