Skip to content

Commit

Permalink
added subscriber's list management feature
Browse files Browse the repository at this point in the history
- with this new node you will be able to add, romove of unsubscribe a user from given list in bulk #4
- fixed a trivial codding issue related to n8n framework (suffix `=`).
- updated version to 1.0.6
  • Loading branch information
anantanandgupta committed Mar 25, 2024
1 parent e665957 commit 94f4b8d
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 4 deletions.
16 changes: 15 additions & 1 deletion nodes/Listmonk/businessOperations/subscribers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const subscriberOperations: INodeProperties[] = [
routing: {
request: {
method: 'POST',
url: '=/subscribers',
url: '/subscribers',
body: `={{JSON.stringify({"email":$parameter.subscriberEmail, "name":$parameter.name, "status" : $parameter.subscriberStatus, "lists": JSON.parse($parameter.subscriberLists), attribs: JSON.parse($parameter.subscriberAttributes), "preconfirm_subscriptions": Boolean($parameter.preconfirmSubscriptions) })}}`,
encoding: 'json',
json: true,
Expand All @@ -37,6 +37,20 @@ export const subscriberOperations: INodeProperties[] = [
},
},
},
{
name: 'Manage Subscriber List',
value: 'manageSubscribersLists',
action: 'Add or remove multiple subscribers to and from given lists or mark them unsubscribed in list.',

Check failure on line 43 in nodes/Listmonk/businessOperations/subscribers.ts

View workflow job for this annotation

GitHub Actions / check-lint

Change to sentence case [autofixable]
routing: {
request: {
method: 'PUT',
url: '/subscribers/lists',
body: '{{JSON.stringify({"ids":JSON.parse($parameter.subscriberIds), "action":$parameter.subscriptionAction, "target_list_ids":JSON.parse($parameter.listIds), "status":$parameter.subscriptionStatus })}}',
encoding: 'json',
json: true,
},
},
},
{
name: 'Get',
value: 'get',
Expand Down
79 changes: 79 additions & 0 deletions nodes/Listmonk/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,85 @@ export const listmonkOptions: INodeProperties[] = [
},
},
},
{
displayName: 'Subscriber IDs',
description: 'Subscriber ids',

Check failure on line 308 in nodes/Listmonk/options.ts

View workflow job for this annotation

GitHub Actions / check-lint

Remove omittable description [autofixable]

Check failure on line 308 in nodes/Listmonk/options.ts

View workflow job for this annotation

GitHub Actions / check-lint

Use 'ID' [autofixable]
name: 'subscriberIds',
type: 'json',
default: '[]',
displayOptions: {
show: {
operation: ['manageSubscribersLists'],
},
},
},
{
displayName: 'Action',
name: 'subscriptionAction',
type: 'options',
required: true,
options: [
{
name: 'Add',
value: 'add',
},
{
name: 'Remove',
value: 'remove',
},
{
name: 'Unsubscribe',
value: 'unsubscribe',
},
],
default: 'add', // The initially selected option
description: 'Subscriber status',
displayOptions: {
// the resources and operations to display this element with
show: {
operation: ['manageSubscribersLists'],
},
},
},
{
displayName: 'List IDs',
description: 'List ids to add subscribers to',

Check failure on line 348 in nodes/Listmonk/options.ts

View workflow job for this annotation

GitHub Actions / check-lint

Use 'ID' [autofixable]
name: 'listIds',
type: 'json',
default: '[]',
displayOptions: {
show: {
operation: ['manageSubscribersLists'],
},
},
},
{
displayName: 'Subscription Status',
name: 'subscriptionStatus',
type: 'options',
options: [
{
name: 'Confirmed',
value: 'confirmed',
},
{
name: 'Unconfirmed',
value: 'unconfirmed',
},
{
name: 'Unsubscribed',
value: 'unsubscribed',
},
],
default: '', // The initially selected option

Check failure on line 376 in nodes/Listmonk/options.ts

View workflow job for this annotation

GitHub Actions / check-lint

Set one of confirmed or unconfirmed or unsubscribed as default [autofixable]
description: 'Subscriber status',
displayOptions: {
// the resources and operations to display this element with
show: {
operation: ['manageSubscribersLists'],
},
},
},
{
displayName: 'Lists',
description: 'Lists to add the subscriber to',
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "n8n-nodes-listmonk",
"version": "1.0.5",
"version": "1.0.6",
"description": "A n8n node to interact with Listmonk app",
"keywords": [
"n8n-community-node-package",
Expand Down

0 comments on commit 94f4b8d

Please sign in to comment.