2020-08-18 03:40:19 -07:00
import {
INodeProperties ,
} from 'n8n-workflow' ;
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 : {
resource : [
'message' ,
] ,
} ,
} ,
options : [
{
name : 'Delete' ,
value : 'delete' ,
description : 'Delete a message' ,
} ,
{
name : 'Get' ,
value : 'get' ,
description : 'Get a message' ,
} ,
{
name : 'Get All' ,
value : 'getAll' ,
description : 'Get all messages' ,
} ,
{
name : 'Reply' ,
value : 'reply' ,
description : 'Reply to an email' ,
} ,
2022-06-03 10:23:49 -07:00
{
name : 'Send' ,
value : 'send' ,
description : 'Send an email' ,
} ,
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 : {
resource : [
'message' ,
] ,
operation : [
'get' ,
'delete' ,
2020-10-22 06:46:03 -07:00
] ,
2020-08-18 03:40:19 -07:00
} ,
} ,
placeholder : '172ce2c4a72cc243' ,
2022-05-06 14:01:25 -07:00
description : 'The ID of the message you are operating on' ,
2020-08-18 03:40:19 -07:00
} ,
{
displayName : 'Thread ID' ,
name : 'threadId' ,
type : 'string' ,
default : '' ,
required : true ,
displayOptions : {
show : {
resource : [
'message' ,
] ,
operation : [
'reply' ,
2020-10-22 06:46:03 -07:00
] ,
2020-08-18 03:40:19 -07:00
} ,
} ,
placeholder : '172ce2c4a72cc243' ,
2022-05-06 14:01:25 -07:00
description : 'The ID of the thread you are replying to' ,
2020-08-18 03:40:19 -07:00
} ,
{
displayName : 'Message ID' ,
name : 'messageId' ,
type : 'string' ,
default : '' ,
required : true ,
displayOptions : {
show : {
resource : [
'message' ,
] ,
operation : [
'reply' ,
2020-10-22 06:46:03 -07:00
] ,
2020-08-18 03:40:19 -07:00
} ,
} ,
placeholder : 'CAHNQoFsC6JMMbOBJgtjsqN0eEc+gDg2a=SQj-tWUebQeHMDgqQ@mail.gmail.com' ,
2022-05-06 14:01:25 -07:00
description : 'The ID of the message you are replying to' ,
2020-08-18 03:40:19 -07:00
} ,
{
displayName : 'Subject' ,
name : 'subject' ,
type : 'string' ,
default : '' ,
required : true ,
displayOptions : {
show : {
resource : [
'message' ,
] ,
operation : [
'reply' ,
'send' ,
2020-10-22 06:46:03 -07:00
] ,
2020-08-18 03:40:19 -07:00
} ,
} ,
placeholder : 'Hello World!' ,
2022-05-06 14:01:25 -07:00
description : 'The message subject' ,
2020-08-18 03:40:19 -07:00
} ,
2021-01-07 02:58:28 -08:00
{
displayName : 'HTML' ,
name : 'includeHtml' ,
type : 'boolean' ,
displayOptions : {
show : {
resource : [
'message' ,
] ,
operation : [
'send' ,
'reply' ,
] ,
} ,
} ,
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 : {
includeHtml : [
true ,
] ,
resource : [
'message' ,
] ,
operation : [
'reply' ,
'send' ,
] ,
} ,
} ,
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 : {
resource : [
'message' ,
] ,
operation : [
'reply' ,
'send' ,
2020-10-22 06:46:03 -07:00
] ,
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 : {
resource : [
'message' ,
] ,
operation : [
'reply' ,
'send' ,
2020-10-22 06:46:03 -07:00
] ,
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 : {
resource : [
'message' ,
] ,
operation : [
'send' ,
'reply' ,
2020-10-22 06:46:03 -07:00
] ,
2020-08-18 03:40:19 -07:00
} ,
} ,
default : { } ,
options : [
{
displayName : 'Attachments' ,
name : 'attachmentsUi' ,
placeholder : 'Add Attachments' ,
type : 'fixedCollection' ,
typeOptions : {
multipleValues : true ,
} ,
options : [
{
name : 'attachmentsBinary' ,
displayName : 'Attachments Binary' ,
values : [
{
displayName : 'Property' ,
name : 'property' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Name of the binary property containing the data to be added to the email as an attachment. 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
{
displayName : 'Sender Name' ,
name : 'senderName' ,
type : 'string' ,
placeholder : 'Name <test@gmail.com>' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : '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 : {
resource : [
'message' ,
] ,
operation : [
'get' ,
2020-10-22 06:46:03 -07:00
] ,
2020-08-18 03:40:19 -07:00
} ,
} ,
default : { } ,
options : [
{
displayName : 'Format' ,
name : 'format' ,
type : 'options' ,
options : [
{
name : 'Full' ,
value : 'full' ,
description : 'Returns the full email message data with body content parsed in the payload field' ,
} ,
{
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' ,
description : 'Returns only email message ID and labels; does not return the email headers, body, or payload' ,
} ,
{
name : 'RAW' ,
value : 'raw' ,
2022-05-06 14:01:25 -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-05-06 14:01:25 -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' ,
} ,
{
displayName : 'Attachments Prefix' ,
name : 'dataPropertyAttachmentsPrefixName' ,
type : 'string' ,
default : 'attachment_' ,
displayOptions : {
hide : {
format : [
'full' ,
'metadata' ,
'minimal' ,
'raw' ,
] ,
} ,
} ,
2021-11-25 09:10:06 -08: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 : {
operation : [
'getAll' ,
] ,
resource : [
'message' ,
] ,
} ,
} ,
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 : {
operation : [
'getAll' ,
] ,
resource : [
'message' ,
] ,
returnAll : [
false ,
] ,
} ,
} ,
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 : {
operation : [
'getAll' ,
] ,
resource : [
'message' ,
] ,
} ,
} ,
options : [
{
displayName : 'Attachments Prefix' ,
name : 'dataPropertyAttachmentsPrefixName' ,
type : 'string' ,
default : 'attachment_' ,
displayOptions : {
hide : {
format : [
'full' ,
'ids' ,
'metadata' ,
'minimal' ,
'raw' ,
] ,
} ,
} ,
2021-11-25 09:10:06 -08: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
} ,
{
displayName : 'Format' ,
name : 'format' ,
type : 'options' ,
options : [
{
name : 'Full' ,
value : 'full' ,
description : 'Returns the full email message data with body content parsed in the payload field' ,
} ,
{
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' ,
description : 'Returns only email message ID and labels; does not return the email headers, body, or payload' ,
} ,
{
name : 'RAW' ,
value : 'raw' ,
2022-05-06 14:01:25 -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-05-06 14:01:25 -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' ,
} ,
{
displayName : 'Include Spam Trash' ,
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-06-20 07:54:01 -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/nodes/expressions.html#expressions">expression</a>.' ,
2020-08-18 03:40:19 -07:00
} ,
{
displayName : 'Query' ,
name : 'q' ,
type : 'string' ,
typeOptions : {
alwaysOpenEditWindow : true ,
} ,
default : '' ,
2022-05-06 14:01:25 -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
] ;