Skip to content

Conversation

@michelle0927
Copy link
Collaborator

@michelle0927 michelle0927 commented Dec 1, 2025

Resolves #13232

Summary by CodeRabbit

  • New Features

    • Send Gupshup template messages with parameter support.
    • Update Gupshup subscription configurations.
    • Template selector: fetch and choose available template IDs when composing messages.
  • Refactor

    • Improved Gupshup integration internals for more reliable message sending and subscription updates.

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel
Copy link

vercel bot commented Dec 1, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
pipedream-docs Ignored Ignored Dec 2, 2025 3:56pm
pipedream-docs-redirect-do-not-edit Ignored Ignored Dec 2, 2025 3:56pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 1, 2025

Walkthrough

Adds 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

Cohort / File(s) Summary
New Action: Send Template Message
components/gupshup/actions/send-template-message/send-template-message.mjs
Adds an action exporting metadata, UI props (gupshup, info, source, destination, templateId, params) and a run that calls gupshup.sendTemplateMessage({ source, destination, template: { id, params } }), exports a success summary when response.status === "success", and returns the API response.
New Action: Update Subscription
components/gupshup/actions/update-subscription/update-subscription.mjs
Adds an action exporting metadata, UI props (gupshup, info, subscriptionId, modes, url, version, active) and a run that calls gupshup.updateSubscription({ subscriptionId, ... }), exports a success summary on success, and returns the API response.
Core App: API helpers & propDefinitions
components/gupshup/gupshup.app.mjs
Adds propDefinitions.templateId with async options (uses listTemplates). Replaces authKeys() with helpers _baseUrl(), _appName(), _makeRequest({ $, path, headers, ... }). Adds listTemplates(), sendTemplateMessage(), and updateSubscription() which use _makeRequest() to call Gupshup endpoints.
Package metadata
components/gupshup/package.json
Bumps version 0.0.3 → 0.1.0 and adds dependencies containing @pipedream/platform: ^3.1.1.

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
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Inspect components/gupshup/gupshup.app.mjs: _makeRequest() headers/URL construction, auth key sourcing (this.$auth), content-type handling, and error propagation.
  • Verify propDefinitions.templateId options implementation and pagination/format handling in listTemplates().
  • Validate payload shapes and success-condition checks in both action modules (send-template-message, update-subscription).
  • Confirm package.json dependency/version change aligns with repository packaging and CI.

Pre-merge checks and finishing touches

❌ Failed checks (3 warnings, 1 inconclusive)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description only contains 'Resolves #13232' and lacks the required 'WHY' section from the template explaining the rationale for these changes. Complete the PR description by adding a 'WHY' section explaining the purpose and benefits of adding these Gupshup components.
Linked Issues check ⚠️ Warning The PR implements send-template-message but is missing the user-opt-in-out action required by issue #13232. Additionally, the send-template-message implementation uses different prop names (source, destination, templateId) than specified (message_template, recipient_id). Implement the missing user-opt-in-out action and align prop names with issue #13232 requirements (message_template instead of templateId; recipient_id instead of destination).
Out of Scope Changes check ⚠️ Warning The PR adds update-subscription action which is not mentioned in issue #13232. Additionally, version bump and dependency additions appear unrelated to the core objective of implementing send-template-message and user-opt-in-out. Remove the update-subscription action or clarify its relationship to #13232. Justify version bump and new dependency additions as supporting changes.
Title check ❓ Inconclusive The title 'Gupshup - new components' is vague and generic, lacking specificity about what components are being added or their purpose. Revise the title to be more specific, e.g., 'Add Gupshup send-template-message and user-opt-in-out actions' to clearly indicate the primary changes.
✅ Passed checks (1 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch issue-13232

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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 helper

The 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 in gupshup.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

📥 Commits

Reviewing files that changed from the base of the PR and between d59f000 and afb291f.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is 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 components

The 0.1.0 bump and @pipedream/platform ^3.1.1 align with the new axios-based helpers in gupshup.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 API

The 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
jcortes previously approved these changes Dec 1, 2025
Copy link
Collaborator

@jcortes jcortes left a 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!

@vunguyenhung
Copy link
Collaborator

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:

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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 UUID appId.

The Gupshup API path /wa/app/${this._appName()}/template will fail because the API expects the system-generated UUID identifier, not the app name. You need to either:

  1. Store the appId (UUID) in $auth and create an _appId() helper, or
  2. Verify that $auth.appname actually 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-Type header (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 via opts.data, but axios doesn't automatically serialize objects as application/x-www-form-urlencoded just 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.

  1. Incorrect app identifier (line 61): Uses _appName() which returns a human-readable name instead of the required UUID appId. This will cause 404 or 400 errors. See the comment on lines 6-20 for the same issue.

  2. Missing form encoding (lines 62-66): Like sendTemplateMessage, this method sets the Content-Type header but doesn't encode opts.data as 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

📥 Commits

Reviewing files that changed from the base of the PR and between c36fec8 and 9fcae5f.

📒 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.mjs
  • components/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 _makeRequest helper properly:

  • Constructs the full URL from base URL and path
  • Merges custom headers with the required apikey header
  • Defaults $ to this for 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 destructive
  • openWorldHint: true - correct, makes external API call
  • readOnlyHint: 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 number
  • destination: recipient phone number
  • template.id: template identifier
  • template.params: parameter values

However, this will fail at runtime because sendTemplateMessage in gupshup.app.mjs (lines 46-55) doesn't properly encode the data as application/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 updateSubscription method may require form-encoded data for the application/x-www-form-urlencoded content type. Confirm whether gupshup.app.mjs handles encoding the data object before sending the request, or if the data needs to be pre-encoded (e.g., as URLSearchParams) before being passed to this method.

@vunguyenhung
Copy link
Collaborator

Hi everyone, all test cases are passed! Ready for release!

Test reports

@michelle0927
Copy link
Collaborator Author

/approve

@michelle0927 michelle0927 merged commit 419d1e0 into master Dec 3, 2025
10 checks passed
@michelle0927 michelle0927 deleted the issue-13232 branch December 3, 2025 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Components] gupshup

4 participants