-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New Components - icontact #16870
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
New Components - icontact #16870
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5914093
icontact init
luancazarine a21a58c
[Components] icontact #13263
luancazarine f059355
pnpm update
luancazarine 10e2033
Update components/icontact/actions/create-message/create-message.mjs
luancazarine 65f764a
Update components/icontact/actions/create-contact/create-contact.mjs
luancazarine 3ff0549
Update components/icontact/actions/create-contact/create-contact.mjs
michelle0927 d7258b8
some adjusts
luancazarine 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
This file was deleted.
Oops, something went wrong.
124 changes: 124 additions & 0 deletions
124
components/icontact/actions/create-contact/create-contact.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,124 @@ | ||
| import { STATUS_OPTIONS } from "../../common/constants.mjs"; | ||
| import { checkWarnings } from "../../common/utils.mjs"; | ||
| import icontact from "../../icontact.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "icontact-create-contact", | ||
| name: "Create Contact", | ||
| description: "Creates a new contact within the iContact account. [See the documentation](https://help.icontact.com/customers/s/article/Contacts-iContact-API?r=153&ui-knowledge-components-aura-actions.KnowledgeArticleVersionCreateDraftFromOnlineAction.createDraftFromOnlineArticle=1)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| icontact, | ||
| email: { | ||
| type: "string", | ||
| label: "Email", | ||
| description: "The contact's email address. **Note: The email address must be unique**.", | ||
| }, | ||
| prefix: { | ||
| type: "string", | ||
| label: "Prefix", | ||
| description: "The contact's salutation. **E.g. Miss**", | ||
| optional: true, | ||
| }, | ||
| firstName: { | ||
| type: "string", | ||
| label: "First Name", | ||
| description: "The contact's first name.", | ||
| optional: true, | ||
| }, | ||
| lastName: { | ||
| type: "string", | ||
| label: "Last Name", | ||
| description: "The contact's last name.", | ||
| optional: true, | ||
| }, | ||
| suffix: { | ||
| type: "string", | ||
| label: "Suffix", | ||
| description: "The contact's name qualifications **E.g. III**.", | ||
| optional: true, | ||
| }, | ||
| street: { | ||
| type: "string", | ||
| label: "Street", | ||
| description: "The contact's street address information.", | ||
| optional: true, | ||
| }, | ||
| street2: { | ||
| type: "string", | ||
| label: "Street 2", | ||
| description: "The contact's line 2 information.", | ||
| optional: true, | ||
| }, | ||
| city: { | ||
| type: "string", | ||
| label: "City", | ||
| description: "The contact's city information.", | ||
| optional: true, | ||
| }, | ||
| state: { | ||
| type: "string", | ||
| label: "State", | ||
| description: "The contact's state information.", | ||
| optional: true, | ||
| }, | ||
| postalCode: { | ||
| type: "string", | ||
| label: "Postal Code", | ||
| description: "The contact's postal code information.", | ||
| optional: true, | ||
| }, | ||
| phone: { | ||
| type: "string", | ||
| label: "Phone", | ||
| description: "The contact's phone number.", | ||
| optional: true, | ||
| }, | ||
| fax: { | ||
| type: "string", | ||
| label: "Fax", | ||
| description: "The contact's fax number.", | ||
| optional: true, | ||
| }, | ||
| business: { | ||
| type: "string", | ||
| label: "Business", | ||
| description: "The contact's business phone number.", | ||
| optional: true, | ||
| }, | ||
| status: { | ||
| type: "string", | ||
| label: "Status", | ||
| description: "The subscription status of the contact.", | ||
| options: STATUS_OPTIONS, | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const { | ||
| icontact, | ||
| ...contact | ||
| } = this; | ||
|
|
||
| const { contacts } = await icontact.searchContact({ | ||
| params: { | ||
| email: contact.email, | ||
| }, | ||
| }); | ||
|
|
||
| if (contacts.length) throw new Error("A contact with the provided email already exists."); | ||
|
|
||
| const response = await icontact.createContact({ | ||
| $, | ||
| data: { | ||
| contact, | ||
| }, | ||
| }); | ||
|
|
||
| checkWarnings(response); | ||
|
|
||
| $.export("$summary", `Successfully created contact with ID: ${response.contacts[0].contactId}`); | ||
| return response.contacts[0]; | ||
| }, | ||
| }; |
82 changes: 82 additions & 0 deletions
82
components/icontact/actions/create-message/create-message.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,82 @@ | ||
| import { MESSAGE_TYPE_OPTIONS } from "../../common/constants.mjs"; | ||
| import { checkWarnings } from "../../common/utils.mjs"; | ||
| import icontact from "../../icontact.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "icontact-create-message", | ||
| name: "Create and Dispatch Message", | ||
| description: "Creates and dispatches a new message using custom HTML. [See the documentation](https://help.icontact.com/customers/s/article/Messages-iContact-API?r=153&ui-knowledge-components-aura-actions.KnowledgeArticleVersionCreateDraftFromOnlineAction.createDraftFromOnlineArticle=1)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| icontact, | ||
| campaignId: { | ||
| propDefinition: [ | ||
| icontact, | ||
| "campaignId", | ||
| ], | ||
| }, | ||
| messageType: { | ||
| type: "string", | ||
| label: "Message Type", | ||
| description: "The kind of message being added.", | ||
| options: MESSAGE_TYPE_OPTIONS, | ||
| }, | ||
| subject: { | ||
| type: "string", | ||
| label: "Subject", | ||
| description: "The subject line of the email.", | ||
| }, | ||
| htmlBody: { | ||
| type: "string", | ||
| label: "HTML Body", | ||
| description: "Contains the HTML version of the email message body.", | ||
| optional: true, | ||
| }, | ||
| textBody: { | ||
| type: "string", | ||
| label: "Text Body", | ||
| description: "Contains the text version of the email message body.", | ||
| optional: true, | ||
| }, | ||
| messageName: { | ||
| type: "string", | ||
| label: "Message Name", | ||
| description: "The reference name of the message. This is used for organizational purposes and will not be seen by your contacts.", | ||
| optional: true, | ||
| }, | ||
| previewText: { | ||
| type: "string", | ||
| label: "Preview Text", | ||
| description: "Indicates the preview text that some email systems display before opening the email.", | ||
| optional: true, | ||
| }, | ||
| replyToCampaignId: { | ||
| propDefinition: [ | ||
| icontact, | ||
| "campaignId", | ||
| ], | ||
| label: "Reply To Campaign Id", | ||
| description: "Indicates the sender property where you want reply emails to be sent to.", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const { | ||
| icontact, | ||
| ...message | ||
| } = this; | ||
|
|
||
| const response = await icontact.createMessage({ | ||
| $, | ||
| data: { | ||
| message, | ||
| }, | ||
| }); | ||
|
|
||
| checkWarnings(response); | ||
|
|
||
| $.export("$summary", `Successfully created message with ID: ${response.messages[0].messageId}`); | ||
| return response.messages[0]; | ||
| }, | ||
| }; |
41 changes: 41 additions & 0 deletions
41
components/icontact/actions/subscribe-contact-list/subscribe-contact-list.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,41 @@ | ||
| import { checkWarnings } from "../../common/utils.mjs"; | ||
| import icontact from "../../icontact.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "icontact-subscribe-contact-list", | ||
| name: "Subscribe Contact to List", | ||
| description: "Adds a contact to a specific list within iContact. [See the documentation](https://help.icontact.com/customers/s/article/Subscriptions-iContact-API?r=153&ui-knowledge-components-aura-actions.KnowledgeArticleVersionCreateDraftFromOnlineAction.createDraftFromOnlineArticle=1)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| icontact, | ||
| contactId: { | ||
| propDefinition: [ | ||
| icontact, | ||
| "contactId", | ||
| ], | ||
| }, | ||
| listId: { | ||
| propDefinition: [ | ||
| icontact, | ||
| "listId", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.icontact.subscribeContactToList({ | ||
| data: { | ||
| subscription: { | ||
| contactId: this.contactId, | ||
| listId: this.listId, | ||
| status: "normal", | ||
| }, | ||
| }, | ||
| }); | ||
|
|
||
| checkWarnings(response); | ||
|
|
||
| $.export("$summary", `Successfully created subscription with ID: ${response.subscriptions[0].subscriptionId}`); | ||
| return response.subscriptions[0]; | ||
| }, | ||
| }; |
This file was deleted.
Oops, something went wrong.
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,37 @@ | ||
| export const STATUS_OPTIONS = [ | ||
| { | ||
| label: "Normal - Contact can receive emails sent to them.", | ||
| value: "normal", | ||
| }, | ||
| { | ||
| label: "Bounced - Contact is unreachable via email.", | ||
| value: "bounced", | ||
| }, | ||
| { | ||
| label: "Do Not Contact - Contact is blocked from receiving emails.", | ||
| value: "donotcontact", | ||
| }, | ||
| { | ||
| label: "Pending - Contact must confirm a subscription before receiving emails.", | ||
| value: "pending", | ||
| }, | ||
| { | ||
| label: "Invitable - Contact must be sent an invitation message before receiving emails.", | ||
| value: "invitable", | ||
| }, | ||
| { | ||
| label: "Deleted - Contact was deleted from your records", | ||
| value: "deleted", | ||
| }, | ||
| ]; | ||
|
|
||
| export const MESSAGE_TYPE_OPTIONS = [ | ||
| { | ||
| label: "Normal - An email message.", | ||
| value: "normal", | ||
| }, | ||
| { | ||
| label: "Confirmation - An email that requests a contact to confirm their subscription", | ||
| value: "confirmation", | ||
| }, | ||
| ]; |
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,10 @@ | ||
| import { ConfigurationError } from "@pipedream/platform"; | ||
|
|
||
| export const checkWarnings = (response) => { | ||
| if (response.warnings) { | ||
| throw new ConfigurationError(response.warnings[0]); | ||
| } | ||
| if (response.notices) { | ||
| throw new ConfigurationError(response.notices[0]); | ||
| } | ||
| }; | ||
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.