-
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
New Components - icontact #16870
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 3 Skipped Deployments
|
WalkthroughThis update introduces a comprehensive iContact integration, including a new app module, three instant webhook sources for contact creation, update, and subscription events, and three actions for creating contacts, sending messages, and subscribing contacts to lists. Each component includes required properties, API interactions, and event or summary handling. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Action
participant iContactApp
participant iContactAPI
User->>Action: Trigger (e.g., Create Contact)
Action->>iContactApp: Call method (e.g., createContact)
iContactApp->>iContactAPI: Make HTTP request
iContactAPI-->>iContactApp: Respond with result
iContactApp-->>Action: Return API response
Action-->>User: Return summary and data
sequenceDiagram
participant iContactAPI
participant SourceComponent
participant HTTP
participant DB
iContactAPI-->>HTTP: Send webhook event (e.g., contact.created)
HTTP->>SourceComponent: Pass event with headers/body
SourceComponent->>SourceComponent: Verify signature
alt Signature valid
SourceComponent->>DB: (if needed) Store/retrieve webhook ID
SourceComponent-->>User: Emit event with contact data
SourceComponent-->>HTTP: Respond 200 OK
else Signature invalid
SourceComponent-->>HTTP: Respond 401 Unauthorized
end
Assessment against linked issues
Suggested labels
Suggested reviewers
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
components/icontact/icontact.app.mjsOops! Something went wrong! :( ESLint: 8.57.1 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (4)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Sources - New Contact (Instant) - Updated Contact (Instant) - Contact Subscribed (Instant) Actions - Create Contact - Create Message - Subscribe Contact List
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 9
🧹 Nitpick comments (12)
components/icontact/icontact.app.mjs (1)
156-166: Implement webhook event hooks or remove placeholders.The hooks section contains only placeholder comments without implementation. These should either be implemented or removed to avoid confusion.
Would you like me to help implement these webhook event hooks, or should these placeholders be removed for now?
components/icontact/actions/subscribe-contact-list/subscribe-contact-list.mjs (2)
2-2: Remove unused axios import.The axios import is not used anywhere in this file and should be removed to keep the code clean.
-import { axios } from "@pipedream/platform";🧰 Tools
🪛 GitHub Check: Lint Code Base
[failure] 2-2:
'axios' is defined but never used
8-8: Remove {{ts}} macro before committing.The {{ts}} macro should be replaced with an actual timestamp before the component is committed to production.
🧰 Tools
🪛 GitHub Check: Lint Code Base
[warning] 8-8:
{{ts}} macro should be removed before committingcomponents/icontact/sources/contact-subscribed-instant/contact-subscribed-instant.mjs (2)
3-3: Remove unused axios import.The axios import is not used anywhere in this file and should be removed.
-import { axios } from "@pipedream/platform";🧰 Tools
🪛 GitHub Check: Lint Code Base
[failure] 3-3:
'axios' is defined but never used
9-9: Remove {{ts}} macro before committing.The {{ts}} macro should be replaced with an actual timestamp before the component is committed to production.
🧰 Tools
🪛 GitHub Check: Lint Code Base
[warning] 9-9:
{{ts}} macro should be removed before committingcomponents/icontact/sources/new-contact-instant/new-contact-instant.mjs (4)
2-2: Remove unused axios import.The axios import is not used anywhere in this file and should be removed.
-import { axios } from "@pipedream/platform";🧰 Tools
🪛 GitHub Check: Lint Code Base
[failure] 2-2:
'axios' is defined but never used
8-8: Remove {{ts}} macro before committing.The {{ts}} macro should be replaced with an actual timestamp before the component is committed to production.
🧰 Tools
🪛 GitHub Check: Lint Code Base
[warning] 8-8:
{{ts}} macro should be removed before committing
30-33: Use consistent import pattern for crypto module.Use the import statement at the top of the file instead of require() for consistency with other files in this PR.
+import crypto from "crypto";And update the method:
- async _verifySignature(event) { - const computedSignature = require("crypto") - .createHmac("sha256", this.icontact.$auth.api_key) - .update(event.rawBody) - .digest("base64"); + async _verifySignature(event) { + const computedSignature = crypto + .createHmac("sha256", this.icontact.$auth.api_key) + .update(event.rawBody) + .digest("base64");
40-42: Implement the deploy hook for historical data.The deploy hook is currently unimplemented. Consider adding functionality to fetch and emit recent contacts for consistency with other source components.
Would you like me to help implement the deploy hook similar to the other source components?
components/icontact/sources/updated-contact-instant/updated-contact-instant.mjs (3)
3-3: Remove unused axios import.The axios import is not used anywhere in this file and should be removed.
-import { axios } from "@pipedream/platform";🧰 Tools
🪛 GitHub Check: Lint Code Base
[failure] 3-3:
'axios' is defined but never used
9-9: Remove {{ts}} macro before committing.The {{ts}} macro should be replaced with an actual timestamp before the component is committed to production.
🧰 Tools
🪛 GitHub Check: Lint Code Base
[warning] 9-9:
{{ts}} macro should be removed before committing
70-75: Standardize data access pattern.This component uses
event.bodyand manually parses JSON, while other components useevent.body_raw. Consider standardizing the approach across all source components.- const rawBody = event.body; + const rawBody = event.body_raw;And remove the manual JSON parsing if the webhook already provides parsed data:
- const data = JSON.parse(rawBody); + const data = event.body;
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
components/icontact/actions/create-contact/create-contact.mjs(1 hunks)components/icontact/actions/create-message/create-message.mjs(1 hunks)components/icontact/actions/subscribe-contact-list/subscribe-contact-list.mjs(1 hunks)components/icontact/app/icontact.app.ts(1 hunks)components/icontact/icontact.app.mjs(1 hunks)components/icontact/sources/contact-subscribed-instant/contact-subscribed-instant.mjs(1 hunks)components/icontact/sources/new-contact-instant/new-contact-instant.mjs(1 hunks)components/icontact/sources/updated-contact-instant/updated-contact-instant.mjs(1 hunks)
🧰 Additional context used
🪛 GitHub Check: Lint Code Base
components/icontact/actions/create-message/create-message.mjs
[failure] 2-2:
'axios' is defined but never used
[warning] 8-8:
{{ts}} macro should be removed before committing
components/icontact/actions/create-contact/create-contact.mjs
[failure] 2-2:
'axios' is defined but never used
components/icontact/sources/contact-subscribed-instant/contact-subscribed-instant.mjs
[failure] 3-3:
'axios' is defined but never used
[warning] 9-9:
{{ts}} macro should be removed before committing
[warning] 13-13:
Component prop icontact must have a label. See https://pipedream.com/docs/components/guidelines/#props
[warning] 13-13:
Component prop icontact must have a description. See https://pipedream.com/docs/components/guidelines/#props
components/icontact/sources/new-contact-instant/new-contact-instant.mjs
[failure] 1-1:
'icontact' is defined but never used
[failure] 2-2:
'axios' is defined but never used
[warning] 8-8:
{{ts}} macro should be removed before committing
[warning] 12-12:
Component prop icontact must have a label. See https://pipedream.com/docs/components/guidelines/#props
[warning] 12-12:
Component prop icontact must have a description. See https://pipedream.com/docs/components/guidelines/#props
components/icontact/sources/updated-contact-instant/updated-contact-instant.mjs
[failure] 3-3:
'axios' is defined but never used
[warning] 7-7:
Source names should start with "New". See https://pipedream.com/docs/components/guidelines/#source-name
[warning] 9-9:
{{ts}} macro should be removed before committing
components/icontact/actions/subscribe-contact-list/subscribe-contact-list.mjs
[failure] 2-2:
'axios' is defined but never used
[warning] 8-8:
{{ts}} macro should be removed before committing
🪛 GitHub Actions: Pull Request Checks
components/icontact/actions/create-contact/create-contact.mjs
[error] 2-2: ESLint: 'axios' is defined but never used. (no-unused-vars)
🔇 Additional comments (10)
components/icontact/icontact.app.mjs (1)
26-32:✅ Verification successful
Verify that the getLists method is implemented correctly.
The
listIdproperty definition referencesthis.getLists()in its options function, but I want to ensure this method returns the expected data structure for the mapping operation.
🏁 Script executed:
#!/bin/bash # Description: Verify iContact API documentation for lists endpoint structure # Expected: Confirm the response format includes 'name' and 'id' fieldsLength of output: 0
🌐 Web query:
What is the response format for iContact API lists endpoint? Does it return an array with 'name' and 'id' fields?💡 Result:
The iContact API's lists endpoint returns a JSON array of list objects, each containing various fields. While the exact fields may vary, each list object typically includes an
idfield representing the list's unique identifier and anamefield representing the list's name. For example, a list object might look like this:{ "id": "1", "name": "Monthly Specials", "status": "ACTIVE", "created_date": "2013-03-11T20:37:28.000Z", "modified_date": "2013-03-11T20:41:42.000Z", "contact_count": 127 }This structure indicates that each list object includes at least the
idandnamefields, along with other details such asstatus,created_date,modified_date, andcontact_count. (v2.developer.constantcontact.com)Therefore, the response format for the iContact API's lists endpoint does return an array of objects containing
idandnamefields.Citations:
Mapping of list.name and list.id is correct per iContact API docs
I verified that the iContact “lists” endpoint returns an array of objects containing at least
idandnamefields (along with other metadata). The existing mapping inoptions()correctly transforms each list into{ label: list.name, value: list.id }. No changes needed.components/icontact/app/icontact.app.ts (1)
13-13: LGTM!The newline addition improves file formatting and has no functional impact.
components/icontact/actions/create-message/create-message.mjs (1)
38-48: LGTM!The action implementation correctly uses the app's
createAndSendMessagemethod and provides appropriate user feedback.components/icontact/actions/create-contact/create-contact.mjs (1)
40-50: LGTM!The action implementation is well-structured with proper defensive programming (
this.contactInfo || {}) and clear user feedback.components/icontact/actions/subscribe-contact-list/subscribe-contact-list.mjs (1)
25-33: LGTM! The subscription logic is well-implemented.The run method correctly calls the icontact app's
subscribeContactToListmethod with the required parameters and provides a clear success message.components/icontact/sources/contact-subscribed-instant/contact-subscribed-instant.mjs (3)
36-39: LGTM! Signature computation is correctly implemented.The HMAC SHA-256 signature computation for webhook verification follows security best practices.
42-58: LGTM! Deploy hook provides good historical data initialization.The deploy hook correctly fetches recent contacts and emits them as initial events, providing users with immediate data when the component is first deployed.
83-112: LGTM! Webhook processing with signature verification is well-implemented.The run method properly verifies webhook signatures, handles authentication failures, and emits events only for matching event types and list IDs. The implementation follows security best practices.
components/icontact/sources/new-contact-instant/new-contact-instant.mjs (1)
74-75:❓ Verification inconclusive
Verify data access pattern consistency.
This component uses
event.datawhile others useevent.body. Ensure this is the correct data structure for the "contact.created" webhook payload.
🏁 Script executed:
#!/bin/bash # Search for similar data access patterns in other iContact source components rg -A 3 -B 3 "event\.(body|data)" components/icontact/sources/Length of output: 64
Confirm iContact webhook payload shape
- I ran
rg -A3 -B3 "event\.(body|data)" components/icontact/sources/and did not find any other references toevent.bodyorevent.datain the iContact sources.- In components/icontact/sources/new-contact-instant/new-contact-instant.mjs (lines 74–75) you’re destructuring
event.data:const { data: contact } = event; this.$emit(contact, {- Please verify in the iContact “contact.created” webhook documentation that the payload indeed places the contact record under
data(not underbody) before merging this change.components/icontact/sources/updated-contact-instant/updated-contact-instant.mjs (1)
32-41: LGTM! Deploy hook implementation provides good historical data.The deploy hook correctly fetches recent contacts and emits them as initial events, providing users with immediate data when the component is first deployed.
components/icontact/sources/contact-subscribed-instant/contact-subscribed-instant.mjs
Outdated
Show resolved
Hide resolved
components/icontact/sources/new-contact-instant/new-contact-instant.mjs
Outdated
Show resolved
Hide resolved
components/icontact/sources/updated-contact-instant/updated-contact-instant.mjs
Outdated
Show resolved
Hide resolved
components/icontact/sources/updated-contact-instant/updated-contact-instant.mjs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 5
♻️ Duplicate comments (2)
components/icontact/sources/contact-subscribed-instant/contact-subscribed-instant.mjs (1)
5-5: Missing label and description for icontact prop (duplicate issue).This is the same issue identified in the past review comments. The icontact prop in the base module needs label and description fields to comply with Pipedream component guidelines.
components/icontact/sources/common/base.mjs (1)
5-5: Add required label and description to icontact prop.The icontact prop is missing the required label and description fields as noted in the past review comments for the child component.
Apply this diff to fix the issue:
- icontact, + icontact: { + type: "app", + app: "icontact", + label: "iContact", + description: "Connect your iContact account", + },
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (16)
components/icontact/.gitignore(0 hunks)components/icontact/actions/create-contact/create-contact.mjs(1 hunks)components/icontact/actions/create-message/create-message.mjs(1 hunks)components/icontact/actions/subscribe-contact-list/subscribe-contact-list.mjs(1 hunks)components/icontact/app/icontact.app.ts(0 hunks)components/icontact/common/constants.mjs(1 hunks)components/icontact/common/utils.mjs(1 hunks)components/icontact/icontact.app.mjs(1 hunks)components/icontact/package.json(1 hunks)components/icontact/sources/common/base.mjs(1 hunks)components/icontact/sources/contact-subscribed-instant/contact-subscribed-instant.mjs(1 hunks)components/icontact/sources/contact-subscribed-instant/test-event.mjs(1 hunks)components/icontact/sources/new-contact-instant/new-contact-instant.mjs(1 hunks)components/icontact/sources/new-contact-instant/test-event.mjs(1 hunks)components/icontact/sources/updated-contact-instant/test-event.mjs(1 hunks)components/icontact/sources/updated-contact-instant/updated-contact-instant.mjs(1 hunks)
💤 Files with no reviewable changes (2)
- components/icontact/.gitignore
- components/icontact/app/icontact.app.ts
✅ Files skipped from review due to trivial changes (5)
- components/icontact/sources/new-contact-instant/test-event.mjs
- components/icontact/sources/updated-contact-instant/test-event.mjs
- components/icontact/sources/contact-subscribed-instant/test-event.mjs
- components/icontact/common/constants.mjs
- components/icontact/sources/updated-contact-instant/updated-contact-instant.mjs
🚧 Files skipped from review as they are similar to previous changes (3)
- components/icontact/sources/new-contact-instant/new-contact-instant.mjs
- components/icontact/icontact.app.mjs
- components/icontact/actions/subscribe-contact-list/subscribe-contact-list.mjs
⏰ Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: Verify TypeScript components
- GitHub Check: pnpm publish
- GitHub Check: Publish TypeScript components
- GitHub Check: Lint Code Base
🔇 Additional comments (8)
components/icontact/package.json (3)
3-3: LGTM: Appropriate version bump for new features.The version bump to 0.1.0 correctly follows semantic versioning for the addition of new components and features.
5-5: LGTM: Main entry point updated correctly.The change from the dist directory to the direct .mjs file aligns with the new file structure.
15-17: LGTM: Platform dependency added appropriately.The @pipedream/platform dependency is correctly added to support the new app and action modules.
components/icontact/sources/contact-subscribed-instant/contact-subscribed-instant.mjs (2)
14-16: LGTM: Event type correctly specified.The event type "contact_subscribed" is appropriate for this webhook source.
17-25: LGTM: Metadata generation is well-implemented.The generateMeta method creates unique IDs using contact and list IDs, provides descriptive summaries, and includes proper timestamps.
components/icontact/actions/create-message/create-message.mjs (1)
5-82: Well-structured action implementation.The action follows Pipedream conventions correctly with comprehensive prop definitions, proper async/await usage, and appropriate error handling with the checkWarnings utility.
components/icontact/actions/create-contact/create-contact.mjs (2)
104-110: Excellent duplicate prevention logic.The duplicate email check before contact creation is a good defensive programming practice that prevents API errors and provides clear feedback to users.
11-97: Comprehensive and well-documented props definition.The props are excellently structured with clear descriptions, appropriate types, and proper use of constants for predefined options. The email uniqueness constraint is clearly documented.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
components/icontact/actions/create-contact/create-contact.mjs(1 hunks)components/icontact/actions/create-message/create-message.mjs(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- components/icontact/actions/create-message/create-message.mjs
🧰 Additional context used
🪛 Biome (1.9.4)
components/icontact/actions/create-contact/create-contact.mjs
[error] 118-118: expected , but instead found )
Remove )
(parse)
[error] 118-118: expected , but instead found ;
Remove ;
(parse)
[error] 123-123: Illegal return statement outside of a function
(parse)
[error] 124-125: Expected a statement but instead found '},
}'.
Expected a statement here.
(parse)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Verify TypeScript components
- GitHub Check: Publish TypeScript components
- GitHub Check: Lint Code Base
🔇 Additional comments (2)
components/icontact/actions/create-contact/create-contact.mjs (2)
99-117: LGTM: Clean implementation of contact creation logic.The contact creation flow is well-implemented:
- Proper destructuring to separate the app instance from contact data
- Email uniqueness validation before creation
- Clean error handling for duplicate contacts
120-123: LGTM: Proper response handling and summary generation.Good practices implemented:
- Warning checks using the shared utility function
- Informative summary export with the new contact ID
- Returning the created contact object for further use
🧰 Tools
🪛 Biome (1.9.4)
[error] 123-123: Illegal return statement outside of a function
(parse)
michelle0927
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Just need to resolve one lint issue.
|
/approve |
Resolves #13263.
Summary by CodeRabbit