Skip to content

Conversation

michelle0927
Copy link
Collaborator

@michelle0927 michelle0927 commented Aug 26, 2025

Resolves #18058

@vunguyenhung The "subscription" related components are untested. I added the Push Subscription V2 (DHL Global Forwarding) API to the account in 1PW, but it still shows as Pending, and the endpoints return a 401 error.

Summary by CodeRabbit

  • New Features

    • Added a DHL “Get Tracking Information” action to retrieve shipment status by tracking number, with optional filters (service, country codes, postal code, language) and pagination (limit, offset).
  • Refactor

    • Streamlined DHL API requests to improve reliability and consistency of tracking responses.
  • Chores

    • Updated DHL component version to 0.1.0 and refreshed dependencies.

Copy link

vercel bot commented Aug 26, 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 Aug 28, 2025 3:00pm
pipedream-docs-redirect-do-not-edit Ignored Ignored Aug 28, 2025 3:00pm

Copy link
Contributor

coderabbitai bot commented Aug 26, 2025

Walkthrough

Introduces a DHL app HTTP wrapper using axios, adds a Get Tracking Information action that calls the DHL tracking endpoint, defines shared shipping service constants, and updates the DHL package to include @pipedream/platform and a new version.

Changes

Cohort / File(s) Summary
DHL Action: Get Tracking
components/dhl/actions/get-tracking/get-tracking.mjs
New action exporting key "dhl-get-tracking" that calls dhl.getTracking with parameters and returns the response; sets a run summary.
DHL App HTTP Wrapper
components/dhl/dhl.app.mjs
Adds axios-based _makeRequest, _baseUrl, and public getTracking (path: /track/shipments); removes authKeys().
Shared Constants
components/dhl/common/constants.mjs
Introduces and exports SHIPPING_SERVICES array; default export aggregates constants.
Package Update
components/dhl/package.json
Bumps version to 0.1.0; adds dependency on @pipedream/platform ^3.1.0.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant U as User Flow
  participant A as Action: dhl-get-tracking
  participant APP as DHL App
  participant AX as axios
  participant API as DHL Tracking API

  U->>A: Run with tracking params
  A->>APP: getTracking({ params })
  APP->>APP: _baseUrl()
  APP->>AX: _makeRequest(path: "/track/shipments", headers:{dhl-api-key})
  AX->>API: GET /track/shipments?query
  API-->>AX: 200 Response (tracking data)
  AX-->>APP: Response
  APP-->>A: Response
  A-->>U: Return data (+ $summary)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Assessment against linked issues

Objective Addressed Explanation
Create DHL app scaffold and request handling (#18058)
Implement GET tracking endpoint (/shipments) (#18058) Implemented path is /track/shipments; objective lists /shipments. Endpoint parity unclear.
Implement subscription endpoints: create, get, activate, delete, list (#18058) No subscription-related actions or methods added.

Poem

A whisk of ears, I hop and peek—
New tracks to trace, I softly squeak.
Through axios paths I swiftly dart,
DHL pings with parcel art.
Constants packed, version bumped too—
Thump-thump! The trail returns the clue.
Carrot-high-fives from me to you! 🥕🐇

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 7a1e3d6 and d86c53a.

📒 Files selected for processing (2)
  • components/dhl/common/constants.mjs (1 hunks)
  • components/dhl/dhl.app.mjs (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • components/dhl/common/constants.mjs
  • components/dhl/dhl.app.mjs
⏰ 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). (5)
  • GitHub Check: Ensure component commits modify component versions
  • GitHub Check: pnpm publish
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Lint Code Base
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch issue-18058

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbit in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbit in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbit gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbit read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbit help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbit ignore or @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbit summary or @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbit or @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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: 4

🧹 Nitpick comments (13)
components/dhl/common/constants.mjs (1)

39-44: Optional: Also export named constants for clearer imports and tree-shaking

Keeping the default export is fine; adding named exports improves DX without breaking existing imports.

Apply on top of the previous change:

 export default {
   SHIPPING_SERVICES,
   STATUS_OPTIONS,
   SUBSCRIPTION_TYPES,
   MODE_OF_TRANSPORT,
   SHIPPIMG_SERVICES,
 };
+
+export {
+  SHIPPING_SERVICES,
+  STATUS_OPTIONS,
+  SUBSCRIPTION_TYPES,
+  MODE_OF_TRANSPORT,
+};
components/dhl/actions/list-subscriptions/list-subscriptions.mjs (1)

16-16: Make the summary robust to different response shapes

If the API returns a count field or a differently named array, the current expression may show 0. Minor guard improves UX without altering behavior.

Apply:

-    $.export("$summary", `Successfully listed ${response.subscriptions?.length || 0} subscriptions`);
+    const count = Array.isArray(response?.subscriptions)
+      ? response.subscriptions.length
+      : (response?.totalCount ?? response?.count ?? 0);
+    $.export("$summary", `Successfully listed ${count} subscriptions`);
components/dhl/actions/get-subscription-details/get-subscription-details.mjs (1)

19-23: Standardize the subscription ID parameter name across the DHL integration

To avoid confusion between the external action prop (subscriptionId) and the internal app-method argument (subscriberId), I recommend aligning on subscriptionId everywhere, with a simple alias for the HTTP call. Specifically:

• In components/dhl/dhl.app.mjs, update each method signature:

-  getSubscriptionDetails({ subscriberId, ...opts }) {
-    return this._makeRequest({
-      path: `/dgff/push/subscription/timestamp/${subscriberId}`,
+  getSubscriptionDetails({ subscriptionId, ...opts }) {
+    const subscriberId = subscriptionId;
+    return this._makeRequest({
+      path: `/dgff/push/subscription/timestamp/${subscriberId}`,

(and similarly for updateSubscriptionStatus and updateSubscriptionFilters)

• In each action (e.g. components/dhl/actions/get-subscription-details/get-subscription-details.mjs), pass the prop directly:

-    const response = await this.dhl.getSubscriptionDetails({
-      $,
-      subscriberId: this.subscriptionId,
+    const response = await this.dhl.getSubscriptionDetails({
+      $,
+      subscriptionId: this.subscriptionId,

(and likewise in the other DHL actions)

Optional refactor: if you prefer not to alias inside the methods, you can keep the HTTP‐path variable named subscriberId by destructuring with a rename:

getSubscriptionDetails({ subscriptionId, ...opts }) {
  return this._makeRequest({
    path: `/dgff/push/subscription/timestamp/${subscriptionId}`,
    ...opts,
  });
}

This change ensures a single, consistent property name (subscriptionId) exposed to action users while still satisfying DHL’s API expectations.

components/dhl/actions/update-subscription-filters/update-subscription-filters.mjs (2)

54-59: Docs nit: fix “GET Started” phrasing and spacing in description

Minor copy edit for clarity and consistency across actions.

-        description: "Event codes. Please refer to [GET Started Page](https://developer.dhl.com/api-reference/dgf-push-api#get-started-section/timestamp-push-api-v2-_28in-testing_29) for the event codes. Example:`A30`",
+        description: "Event codes. Please refer to the [Get Started page](https://developer.dhl.com/api-reference/dgf-push-api#get-started-section/timestamp-push-api-v2-_28in-testing_29) for the event codes. Example: `A30`",

74-83: Only include callback-details when a URL is provided

Prevents sending null/undefined values to the API.

-    const response = await this.dhl.updateSubscriptionFilters({
-      $,
-      subscriberId: this.subscriptionId,
-      data: {
-        filters,
-        "callback-details": {
-          "callback-url": this.callbackUrl,
-        },
-      },
-    });
+    const data = { filters };
+    if (this.callbackUrl) {
+      data["callback-details"] = {
+        "callback-url": this.callbackUrl,
+      };
+    }
+    const response = await this.dhl.updateSubscriptionFilters({
+      $,
+      subscriberId: this.subscriptionId,
+      data,
+    });
components/dhl/actions/create-subscription/create-subscription.mjs (3)

18-27: Use a boolean prop for onlyNotifyAPIBookings instead of string "true"/"false"

A boolean prop improves UX and avoids accidental string mismatches. Convert to boolean on send.

-    onlyNotifyAPIBookings: {
-      type: "string",
-      label: "Only Notify API Bookings",
-      description: "Enable to receive timestamp or tracking notifications exclusively for shipments booked through the API",
-      options: [
-        "true",
-        "false",
-      ],
-      optional: true,
-    },
+    onlyNotifyAPIBookings: {
+      type: "boolean",
+      label: "Only Notify API Bookings",
+      description: "Receive notifications exclusively for shipments booked through the API",
+      optional: true,
+    },

71-76: Docs nit: fix “GET Started” phrasing and spacing in description

Keep wording consistent with the other action comment.

-        description: "Event codes. Please refer to [GET Started Page](https://developer.dhl.com/api-reference/dgf-push-api#get-started-section/timestamp-push-api-v2-_28in-testing_29) for the event codes. Example:`A30`",
+        description: "Event codes. Please refer to the [Get Started page](https://developer.dhl.com/api-reference/dgf-push-api#get-started-section/timestamp-push-api-v2-_28in-testing_29) for the event codes. Example: `A30`",

91-101: Construct payload conditionally and coerce onlyNotifyAPIBookings to boolean

Avoid sending undefined fields; ensure correct type for the API.

-    const response = await this.dhl.createSubscription({
-      $,
-      data: {
-        "status": this.status,
-        "onlyNotifyAPIBookings": this.onlyNotifyAPIBookings,
-        "subscription-type": this.subscriptionType,
-        filters,
-        "callback-details": {
-          "callback-url": this.callbackUrl,
-        },
-      },
-    });
+    const data = {
+      status: this.status,
+      filters,
+      "callback-details": {
+        "callback-url": this.callbackUrl,
+      },
+    };
+    if (this.onlyNotifyAPIBookings !== undefined) {
+      data.onlyNotifyAPIBookings = Boolean(this.onlyNotifyAPIBookings);
+    }
+    if (this.subscriptionType) {
+      data["subscription-type"] = this.subscriptionType;
+    }
+    const response = await this.dhl.createSubscription({
+      $,
+      data,
+    });
components/dhl/actions/get-tracking/get-tracking.mjs (2)

36-41: Label mismatch: “Requester Postal Code” vs recipientPostalCode prop

Align the label with the prop/description to avoid user confusion.

-      label: "Requester Postal Code",
+      label: "Recipient Postal Code",

48-59: Optional: set sensible defaults for limit/offset in the UI

Defaults are mentioned in the description; reflect them via default values.

     limit: {
       type: "integer",
       label: "Limit",
       description: "Maximum number of events to be returned in the response. Default: 5",
       optional: true,
+      default: 5,
     },
     offset: {
       type: "integer",
       label: "Offset",
       description: "Offset of the first event to be returned in the response. Default: 0",
       optional: true,
+      default: 0,
     },
components/dhl/dhl.app.mjs (3)

13-15: Improve subscriptionId options UX by returning label/value pairs

Returning objects yields friendlier dropdowns and allows future display customization without changing values.

-        const { subscriptions } = await this.listSubscriptions();
-        return subscriptions?.map(({ subscriptionID }) => subscriptionID) || [];
+        const { subscriptions } = await this.listSubscriptions();
+        return subscriptions?.map(({ subscriptionID }) => ({
+          label: subscriptionID,
+          value: subscriptionID,
+        })) || [];

35-43: More robust URL join and explicit JSON headers

Prevents double slashes or missing slashes if api_url is configured inconsistently; explicit headers are harmless and sometimes required by APIs.

-    _makeRequest({
-      $ = this, path, ...opts
-    }) {
-      return axios($, {
-        url: `${this._baseUrl()}${path}`,
-        headers: {
-          "dhl-api-key": `${this.$auth.api_key}`,
-        },
-        ...opts,
-      });
-    },
+    _makeRequest({
+      $ = this, path, ...opts
+    }) {
+      const url = new URL(path, this._baseUrl()).toString();
+      return axios($, {
+        url,
+        headers: {
+          "dhl-api-key": `${this.$auth.api_key}`,
+          "accept": "application/json",
+          "content-type": "application/json",
+        },
+        ...opts,
+      });
+    },

39-41: Use the canonical DHL header casing: “DHL-API-Key”

  • File: components/dhl/dhl.app.mjs (lines 39–41)
    Update the header to match DHL’s examples:
- headers: {
-   "dhl-api-key": `${this.$auth.api_key}`,
- },
+ headers: {
+   "DHL-API-Key": `${this.$auth.api_key}`,
+ },

HTTP headers are case-insensitive, but DHL’s official Shipment Tracking API reference and their integration guides use “DHL-API-Key” for the API key header, which can aid debugging against their examples. (developer.dhl.com, parabola.io)

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 5403da4 and 9789187.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (9)
  • components/dhl/actions/create-subscription/create-subscription.mjs (1 hunks)
  • components/dhl/actions/get-subscription-details/get-subscription-details.mjs (1 hunks)
  • components/dhl/actions/get-tracking/get-tracking.mjs (1 hunks)
  • components/dhl/actions/list-subscriptions/list-subscriptions.mjs (1 hunks)
  • components/dhl/actions/update-subscription-filters/update-subscription-filters.mjs (1 hunks)
  • components/dhl/actions/update-subscription-status/update-subscription-status.mjs (1 hunks)
  • components/dhl/common/constants.mjs (1 hunks)
  • components/dhl/dhl.app.mjs (1 hunks)
  • components/dhl/package.json (2 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2024-12-12T19:23:09.039Z
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.

Applied to files:

  • components/dhl/package.json
🧬 Code graph analysis (6)
components/dhl/actions/list-subscriptions/list-subscriptions.mjs (5)
components/dhl/actions/create-subscription/create-subscription.mjs (1)
  • response (91-102)
components/dhl/actions/get-subscription-details/get-subscription-details.mjs (1)
  • response (19-22)
components/dhl/actions/get-tracking/get-tracking.mjs (1)
  • response (62-74)
components/dhl/actions/update-subscription-filters/update-subscription-filters.mjs (1)
  • response (74-83)
components/dhl/actions/update-subscription-status/update-subscription-status.mjs (1)
  • response (25-31)
components/dhl/actions/get-tracking/get-tracking.mjs (5)
components/dhl/actions/create-subscription/create-subscription.mjs (1)
  • response (91-102)
components/dhl/actions/get-subscription-details/get-subscription-details.mjs (1)
  • response (19-22)
components/dhl/actions/list-subscriptions/list-subscriptions.mjs (1)
  • response (13-15)
components/dhl/actions/update-subscription-filters/update-subscription-filters.mjs (1)
  • response (74-83)
components/dhl/actions/update-subscription-status/update-subscription-status.mjs (1)
  • response (25-31)
components/dhl/actions/update-subscription-filters/update-subscription-filters.mjs (2)
components/dhl/actions/create-subscription/create-subscription.mjs (4)
  • i (54-54)
  • i (82-82)
  • filters (81-81)
  • response (91-102)
components/dhl/actions/update-subscription-status/update-subscription-status.mjs (1)
  • response (25-31)
components/dhl/actions/update-subscription-status/update-subscription-status.mjs (3)
components/dhl/actions/create-subscription/create-subscription.mjs (1)
  • response (91-102)
components/dhl/actions/get-subscription-details/get-subscription-details.mjs (1)
  • response (19-22)
components/dhl/actions/update-subscription-filters/update-subscription-filters.mjs (1)
  • response (74-83)
components/dhl/actions/get-subscription-details/get-subscription-details.mjs (3)
components/dhl/actions/list-subscriptions/list-subscriptions.mjs (1)
  • response (13-15)
components/dhl/actions/update-subscription-filters/update-subscription-filters.mjs (1)
  • response (74-83)
components/dhl/actions/update-subscription-status/update-subscription-status.mjs (1)
  • response (25-31)
components/dhl/actions/create-subscription/create-subscription.mjs (2)
components/dhl/actions/update-subscription-filters/update-subscription-filters.mjs (4)
  • i (37-37)
  • i (65-65)
  • filters (64-64)
  • response (74-83)
components/dhl/actions/update-subscription-status/update-subscription-status.mjs (1)
  • response (25-31)
⏰ 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: Lint Code Base
  • GitHub Check: Verify TypeScript components
  • GitHub Check: pnpm publish
🔇 Additional comments (6)
components/dhl/package.json (1)

3-17: Version bump and platform dependency look appropriate

Minor version bump aligns with adding new actions. The addition of @pipedream/platform is expected for axios/requests and Pipedream helpers. Also confirms the retrieved learning: no built-in Node modules added to dependencies.

components/dhl/actions/list-subscriptions/list-subscriptions.mjs (1)

6-6: Confirm the docs link matches the “list subscriptions” endpoint

The anchor references a specific operation; verify it points to the collection/list endpoint (GET /subscriptions) and not the single-subscription GET. If it doesn’t, please adjust the link to the correct section.

components/dhl/actions/update-subscription-status/update-subscription-status.mjs (1)

24-33: LGTM: Status update call and summary

Good use of propDefinitions and a concise PATCH payload. Assuming dhl.app.mjs handles error mapping, this action is solid.

components/dhl/actions/create-subscription/create-subscription.mjs (1)

104-106: LGTM on summary usage

Using response.subscriptionID in the success message is consistent with the API shape indicated elsewhere.

components/dhl/actions/get-tracking/get-tracking.mjs (1)

61-77: LGTM on request assembly

Parameter names and mapping to this.dhl.getTracking({ params }) look consistent.

components/dhl/dhl.app.mjs (1)

45-89: LGTM on method surface and paths

Endpoints and verbs look consistent with the actions and linked API docs.

lcaresia
lcaresia previously approved these changes Aug 26, 2025
@michelle0927
Copy link
Collaborator Author

/approve

@michelle0927
Copy link
Collaborator Author

/approve

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.

DHL
2 participants