-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New Components - whautomate #13119
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 - whautomate #13119
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 3 Skipped Deployments
|
|
Important Review skippedReview was skipped due to path filters Files ignored due to path filters (1)
You can disable this status message by setting the WalkthroughThe changes enhance the Whautomate application by introducing new functionalities for managing contacts, tags, and webhooks. New modules for creating contacts, assigning tags, sending WhatsApp template messages, and handling appointment events have been added, significantly improving API capabilities and streamlining integrations. Changes
Assessment against linked issues
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
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 as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
Sources - New Appointment Cancelled (Instant) - New Appointment Scheduled (Instant) - New Client Created (Instant) Actions - Assign Tags Contact - Create Contact - Send Whatsapp Template Message
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: 16
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
Files selected for processing (14)
- components/whautomate/actions/assign-tags-contact/assign-tags-contact.mjs (1 hunks)
- components/whautomate/actions/create-contact/create-contact.mjs (1 hunks)
- components/whautomate/actions/send-whatsapp-template-message/send-whatsapp-template-message.mjs (1 hunks)
- components/whautomate/common/constants.mjs (1 hunks)
- components/whautomate/common/utils.mjs (1 hunks)
- components/whautomate/package.json (2 hunks)
- components/whautomate/sources/common/base.mjs (1 hunks)
- components/whautomate/sources/new-appointment-cancelled-instant/new-appointment-cancelled-instant.mjs (1 hunks)
- components/whautomate/sources/new-appointment-cancelled-instant/test-event.mjs (1 hunks)
- components/whautomate/sources/new-appointment-scheduled-instant/new-appointment-scheduled-instant.mjs (1 hunks)
- components/whautomate/sources/new-appointment-scheduled-instant/test-event.mjs (1 hunks)
- components/whautomate/sources/new-client-created-instant/new-client-created-instant.mjs (1 hunks)
- components/whautomate/sources/new-client-created-instant/test-event.mjs (1 hunks)
- components/whautomate/whautomate.app.mjs (1 hunks)
Files skipped from review due to trivial changes (1)
- components/whautomate/common/constants.mjs
Additional comments not posted (26)
components/whautomate/package.json (2)
3-3: Version increment approved.The version number has been incremented to
0.1.0, indicating a new release with enhancements or new features.
15-17: Dependency addition approved.The addition of
@pipedream/platformwith version^3.0.0is approved, indicating that new functionalities or features introduced in this release require this platform version.components/whautomate/sources/new-appointment-cancelled-instant/new-appointment-cancelled-instant.mjs (4)
1-2: Imports look good.The imports are necessary and correctly referenced.
4-11: Configuration looks good.The webhook source configuration for "New Appointment Cancelled" is correctly defined.
12-22: Methods look good.The
getEventandgetSummarymethods are correctly implemented.
23-23: SampleEmit reference looks good.The sampleEmit object is correctly referenced.
components/whautomate/sources/new-appointment-scheduled-instant/new-appointment-scheduled-instant.mjs (4)
1-2: Imports look good.The imports are necessary and correctly referenced.
4-11: Configuration looks good.The webhook source configuration for "New Appointment Scheduled" is correctly defined.
12-22: Methods look good.The
getEventandgetSummarymethods are correctly implemented.
23-23: SampleEmit reference looks good.The sampleEmit object is correctly referenced.
components/whautomate/sources/new-client-created-instant/test-event.mjs (3)
1-7: Event object looks good.The event object is correctly defined.
8-38: Client object looks good.The client object is correctly defined.
1-39: Export statement looks good.The export statement is correctly defined.
components/whautomate/actions/assign-tags-contact/assign-tags-contact.mjs (2)
1-2: Imports look good.The imports are necessary for the functionality of the action.
4-24: Export default object looks good.The properties are correctly defined and the descriptions are accurate.
components/whautomate/sources/common/base.mjs (3)
1-1: Import looks good.The import is necessary for the functionality of the webhook sources.
3-16: Export default object looks good.The properties are correctly defined and the descriptions are accurate.
40-49: Run method looks good.The logic of the run method is correct and the emitted events are correctly formatted.
components/whautomate/sources/new-appointment-scheduled-instant/test-event.mjs (1)
1-48: Test event JSON object looks good.The structure of the JSON object is correct and all necessary properties are included.
components/whautomate/sources/new-appointment-cancelled-instant/test-event.mjs (1)
1-47: LGTM! Ensure the data types and formats are correct.The JSON structure for the cancelled appointment event is well-formed and includes detailed information. Ensure that the data types and formats (e.g., timestamps, IDs) are correct and consistent with the rest of the system.
components/whautomate/actions/create-contact/create-contact.mjs (3)
1-3: LGTM! Imports are correct.The import statements correctly bring in the necessary constants, utility functions, and the
whautomatemodule.
5-55: LGTM! Module definition and properties are well-defined.The module definition includes a clear key, name, description, version, type, and properties. The required and optional fields are well-defined with appropriate descriptions and types.
56-79: LGTM! Therunfunction is well-implemented.The
runfunction correctly extracts properties, calls thecreateContactmethod, and exports a summary message. The use ofparseObjectensures proper formatting of tags and custom fields.components/whautomate/actions/send-whatsapp-template-message/send-whatsapp-template-message.mjs (3)
1-3: LGTM! Imports are correct.The import statements correctly bring in the necessary
ConfigurationErrorclass, utility functions, and thewhautomatemodule.
5-58: LGTM! Module definition and properties are well-defined.The module definition includes a clear key, name, description, version, type, and properties. The required and optional fields are well-defined with appropriate descriptions and types.
60-86: LGTM! Therunfunction is well-implemented.The
runfunction correctly extracts properties, calls thesendWhatsAppMessageTemplatemethod, and handles errors. The use ofparseObjectensures proper formatting of text and URL parameters. The error handling withConfigurationErroris appropriate.
components/whautomate/sources/new-client-created-instant/new-client-created-instant.mjs
Show resolved
Hide resolved
components/whautomate/actions/assign-tags-contact/assign-tags-contact.mjs
Show resolved
Hide resolved
components/whautomate/actions/create-contact/create-contact.mjs
Outdated
Show resolved
Hide resolved
components/whautomate/actions/send-whatsapp-template-message/send-whatsapp-template-message.mjs
Outdated
Show resolved
Hide resolved
Co-authored-by: michelle0927 <michelle0927@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: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- components/whautomate/sources/common/base.mjs (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- components/whautomate/sources/common/base.mjs
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: 0
Outside diff range, codebase verification and nitpick comments (1)
components/whautomate/sources/common/base.mjs (1)
48-57: Minor improvement: Use optional chaining for timestamp parsing.The function is correctly implemented, but consider using optional chaining to avoid potential errors if
body.eventorbody.event.timeStampis undefined.- const ts = Date.parse(body.event.timeStamp); + const ts = Date.parse(body.event?.timeStamp);
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
Files selected for processing (3)
- components/whautomate/actions/create-contact/create-contact.mjs (1 hunks)
- components/whautomate/actions/send-whatsapp-template-message/send-whatsapp-template-message.mjs (1 hunks)
- components/whautomate/sources/common/base.mjs (1 hunks)
Files skipped from review due to trivial changes (1)
- components/whautomate/actions/send-whatsapp-template-message/send-whatsapp-template-message.mjs
Files skipped from review as they are similar to previous changes (1)
- components/whautomate/actions/create-contact/create-contact.mjs
Additional comments not posted (4)
components/whautomate/sources/common/base.mjs (4)
1-1: LGTM!The import statement is correct.
3-16: LGTM!The props are well-defined and necessary for the component's functionality.
17-23: LGTM!The methods
_setWebhookIdand_getWebhookIdare correctly implemented.
25-47: Consider adding error handling in hooks.The logic of the hooks is correct, but consider adding error handling to manage potential errors during the API calls.
hooks: { async activate() { try { const data = await this.whautomate.createWebhook({ data: { webhookHeaders: [ { "key": "Content-Type", "value": "application/json", }, ], events: this.getEvent(), name: this.name, serverUrl: this.http.endpoint, active: true, }, }); this._setWebhookId(data.id); } catch (error) { console.error(`Failed to activate webhook: ${error.message}`); throw error; } }, async deactivate() { try { const webhookId = this._getWebhookId(); await this.whautomate.deleteWebhook(webhookId); } catch (error) { console.error(`Failed to deactivate webhook: ${error.message}`); throw error; } }, }
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!
|
/approve |
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: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
Files selected for processing (1)
- components/whautomate/actions/assign-tags-contact/assign-tags-contact.mjs (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- components/whautomate/actions/assign-tags-contact/assign-tags-contact.mjs
Resolves #13095.
Summary by CodeRabbit
New Features
Chores