-
Notifications
You must be signed in to change notification settings - Fork 5.4k
[ACTION] Clevertap new campaign components #17564
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
Conversation
WalkthroughThis update introduces full integration with the CleverTap Campaign API, adding new actions for creating, stopping, listing, and reporting on campaigns. Supporting methods are implemented in the CleverTap app module, and a utility for safe recursive JSON parsing is included. Minor version bumps and dependency updates are also present. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant ActionModule
participant CleverTapApp
participant CleverTapAPI
User->>ActionModule: Initiate campaign action (create/stop/get/report)
ActionModule->>CleverTapApp: Call corresponding method (e.g., createCampaign)
CleverTapApp->>CleverTapAPI: Make HTTP request to campaign endpoint
CleverTapAPI-->>CleverTapApp: Return API response
CleverTapApp-->>ActionModule: Return processed response
ActionModule-->>User: Output result/summary
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/clevertap/actions/get-campaigns/get-campaigns.mjsOops! Something went wrong! :( ESLint: 8.57.1 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs components/clevertap/actions/stop-campaign/stop-campaign.mjsOops! Something went wrong! :( ESLint: 8.57.1 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs components/clevertap/actions/create-campaign/create-campaign.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 ignored due to path filters (1)
📒 Files selected for processing (9)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (8)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (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 (
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 3 Skipped Deployments
|
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: 2
🧹 Nitpick comments (5)
components/clevertap/actions/get-campaign-report/get-campaign-report.mjs (1)
19-35
: Make the summary message more descriptive.The current summary message is generic. Consider including the campaign ID to provide more context to the user.
- $.export("$summary", "Successfully retrieved report for campaign"); + $.export("$summary", `Successfully retrieved report for campaign ${campaignId}`);components/clevertap/actions/get-campaigns/get-campaigns.mjs (2)
11-20
: Consider adding date format validation.The action expects dates in
YYYYMMDD
format but doesn't validate the input. Invalid date formats could cause API errors.Consider adding validation or using a more user-friendly date input type:
from: { - type: "string", + type: "string", label: "From Date", - description: "Start of the date range for which you want to retrieve campaigns. Use `YYYYMMDD` format.", + description: "Start of the date range for which you want to retrieve campaigns. Use `YYYYMMDD` format (e.g., 20231201).", + optional: false, }, to: { - type: "string", + type: "string", label: "To Date", - description: "End of the date range for which you want to retrieve campaigns. Use `YYYYMMDD` format.", + description: "End of the date range for which you want to retrieve campaigns. Use `YYYYMMDD` format (e.g., 20231231).", + optional: false, },
37-37
: Enhance the summary message with specific details.Based on the retrieved learnings, summary messages should include specific counts when available to provide more useful feedback.
- $.export("$summary", "Successfully retrieved campaigns"); + $.export("$summary", `Successfully retrieved ${response.targets?.length || 0} campaigns`);components/clevertap/actions/stop-campaign/stop-campaign.mjs (1)
30-30
: Enhance the summary message with campaign details.The summary message could be more specific by including the campaign ID that was stopped.
- $.export("$summary", "Successfully stopped campaign"); + $.export("$summary", `Successfully stopped campaign ${campaignId}`);components/clevertap/actions/create-campaign/create-campaign.mjs (1)
117-117
: Consider enhancing the summary message with campaign details.The summary message could include the created campaign name for better feedback.
- $.export("$summary", "Successfully created campaign"); + $.export("$summary", `Successfully created campaign "${name}"`);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (9)
components/clevertap/actions/create-campaign/create-campaign.mjs
(1 hunks)components/clevertap/actions/create-or-update-user/create-or-update-user.mjs
(1 hunks)components/clevertap/actions/get-campaign-report/get-campaign-report.mjs
(1 hunks)components/clevertap/actions/get-campaigns/get-campaigns.mjs
(1 hunks)components/clevertap/actions/stop-campaign/stop-campaign.mjs
(1 hunks)components/clevertap/actions/upload-events/upload-events.mjs
(1 hunks)components/clevertap/clevertap.app.mjs
(3 hunks)components/clevertap/common/utils.mjs
(1 hunks)components/clevertap/package.json
(2 hunks)
🧰 Additional context used
🧠 Learnings (8)
components/clevertap/package.json (1)
Learnt from: jcortes
PR: PipedreamHQ/pipedream#14935
File: components/sailpoint/package.json:15-18
Timestamp: 2024-12-12T19:23:09.039Z
Learning: When developing Pipedream components, do not add built-in Node.js modules like `fs` to `package.json` dependencies, as they are native modules provided by the Node.js runtime.
components/clevertap/actions/create-or-update-user/create-or-update-user.mjs (1)
Learnt from: jcortes
PR: PipedreamHQ/pipedream#14467
File: components/gainsight_px/actions/create-account/create-account.mjs:4-6
Timestamp: 2024-10-30T15:24:39.294Z
Learning: In `components/gainsight_px/actions/create-account/create-account.mjs`, the action name should be "Create Account" instead of "Create Memory".
components/clevertap/actions/upload-events/upload-events.mjs (1)
Learnt from: jcortes
PR: PipedreamHQ/pipedream#14467
File: components/gainsight_px/actions/create-account/create-account.mjs:4-6
Timestamp: 2024-10-30T15:24:39.294Z
Learning: In `components/gainsight_px/actions/create-account/create-account.mjs`, the action name should be "Create Account" instead of "Create Memory".
components/clevertap/actions/stop-campaign/stop-campaign.mjs (1)
Learnt from: jcortes
PR: PipedreamHQ/pipedream#14467
File: components/gainsight_px/actions/create-account/create-account.mjs:4-6
Timestamp: 2024-10-30T15:24:39.294Z
Learning: In `components/gainsight_px/actions/create-account/create-account.mjs`, the action name should be "Create Account" instead of "Create Memory".
components/clevertap/actions/get-campaigns/get-campaigns.mjs (3)
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12731
File: components/hackerone/actions/get-members/get-members.mjs:3-28
Timestamp: 2024-07-04T18:11:59.822Z
Learning: When exporting a summary message in the `run` method of an action, ensure the message is correctly formatted. For example, in the `hackerone-get-members` action, the correct format is `Successfully retrieved ${response.data.length} members`.
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12731
File: components/hackerone/actions/get-members/get-members.mjs:3-28
Timestamp: 2024-10-08T15:33:38.240Z
Learning: When exporting a summary message in the `run` method of an action, ensure the message is correctly formatted. For example, in the `hackerone-get-members` action, the correct format is `Successfully retrieved ${response.data.length} members`.
Learnt from: jcortes
PR: PipedreamHQ/pipedream#14467
File: components/gainsight_px/actions/create-account/create-account.mjs:4-6
Timestamp: 2024-10-30T15:24:39.294Z
Learning: In `components/gainsight_px/actions/create-account/create-account.mjs`, the action name should be "Create Account" instead of "Create Memory".
components/clevertap/actions/get-campaign-report/get-campaign-report.mjs (3)
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12731
File: components/hackerone/actions/get-members/get-members.mjs:3-28
Timestamp: 2024-07-04T18:11:59.822Z
Learning: When exporting a summary message in the `run` method of an action, ensure the message is correctly formatted. For example, in the `hackerone-get-members` action, the correct format is `Successfully retrieved ${response.data.length} members`.
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12731
File: components/hackerone/actions/get-members/get-members.mjs:3-28
Timestamp: 2024-10-08T15:33:38.240Z
Learning: When exporting a summary message in the `run` method of an action, ensure the message is correctly formatted. For example, in the `hackerone-get-members` action, the correct format is `Successfully retrieved ${response.data.length} members`.
Learnt from: jcortes
PR: PipedreamHQ/pipedream#14467
File: components/gainsight_px/actions/create-account/create-account.mjs:4-6
Timestamp: 2024-10-30T15:24:39.294Z
Learning: In `components/gainsight_px/actions/create-account/create-account.mjs`, the action name should be "Create Account" instead of "Create Memory".
components/clevertap/actions/create-campaign/create-campaign.mjs (3)
Learnt from: jcortes
PR: PipedreamHQ/pipedream#14467
File: components/gainsight_px/actions/create-account/create-account.mjs:4-6
Timestamp: 2024-10-30T15:24:39.294Z
Learning: In `components/gainsight_px/actions/create-account/create-account.mjs`, the action name should be "Create Account" instead of "Create Memory".
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12731
File: components/hackerone/actions/get-members/get-members.mjs:3-28
Timestamp: 2024-07-04T18:11:59.822Z
Learning: When exporting a summary message in the `run` method of an action, ensure the message is correctly formatted. For example, in the `hackerone-get-members` action, the correct format is `Successfully retrieved ${response.data.length} members`.
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12731
File: components/hackerone/actions/get-members/get-members.mjs:3-28
Timestamp: 2024-10-08T15:33:38.240Z
Learning: When exporting a summary message in the `run` method of an action, ensure the message is correctly formatted. For example, in the `hackerone-get-members` action, the correct format is `Successfully retrieved ${response.data.length} members`.
components/clevertap/clevertap.app.mjs (1)
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#16954
File: components/salesloft/salesloft.app.mjs:14-23
Timestamp: 2025-06-04T17:52:05.780Z
Learning: In the Salesloft API integration (components/salesloft/salesloft.app.mjs), the _makeRequest method returns response.data which directly contains arrays for list endpoints like listPeople, listCadences, listUsers, and listAccounts. The propDefinitions correctly call .map() directly on these responses without needing to destructure a nested data property.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: pnpm publish
- GitHub Check: Verify TypeScript components
- GitHub Check: Lint Code Base
- GitHub Check: Publish TypeScript components
🔇 Additional comments (13)
components/clevertap/common/utils.mjs (1)
42-44
: LGTM!The export structure follows the expected pattern for utility modules.
components/clevertap/actions/upload-events/upload-events.mjs (1)
5-5
: LGTM!Version bump is appropriate for the package-wide update.
components/clevertap/package.json (2)
3-3
: LGTM!Minor version bump is appropriate for the new campaign functionality being added.
16-16
: Check @pipedream/platform v3.1.0 upgrade in the CleverTap componentI ran
rg "@pipedream/platform"
undercomponents/clevertap/
and didn’t find any direct imports of platform utilities (e.g.DEFAULT_POLLING_SOURCE_TIMER_INTERVAL
). However, since the dependency jumped from v1.x to v3.x, please:
- Review any platform APIs your component uses (e.g.
defineAction
, triggers, polling helpers, etc.) in
- components/clevertap/**/*.js
- Confirm that those APIs haven’t been renamed, moved, or removed in v3.1.0
- Update imports or code paths if you encounter breaking changes
components/clevertap/package.json:
- "@pipedream/platform": "^1.5.1" + "@pipedream/platform": "^3.1.0"components/clevertap/actions/create-or-update-user/create-or-update-user.mjs (1)
5-5
: LGTM!Version bump is appropriate for the package-wide update.
components/clevertap/actions/get-campaign-report/get-campaign-report.mjs (1)
3-18
: LGTM!The action structure follows the expected pattern with proper prop definitions and app integration.
components/clevertap/actions/create-campaign/create-campaign.mjs (3)
8-8
: Verify the version number for a new file.The version is set to
0.0.8
which seems high for a new file. Typically, new files start at0.0.1
.Please confirm if this version number is correct or if it should be
0.0.1
.
99-100
: Good use of the parseJson utility.The use of
utils.parseJson()
with fallback to empty objects is a good practice for handling JSON inputs safely.
101-113
: Well-structured conditional content object.The conditional construction of the content object is clean and avoids sending empty content fields to the API.
components/clevertap/clevertap.app.mjs (4)
6-21
: Well-implemented campaignId propDefinition.The campaignId propDefinition is well-structured with proper async options loading and error handling using optional chaining.
48-75
: Consistent implementation of campaign methods.All four new campaign methods (
getCampaigns
,createCampaign
,getCampaignReport
,stopCampaign
) follow a consistent pattern with proper endpoint paths and POST method usage.
76-82
: Good positioning of the uploadEvent method.Moving the existing
uploadEvent
method after the new campaign methods maintains good organization without affecting its functionality.
35-47
: _makeRequest signature change is backward-compatibleThe updated
_makeRequest
still returns the axios Promise, so all existing callers (which useawait
) remain compatible. A repo-wide search showed no external consumers depending on it being declaredasync
. No further changes required.
d00d425
to
34aba45
Compare
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: 3
🧹 Nitpick comments (3)
components/clevertap/actions/stop-campaign/stop-campaign.mjs (2)
11-35
: Consider making date range props optional for better UX.The
from
andto
props are only used to filter the campaign list in thecampaignId
dropdown. For stopping a campaign, users might already know the campaign ID, making date filtering an unnecessary step. Consider making these optional to streamline the user experience.from: { propDefinition: [ app, "from", ], + optional: true, }, to: { propDefinition: [ app, "to", ], + optional: true, },
50-50
: Include campaign ID in the success message for clarity.The success message should include the campaign ID to provide better feedback to the user about which campaign was stopped.
- $.export("$summary", "Successfully stopped campaign"); + $.export("$summary", `Successfully stopped campaign with ID: ${campaignId}`);components/clevertap/actions/create-campaign/create-campaign.mjs (1)
299-299
: Include campaign name in the success message for better feedback.Following the pattern from retrieved learnings about properly formatted success messages, include the campaign name to provide better context.
- $.export("$summary", "Successfully created campaign"); + $.export("$summary", `Successfully created campaign "${name}"`);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (9)
components/clevertap/actions/create-campaign/create-campaign.mjs
(1 hunks)components/clevertap/actions/create-or-update-user/create-or-update-user.mjs
(1 hunks)components/clevertap/actions/get-campaign-report/get-campaign-report.mjs
(1 hunks)components/clevertap/actions/get-campaigns/get-campaigns.mjs
(1 hunks)components/clevertap/actions/stop-campaign/stop-campaign.mjs
(1 hunks)components/clevertap/actions/upload-events/upload-events.mjs
(1 hunks)components/clevertap/clevertap.app.mjs
(3 hunks)components/clevertap/common/utils.mjs
(1 hunks)components/clevertap/package.json
(2 hunks)
✅ Files skipped from review due to trivial changes (1)
- components/clevertap/package.json
🚧 Files skipped from review as they are similar to previous changes (6)
- components/clevertap/actions/get-campaign-report/get-campaign-report.mjs
- components/clevertap/clevertap.app.mjs
- components/clevertap/actions/upload-events/upload-events.mjs
- components/clevertap/actions/get-campaigns/get-campaigns.mjs
- components/clevertap/common/utils.mjs
- components/clevertap/actions/create-or-update-user/create-or-update-user.mjs
🧰 Additional context used
🧠 Learnings (2)
components/clevertap/actions/stop-campaign/stop-campaign.mjs (1)
Learnt from: jcortes
PR: PipedreamHQ/pipedream#14467
File: components/gainsight_px/actions/create-account/create-account.mjs:4-6
Timestamp: 2024-10-30T15:24:39.294Z
Learning: In `components/gainsight_px/actions/create-account/create-account.mjs`, the action name should be "Create Account" instead of "Create Memory".
components/clevertap/actions/create-campaign/create-campaign.mjs (3)
Learnt from: jcortes
PR: PipedreamHQ/pipedream#14467
File: components/gainsight_px/actions/create-account/create-account.mjs:4-6
Timestamp: 2024-10-30T15:24:39.294Z
Learning: In `components/gainsight_px/actions/create-account/create-account.mjs`, the action name should be "Create Account" instead of "Create Memory".
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12731
File: components/hackerone/actions/get-members/get-members.mjs:3-28
Timestamp: 2024-10-08T15:33:38.240Z
Learning: When exporting a summary message in the `run` method of an action, ensure the message is correctly formatted. For example, in the `hackerone-get-members` action, the correct format is `Successfully retrieved ${response.data.length} members`.
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12731
File: components/hackerone/actions/get-members/get-members.mjs:3-28
Timestamp: 2024-07-04T18:11:59.822Z
Learning: When exporting a summary message in the `run` method of an action, ensure the message is correctly formatted. For example, in the `hackerone-get-members` action, the correct format is `Successfully retrieved ${response.data.length} members`.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: Publish TypeScript components
- GitHub Check: pnpm publish
- GitHub Check: Verify TypeScript components
- GitHub Check: Lint Code Base
components/clevertap/actions/create-campaign/create-campaign.mjs
Outdated
Show resolved
Hide resolved
34aba45
to
cd7da18
Compare
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.
Hi @jcortes, LGTM! Ready for QA!
cd7da18
to
43663ec
Compare
components/clevertap/actions/create-campaign/create-campaign.mjs
Outdated
Show resolved
Hide resolved
/approve |
8c59ff5
to
27b4a7b
Compare
/approve |
27b4a7b
to
6962ae8
Compare
WHY
Resolves #17282
Summary by CodeRabbit
New Features
Improvements
Updates