-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New Components - campaign_monitor #14635
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
Merged
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
84 changes: 84 additions & 0 deletions
84
components/campaign_monitor/actions/add-subscriber/add-subscriber.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| import campaignMonitor from "../../campaign_monitor.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "campaign_monitor-add-subscriber", | ||
| name: "Add Subscriber", | ||
| description: "Creates a new subscriber on a specific list. [See the documentation](https://www.campaignmonitor.com/api/v3-3/subscribers/)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| campaignMonitor, | ||
| clientId: { | ||
| propDefinition: [ | ||
| campaignMonitor, | ||
| "clientId", | ||
| ], | ||
| }, | ||
| listId: { | ||
| propDefinition: [ | ||
| campaignMonitor, | ||
| "listId", | ||
| (c) => ({ | ||
| clientId: c.clientId, | ||
| }), | ||
| ], | ||
| }, | ||
| email: { | ||
| type: "string", | ||
| label: "Email", | ||
| description: "The email address of the subscriber", | ||
| }, | ||
| name: { | ||
| type: "string", | ||
| label: "Name", | ||
| description: "The name of the subscriber", | ||
| optional: true, | ||
| }, | ||
| phone: { | ||
| type: "string", | ||
| label: "Phone", | ||
| description: "The phone number of the subscriber. Example: `+5012398752`", | ||
| optional: true, | ||
| }, | ||
| consentToTrack: { | ||
| propDefinition: [ | ||
| campaignMonitor, | ||
| "consentToTrack", | ||
| ], | ||
| }, | ||
| consentToSendSMS: { | ||
| type: "string", | ||
| label: "Consent to Send SMS", | ||
| description: "Indicates if consent has been granted by the subscriber to receive Sms", | ||
| options: [ | ||
| "Yes", | ||
| "No", | ||
| "Unchanged", | ||
| ], | ||
| default: "Unchanged", | ||
| optional: true, | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| resubscribe: { | ||
| type: "boolean", | ||
| label: "Resubscribe", | ||
| description: "Resubscribe if the email address has previously been unsubscribed", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.campaignMonitor.createSubscriber({ | ||
| $, | ||
| listId: this.listId, | ||
| data: { | ||
| EmailAddress: this.email, | ||
| Name: this.name, | ||
| MobileNumber: this.phone, | ||
| ConsentToTrack: this.consentToTrack, | ||
| ConsentToSendSms: this.consentToSendSMS, | ||
| Resubscribe: this.resubscribe, | ||
| }, | ||
| }); | ||
| $.export("$summary", `Successfully added subscriber ${this.email}`); | ||
| return response; | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }; | ||
64 changes: 64 additions & 0 deletions
64
...ampaign_monitor/actions/send-smart-transactional-email/send-smart-transactional-email.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| import campaignMonitor from "../../campaign_monitor.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "campaign_monitor-send-smart-transactional-email", | ||
| name: "Send Smart Transactional Email", | ||
| description: "Sends an intelligent transactional email to a specified recipient. [See the documentation](https://www.campaignmonitor.com/api/v3-3/transactional/#send-smart-email)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| campaignMonitor, | ||
| clientId: { | ||
| propDefinition: [ | ||
| campaignMonitor, | ||
| "clientId", | ||
| ], | ||
| }, | ||
| smartEmailId: { | ||
| propDefinition: [ | ||
| campaignMonitor, | ||
| "smartEmailId", | ||
| (c) => ({ | ||
| clientId: c.clientId, | ||
| }), | ||
| ], | ||
| }, | ||
| to: { | ||
| type: "string", | ||
| label: "To", | ||
| description: "An array of email addresses to send the email to", | ||
| }, | ||
| cc: { | ||
| type: "string", | ||
| label: "CC", | ||
| description: "An array of email address to carbon copy the email to", | ||
| optional: true, | ||
| }, | ||
| bcc: { | ||
| type: "string", | ||
| label: "BCC", | ||
| description: "An array of email address to blind carbon copy the email to", | ||
| optional: true, | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| consentToTrack: { | ||
| propDefinition: [ | ||
| campaignMonitor, | ||
| "consentToTrack", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.campaignMonitor.sendSmartEmail({ | ||
| $, | ||
| smartEmailId: this.smartEmailId, | ||
| data: { | ||
| To: this.to, | ||
| CC: this.cc, | ||
| BCC: this.bcc, | ||
| ConsentToTrack: this.consentToTrack, | ||
| }, | ||
| }); | ||
| $.export("$summary", "Successfully sent smart transactional email"); | ||
| return response; | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }; | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
47 changes: 47 additions & 0 deletions
47
components/campaign_monitor/actions/unsubscribe/unsubscribe.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| import campaignMonitor from "../../campaign_monitor.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "campaign_monitor-unsubscribe", | ||
| name: "Unsubscribe", | ||
| description: "Removes a subscriber from a mailing list given their email address. [See the documentation](https://www.campaignmonitor.com/api/v3-3/subscribers/#unsubscribing-a-subscriber)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| campaignMonitor, | ||
| clientId: { | ||
| propDefinition: [ | ||
| campaignMonitor, | ||
| "clientId", | ||
| ], | ||
| }, | ||
| listId: { | ||
| propDefinition: [ | ||
| campaignMonitor, | ||
| "listId", | ||
| (c) => ({ | ||
| clientId: c.clientId, | ||
| }), | ||
| ], | ||
| }, | ||
| subscriber: { | ||
| propDefinition: [ | ||
| campaignMonitor, | ||
| "subscriber", | ||
| (c) => ({ | ||
| listId: c.listId, | ||
| }), | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.campaignMonitor.unsubscribeSubscriber({ | ||
| $, | ||
| listId: this.listId, | ||
| data: { | ||
| EmailAddress: this.subscriber, | ||
| }, | ||
| }); | ||
| $.export("$summary", `Successfully unsubscribed ${this.subscriber}`); | ||
| return response; | ||
| }, | ||
| }; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.