Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added subscriber's list management feature #5

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 Down Expand Up @@ -87,6 +87,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',
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: 'Modify a Subscriber',
value: 'modifySubscriber',
Expand Down
78 changes: 78 additions & 0 deletions nodes/Listmonk/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,84 @@ export const listmonkOptions: INodeProperties[] = [
},
},
},
{
displayName: 'Subscriber IDs',
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',
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: 'confirmed', // The initially selected option
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