@@ -416,7 +416,12 @@ export class HostingerApi implements INodeType {
416416 // eslint-disable-next-line n8n-nodes-base/node-param-operation-option-action-miscased
417417 { name : 'Delete Contact' , value : 'deleteContact' , action : 'Delete Reach contact' } ,
418418 // eslint-disable-next-line n8n-nodes-base/node-param-operation-option-action-miscased
419- { name : 'List Contact Groups' , value : 'listContactGroups' , action : 'List Reach contact groups' } ,
419+ { name : 'List Segments' , value : 'listSegments' , action : 'List Reach segments' } ,
420+ // eslint-disable-next-line n8n-nodes-base/node-param-operation-option-action-miscased
421+ { name : 'Get Segment' , value : 'getSegment' , action : 'Get Reach segment' } ,
422+ // eslint-disable-next-line n8n-nodes-base/node-param-operation-option-action-miscased
423+ { name : 'Get Segment Contacts' , value : 'getSegmentContacts' , action : 'Get Reach segment contacts' } ,
424+
420425 ] ,
421426 default : 'listContacts' ,
422427 displayOptions : {
@@ -1117,19 +1122,6 @@ export class HostingerApi implements INodeType {
11171122 }
11181123 }
11191124 } ,
1120- {
1121- displayName : 'Group UUIDs' ,
1122- name : 'contactGroupUuids' ,
1123- type : 'string' ,
1124- default : '' ,
1125- description : 'Comma-separated list of group UUIDs to assign the contact to' ,
1126- displayOptions : {
1127- show : {
1128- resource : [ 'reach' ] ,
1129- operation : [ 'createContact' ]
1130- }
1131- }
1132- } ,
11331125 {
11341126 displayName : 'Note' ,
11351127 name : 'contactNote' ,
@@ -1158,19 +1150,6 @@ export class HostingerApi implements INodeType {
11581150 }
11591151 }
11601152 } ,
1161- {
1162- displayName : 'Group UUID' ,
1163- name : 'groupUuid' ,
1164- type : 'string' ,
1165- default : '' ,
1166- description : 'Filter contacts by group UUID' ,
1167- displayOptions : {
1168- show : {
1169- resource : [ 'reach' ] ,
1170- operation : [ 'listContacts' ]
1171- }
1172- }
1173- } ,
11741153 {
11751154 displayName : 'Subscription Status' ,
11761155 name : 'subscriptionStatus' ,
@@ -1203,6 +1182,19 @@ export class HostingerApi implements INodeType {
12031182 }
12041183 }
12051184 } ,
1185+ {
1186+ displayName : 'Segment UUID' ,
1187+ name : 'segmentUuid' ,
1188+ type : 'string' ,
1189+ default : '' ,
1190+ description : 'UUID of the segment' ,
1191+ displayOptions : {
1192+ show : {
1193+ resource : [ 'reach' ] ,
1194+ operation : [ 'getSegment' , 'getSegmentContacts' ]
1195+ }
1196+ }
1197+ }
12061198 ]
12071199 } ;
12081200
@@ -1227,7 +1219,6 @@ export class HostingerApi implements INodeType {
12271219 const contactEmail = this . getNodeParameter ( 'contactEmail' , i ) as string ;
12281220 const contactName = this . getNodeParameter ( 'contactName' , i ) as string ;
12291221 const contactSurname = this . getNodeParameter ( 'contactSurname' , i ) as string ;
1230- const contactGroupUuids = this . getNodeParameter ( 'contactGroupUuids' , i ) as string ;
12311222 const contactNote = this . getNodeParameter ( 'contactNote' , i ) as string ;
12321223
12331224 const contactData : IDataObject = {
@@ -1238,14 +1229,6 @@ export class HostingerApi implements INodeType {
12381229 if ( contactSurname ) contactData . surname = contactSurname ;
12391230 if ( contactNote ) contactData . note = contactNote ;
12401231
1241- // Handle group UUIDs - convert comma-separated string to array
1242- if ( contactGroupUuids ) {
1243- const groupUuids = contactGroupUuids . split ( ',' ) . map ( uuid => uuid . trim ( ) ) . filter ( uuid => uuid ) ;
1244- if ( groupUuids . length > 0 ) {
1245- contactData . group_uuids = groupUuids ;
1246- }
1247- }
1248-
12491232 requestBody = contactData ;
12501233 } else if ( operation === 'updateHostname' ) {
12511234 // For updateHostname, build request body from hostname field
@@ -1503,12 +1486,8 @@ export class HostingerApi implements INodeType {
15031486 //Reach
15041487 case 'listContacts' : {
15051488 let contactsEndpoint = `/api/reach/v1/contacts?page=${ getParam ( 'page' ) } ` ;
1506- const groupUuid = this . getNodeParameter ( 'groupUuid' , i ) as string ;
15071489 const subscriptionStatus = this . getNodeParameter ( 'subscriptionStatus' , i ) as string ;
1508-
1509- if ( groupUuid ) {
1510- contactsEndpoint += `&group_uuid=${ groupUuid } ` ;
1511- }
1490+
15121491 if ( subscriptionStatus ) {
15131492 contactsEndpoint += `&subscription_status=${ subscriptionStatus } ` ;
15141493 }
@@ -1517,7 +1496,9 @@ export class HostingerApi implements INodeType {
15171496 }
15181497 case 'createContact' : method = 'POST' ; endpoint = '/api/reach/v1/contacts' ; break ;
15191498 case 'deleteContact' : method = 'DELETE' ; endpoint = `/api/reach/v1/contacts/${ getParam ( 'contactUuid' ) } ` ; break ;
1520- case 'listContactGroups' : endpoint = '/api/reach/v1/contacts/groups' ; break ;
1499+ case 'listSegments' : method = 'GET' ; endpoint = '/api/reach/v1/segmentation/segments' ; break ;
1500+ case 'getSegment' : method = 'GET' ; endpoint = `/api/reach/v1/segmentation/segments/${ getParam ( 'segmentUuid' ) } ` ; break ;
1501+ case 'getSegmentContacts' : method = 'GET' ; endpoint = `/api/reach/v1/segmentation/segments/${ getParam ( 'segmentUuid' ) } /contacts` ; break ;
15211502
15221503 default : throw new ApplicationError ( `Unsupported operation: ${ operation } ` ) ;
15231504 }
0 commit comments