2023-01-27 03:22:44 -08:00
import type { INodeProperties } from 'n8n-workflow' ;
2020-04-01 15:10:41 -07:00
2021-12-03 00:44:16 -08:00
export const emailOperations : INodeProperties [ ] = [
2020-04-01 15:10:41 -07:00
{
displayName : 'Operation' ,
name : 'operation' ,
type : 'options' ,
2022-05-20 14:47:24 -07:00
noDataExpression : true ,
2020-04-01 15:10:41 -07:00
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'email' ] ,
2020-04-01 15:10:41 -07:00
} ,
} ,
options : [
{
name : 'Create Record' ,
value : 'createRecord' ,
description : 'Create a record of an email sent to a contact' ,
2022-07-10 13:50:51 -07:00
action : 'Create a record of an email sent' ,
2020-04-01 15:10:41 -07:00
} ,
{
2022-09-07 07:51:14 -07:00
name : 'Get Many' ,
2020-04-01 15:10:41 -07:00
value : 'getAll' ,
2022-09-13 03:36:36 -07:00
description : 'Retrieve many sent emails' ,
2022-09-08 08:10:13 -07:00
action : 'Get many emails' ,
2020-04-01 15:10:41 -07:00
} ,
{
name : 'Send' ,
value : 'send' ,
description : 'Send Email' ,
2022-07-10 13:50:51 -07:00
action : 'Send an email' ,
2020-04-01 15:10:41 -07:00
} ,
] ,
default : 'createRecord' ,
} ,
2021-12-03 00:44:16 -08:00
] ;
2020-04-01 15:10:41 -07:00
2021-12-03 00:44:16 -08:00
export const emailFields : INodeProperties [ ] = [
2022-08-17 08:50:24 -07:00
/* -------------------------------------------------------------------------- */
/* email:createRecord */
/* -------------------------------------------------------------------------- */
2020-04-01 15:10:41 -07:00
{
displayName : 'Sent To Address' ,
name : 'sentToAddress' ,
type : 'string' ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'createRecord' ] ,
resource : [ 'email' ] ,
2020-04-01 15:10:41 -07:00
} ,
} ,
default : '' ,
} ,
{
displayName : 'Sent From Address' ,
name : 'sentFromAddress' ,
type : 'string' ,
default : '' ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'createRecord' ] ,
resource : [ 'email' ] ,
2020-04-01 15:10:41 -07:00
} ,
} ,
} ,
{
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
default : { } ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'createRecord' ] ,
resource : [ 'email' ] ,
2020-04-01 15:10:41 -07:00
} ,
} ,
options : [
{
displayName : 'Clicked Date' ,
name : 'clickedDate' ,
type : 'dateTime' ,
default : '' ,
} ,
{
displayName : 'Contact ID' ,
name : 'contactId' ,
type : 'number' ,
typeOptions : {
minValue : 0 ,
} ,
default : 0 ,
} ,
{
displayName : 'Headers' ,
name : 'headers' ,
type : 'string' ,
default : '' ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'HTML Content' ,
2020-04-01 15:10:41 -07:00
name : 'htmlContent' ,
type : 'string' ,
default : '' ,
description : 'Base64 encoded HTML' ,
} ,
{
displayName : 'Opened Date' ,
name : 'openedDate' ,
type : 'dateTime' ,
default : '' ,
} ,
{
displayName : 'Original Provider' ,
name : 'originalProvider' ,
type : 'options' ,
options : [
{
name : 'Unknown' ,
value : 'UNKNOWN' ,
} ,
{
name : 'Infusionsoft' ,
value : 'INFUSIONSOFT' ,
} ,
{
name : 'Microsoft' ,
value : 'MICROSOFT' ,
} ,
{
name : 'Google' ,
value : 'GOOGLE' ,
} ,
] ,
default : 'UNKNOWN' ,
description : 'Provider that sent the email case insensitive, must be in list' ,
} ,
{
displayName : 'Original Provider ID' ,
name : 'originalProviderId' ,
type : 'string' ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'Provider ID that sent the email, must be unique when combined with provider. If omitted a UUID without dashes is autogenerated for the record.' ,
2020-04-01 15:10:41 -07:00
} ,
{
displayName : 'Plain Content' ,
name : 'plainContent' ,
type : 'string' ,
default : '' ,
description : 'Base64 encoded text' ,
} ,
{
displayName : 'Provider Source ID' ,
name : 'providerSourceId' ,
type : 'string' ,
default : 'The email address of the synced email account that generated this message.' ,
} ,
{
displayName : 'Received Date' ,
name : 'receivedDate' ,
type : 'dateTime' ,
default : '' ,
} ,
{
displayName : 'Sent Date' ,
name : 'sentDate' ,
type : 'dateTime' ,
default : '' ,
} ,
{
displayName : 'Sent From Reply Address' ,
name : 'sentFromReplyAddress' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Sent To Bcc Addresses' ,
name : 'sentToBccAddresses' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Sent To CC Addresses' ,
name : 'sentToCCAddresses' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Subject' ,
name : 'subject' ,
type : 'string' ,
default : '' ,
} ,
] ,
} ,
2022-08-17 08:50:24 -07:00
/* -------------------------------------------------------------------------- */
/* email:getAll */
/* -------------------------------------------------------------------------- */
2020-04-01 15:10:41 -07:00
{
displayName : 'Return All' ,
name : 'returnAll' ,
type : 'boolean' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'getAll' ] ,
resource : [ 'email' ] ,
2020-04-01 15:10:41 -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-04-01 15:10:41 -07:00
} ,
{
displayName : 'Limit' ,
name : 'limit' ,
type : 'number' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'getAll' ] ,
resource : [ 'email' ] ,
returnAll : [ false ] ,
2020-04-01 15:10:41 -07:00
} ,
} ,
typeOptions : {
minValue : 1 ,
maxValue : 200 ,
} ,
default : 100 ,
2022-05-06 14:01:25 -07:00
description : 'Max number of results to return' ,
2020-04-01 15:10:41 -07:00
} ,
{
displayName : 'Filters' ,
name : 'filters' ,
type : 'collection' ,
placeholder : 'Add Filter' ,
default : { } ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'getAll' ] ,
resource : [ 'email' ] ,
2020-04-01 15:10:41 -07:00
} ,
} ,
options : [
{
displayName : 'Contact ID' ,
name : 'contactId' ,
type : 'number' ,
typeOptions : {
minValue : 0 ,
} ,
default : 0 ,
} ,
{
displayName : 'Email' ,
name : 'email' ,
type : 'string' ,
2022-06-20 07:54:01 -07:00
placeholder : 'name@email.com' ,
2020-04-01 15:10:41 -07:00
default : '' ,
} ,
{
displayName : 'Since Sent Date' ,
name : 'sinceSentDate' ,
type : 'dateTime' ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'Emails sent since the provided date, must be present if untilDate is provided' ,
2020-04-01 15:10:41 -07:00
} ,
{
displayName : 'Until Sent Date' ,
name : 'untilSentDate' ,
type : 'dateTime' ,
default : '' ,
description : 'Email sent until the provided date' ,
} ,
] ,
} ,
2022-08-17 08:50:24 -07:00
/* -------------------------------------------------------------------------- */
/* email:send */
/* -------------------------------------------------------------------------- */
2020-04-01 15:10:41 -07:00
{
2022-06-03 10:23:49 -07:00
displayName : 'User Name or ID' ,
2020-04-01 15:10:41 -07:00
name : 'userId' ,
type : 'options' ,
required : true ,
typeOptions : {
loadOptionsMethod : 'getUsers' ,
} ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'send' ] ,
resource : [ 'email' ] ,
2020-04-01 15:10:41 -07:00
} ,
} ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
2024-09-12 07:53:36 -07:00
'The infusionsoft user to send the email on behalf of. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.' ,
2020-04-01 15:10:41 -07:00
} ,
{
displayName : 'Contact IDs' ,
name : 'contactIds' ,
type : 'string' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'send' ] ,
resource : [ 'email' ] ,
2020-04-01 15:10:41 -07:00
} ,
} ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Contact IDs to receive the email. Multiple can be added seperated by comma.' ,
2020-04-01 15:10:41 -07:00
} ,
{
displayName : 'Subject' ,
name : 'subject' ,
type : 'string' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'send' ] ,
resource : [ 'email' ] ,
2020-04-01 15:10:41 -07:00
} ,
} ,
default : '' ,
description : 'The subject line of the email' ,
} ,
{
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
default : { } ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'send' ] ,
resource : [ 'email' ] ,
2020-04-01 15:10:41 -07:00
} ,
} ,
options : [
{
2022-06-03 10:23:49 -07:00
displayName : 'Address Field' ,
2020-04-01 15:10:41 -07:00
name : 'addressField' ,
type : 'string' ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
"Email field of each Contact record to address the email to, such as 'EmailAddress1', 'EmailAddress2', 'EmailAddress3', defaulting to the contact's primary email" ,
2020-04-01 15:10:41 -07:00
} ,
{
displayName : 'HTML Content' ,
name : 'htmlContent' ,
type : 'string' ,
default : '' ,
description : 'The HTML-formatted content of the email, encoded in Base64' ,
} ,
{
displayName : 'Plain Content' ,
name : 'plainContent' ,
type : 'string' ,
default : '' ,
description : 'The plain-text content of the email, encoded in Base64' ,
} ,
] ,
} ,
{
displayName : 'Attachments' ,
name : 'attachmentsUi' ,
placeholder : 'Add Attachments' ,
type : 'fixedCollection' ,
typeOptions : {
multipleValues : true ,
} ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'send' ] ,
resource : [ 'email' ] ,
2020-04-01 15:10:41 -07:00
} ,
} ,
options : [
{
name : 'attachmentsValues' ,
displayName : 'Attachments Values' ,
values : [
{
displayName : 'File Data' ,
name : 'fileData' ,
type : 'string' ,
default : '' ,
description : 'The content of the attachment, encoded in Base64' ,
} ,
{
displayName : 'File Name' ,
name : 'fileName' ,
type : 'string' ,
default : '' ,
description : 'The filename of the attached file, including extension' ,
} ,
] ,
} ,
{
name : 'attachmentsBinary' ,
displayName : 'Attachments Binary' ,
values : [
{
displayName : 'Property' ,
name : 'property' ,
type : 'string' ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'Name of the binary properties which contain data which should be added to email as attachment' ,
2020-04-01 15:10:41 -07:00
} ,
] ,
} ,
] ,
2022-04-22 09:29:51 -07:00
default : { } ,
2022-08-17 08:50:24 -07:00
description :
'Attachments to be sent with each copy of the email, maximum of 10 with size of 1MB each' ,
2020-04-01 15:10:41 -07:00
} ,
2021-12-03 00:44:16 -08:00
] ;