-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Gupshup - new components #19344
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
Gupshup - new components #19344
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
WalkthroughAdds two Gupshup actions (send-template-message, update-subscription), augments the Gupshup app with request helpers and API methods plus a templateId propDefinition, and updates package version and dependencies. Changes
Sequence Diagram(s)sequenceDiagram
participant Action as Action (send-template / update-subscription)
participant App as Gupshup App (methods)
participant API as Gupshup HTTP API
Action->>App: call sendTemplateMessage/create/updateSubscription(payload)
App->>App: _makeRequest(path, headers, body) → build request
App->>API: HTTP POST/PUT (with apikey header)
API-->>App: HTTP response (status, body)
App-->>Action: return response
Action->>Action: if response.status == "success" export summary
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Pre-merge checks and finishing touches❌ Failed checks (3 warnings, 1 inconclusive)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. 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.
Actionable comments posted: 2
♻️ Duplicate comments (1)
components/gupshup/actions/send-template-message/send-template-message.mjs (1)
14-54: Action structure is solid; behavior depends on fixing the helperThe props, payload you pass into
this.gupshup.sendTemplateMessage, and the success summary string are all well‑structured and align with Pipedream patterns (including the summary style from prior learnings). Based on the current code, the only blocker to this action working in production is the incorrect endpoint/payload ingupshup.app.mjs::sendTemplateMessage, which has already been flagged separately—once that helper is corrected, this action should behave as intended.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (4)
components/gupshup/actions/send-template-message/send-template-message.mjs(1 hunks)components/gupshup/actions/update-subscription/update-subscription.mjs(1 hunks)components/gupshup/gupshup.app.mjs(1 hunks)components/gupshup/package.json(2 hunks)
🧰 Additional context used
🧠 Learnings (4)
📚 Learning: 2024-12-12T19:23:09.039Z
Learnt from: jcortes
Repo: PipedreamHQ/pipedream PR: 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.
Applied to files:
components/gupshup/package.json
📚 Learning: 2025-09-15T22:01:11.472Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 18362
File: components/leonardo_ai/actions/generate-image/generate-image.mjs:103-105
Timestamp: 2025-09-15T22:01:11.472Z
Learning: In Pipedream components, pipedream/platform's axios implementation automatically excludes undefined values from HTTP requests, so there's no need to manually check for truthiness before including properties in request payloads.
Applied to files:
components/gupshup/gupshup.app.mjs
📚 Learning: 2024-07-04T18:11:59.822Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 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`.
Applied to files:
components/gupshup/actions/send-template-message/send-template-message.mjs
📚 Learning: 2025-10-20T01:01:02.970Z
Learnt from: js07
Repo: PipedreamHQ/pipedream PR: 18744
File: components/slack_v2/actions/send-large-message/send-large-message.mjs:49-64
Timestamp: 2025-10-20T01:01:02.970Z
Learning: In components/slack_v2/actions/send-large-message/send-large-message.mjs, the metadata_event_payload prop is typed as string, so the code only needs to handle string-to-JSON parsing and does not need to handle object inputs.
Applied to files:
components/gupshup/actions/send-template-message/send-template-message.mjs
🧬 Code graph analysis (2)
components/gupshup/actions/update-subscription/update-subscription.mjs (1)
components/gupshup/actions/send-template-message/send-template-message.mjs (1)
response(39-49)
components/gupshup/actions/send-template-message/send-template-message.mjs (1)
components/gupshup/actions/update-subscription/update-subscription.mjs (1)
response(43-52)
⏰ 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: Lint Code Base
- GitHub Check: Publish TypeScript components
- GitHub Check: Verify TypeScript components
🔇 Additional comments (2)
components/gupshup/package.json (1)
3-17: Version bump and platform dependency are consistent with newer componentsThe 0.1.0 bump and
@pipedream/platform^3.1.1 align with the new axios-based helpers ingupshup.app.mjs. This version matches what the majority of recently updated components in the repository are using, so the dependency is properly configured.components/gupshup/actions/update-subscription/update-subscription.mjs (1)
14-57: Action implementation correctly matches Gupshup APIThe props and
run()method implementation are correct. The field names (modes,url,version,active) and their types (string, string, integer, boolean) all match the expected parameters for the PUT/wa/app/{appId}/subscription/{subscriptionId}endpoint per Gupshup's API documentation. No changes needed.
jcortes
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.
Hi @michelle0927 lgtm! Ready for QA!
|
Hello everyone, I have tested this PR and there're some test cases failed or needed improvement. Please check test reports below for more information:
|
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
♻️ Duplicate comments (3)
components/gupshup/gupshup.app.mjs (3)
6-20: Past review comment partially addressed - appId issue remains.The response structure handling has been improved with
{ templates }destructuring and fallback (line 17), but the critical issue from the past review remains:listTemplates(line 42) uses_appName()which returns a human-readable name, not the required UUIDappId.The Gupshup API path
/wa/app/${this._appName()}/templatewill fail because the API expects the system-generated UUID identifier, not the app name. You need to either:
- Store the
appId(UUID) in$authand create an_appId()helper, or- Verify that
$auth.appnameactually contains the UUID (unlikely based on the field name)Verify the auth schema:
#!/bin/bash # Check what fields are available in the Gupshup auth configuration cat components/gupshup/.auth/gupshup.app.json 2>/dev/null || \ cat components/gupshup/gupshup.app.json 2>/dev/null || \ rg -A 10 "auth.*gupshup|gupshup.*auth" components/gupshup/ --type json
46-55: Form data is not properly encoded.While the endpoint path (line 49) and
Content-Typeheader (lines 50-52) are now correct per the past review, the method still doesn't encode the data as form fields. The action passes a plain object viaopts.data, but axios doesn't automatically serialize objects asapplication/x-www-form-urlencodedjust because the header is set.You need to explicitly encode the data before passing it to axios. Update the method to:
- sendTemplateMessage(opts = {}) { + sendTemplateMessage({ + data, + ...opts + } = {}) { + const { + source, + destination, + template, + } = data || {}; + return this._makeRequest({ method: "POST", path: "/wa/api/v1/template/msg", headers: { "Content-Type": "application/x-www-form-urlencoded", }, + data: new URLSearchParams({ + source, + destination, + template: JSON.stringify(template), + }).toString(), ...opts, }); },
56-67: Two critical issues: incorrect app identifier and missing form encoding.
Incorrect app identifier (line 61): Uses
_appName()which returns a human-readable name instead of the required UUIDappId. This will cause 404 or 400 errors. See the comment on lines 6-20 for the same issue.Missing form encoding (lines 62-66): Like
sendTemplateMessage, this method sets theContent-Typeheader but doesn't encodeopts.dataas form fields. Update to:updateSubscription({ - subscriptionId, ...opts + subscriptionId, + data, + ...opts }) { + const formData = new URLSearchParams(); + if (data) { + Object.entries(data).forEach(([key, value]) => { + if (value !== undefined && value !== null) { + formData.append(key, String(value)); + } + }); + } + return this._makeRequest({ method: "PUT", path: `/wa/app/${this._appName()}/subscription/${subscriptionId}`, headers: { "Content-Type": "application/x-www-form-urlencoded", }, + data: formData.toString(), ...opts, }); },
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (3)
components/gupshup/actions/send-template-message/send-template-message.mjs(1 hunks)components/gupshup/actions/update-subscription/update-subscription.mjs(1 hunks)components/gupshup/gupshup.app.mjs(1 hunks)
🧰 Additional context used
🧠 Learnings (4)
📚 Learning: 2025-06-04T17:52:05.780Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 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.
Applied to files:
components/gupshup/gupshup.app.mjs
📚 Learning: 2025-10-20T01:01:02.970Z
Learnt from: js07
Repo: PipedreamHQ/pipedream PR: 18744
File: components/slack_v2/actions/send-large-message/send-large-message.mjs:49-64
Timestamp: 2025-10-20T01:01:02.970Z
Learning: In components/slack_v2/actions/send-large-message/send-large-message.mjs, the metadata_event_payload prop is typed as string, so the code only needs to handle string-to-JSON parsing and does not need to handle object inputs.
Applied to files:
components/gupshup/gupshup.app.mjscomponents/gupshup/actions/send-template-message/send-template-message.mjs
📚 Learning: 2025-09-15T22:01:11.472Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 18362
File: components/leonardo_ai/actions/generate-image/generate-image.mjs:103-105
Timestamp: 2025-09-15T22:01:11.472Z
Learning: In Pipedream components, pipedream/platform's axios implementation automatically excludes undefined values from HTTP requests, so there's no need to manually check for truthiness before including properties in request payloads.
Applied to files:
components/gupshup/gupshup.app.mjs
📚 Learning: 2024-07-04T18:11:59.822Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 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`.
Applied to files:
components/gupshup/actions/send-template-message/send-template-message.mjs
🧬 Code graph analysis (2)
components/gupshup/actions/update-subscription/update-subscription.mjs (1)
components/gupshup/actions/send-template-message/send-template-message.mjs (1)
response(44-54)
components/gupshup/actions/send-template-message/send-template-message.mjs (1)
components/gupshup/actions/update-subscription/update-subscription.mjs (1)
response(48-57)
⏰ 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: Lint Code Base
- GitHub Check: Verify TypeScript components
- GitHub Check: Publish TypeScript components
🔇 Additional comments (4)
components/gupshup/gupshup.app.mjs (1)
22-39: LGTM - Request helper is well-structured.The
_makeRequesthelper properly:
- Constructs the full URL from base URL and path
- Merges custom headers with the required
apikeyheader- Defaults
$tothisfor proper context handling- Uses axios from @pipedream/platform
components/gupshup/actions/send-template-message/send-template-message.mjs (2)
3-13: LGTM - Metadata and annotations are correctly configured.The action metadata properly identifies this as a message-sending action with appropriate hints:
destructiveHint: false- correct, sending a message is not destructiveopenWorldHint: true- correct, makes external API callreadOnlyHint: false- correct, sending a message modifies state
43-60: Run method structure is correct but depends on fixing form encoding in gupshup.app.mjs.The data structure (lines 46-53) correctly matches the Gupshup API requirements:
source: sender phone numberdestination: recipient phone numbertemplate.id: template identifiertemplate.params: parameter valuesHowever, this will fail at runtime because
sendTemplateMessageingupshup.app.mjs(lines 46-55) doesn't properly encode the data asapplication/x-www-form-urlencoded. Once that critical issue is fixed (see review comment on gupshup.app.mjs), this action should work correctly.The success handling (lines 55-57) and summary message are well-formatted.
components/gupshup/actions/update-subscription/update-subscription.mjs (1)
47-62: Verify data form-encoding in the gupshup API integration.The
updateSubscriptionmethod may require form-encoded data for theapplication/x-www-form-urlencodedcontent type. Confirm whethergupshup.app.mjshandles encoding thedataobject before sending the request, or if the data needs to be pre-encoded (e.g., asURLSearchParams) before being passed to this method.
components/gupshup/actions/send-template-message/send-template-message.mjs
Show resolved
Hide resolved
|
Hi everyone, all test cases are passed! Ready for release! Test reports
|
|
/approve |
Resolves #13232
Summary by CodeRabbit
New Features
Refactor
✏️ Tip: You can customize this high-level summary in your review settings.