Skip to content

Conversation

@michelle0927
Copy link
Collaborator

@michelle0927 michelle0927 commented Nov 13, 2025

Resolves #19054

Summary by CodeRabbit

  • New Features

    • Added customizable column selection via new "select" parameter for Ahrefs actions, allowing users to specify which data fields to return.
    • Ahrefs actions now provide success summaries upon completion.
  • Improvements

    • Centralized API request handling for better reliability and consistency.
    • Enhanced metadata and descriptions with documentation links.
  • Chores

    • Updated component versions and migrated to ES module format.

@vercel
Copy link

vercel bot commented Nov 13, 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 Nov 13, 2025 10:25pm
pipedream-docs-redirect-do-not-edit Ignored Ignored Nov 13, 2025 10:25pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 13, 2025

Walkthrough

This PR migrates the Ahrefs integration from the deprecated v2 API to the v3 API. It converts all modules to ES module format, introduces centralized API request handling via helper methods in the app module, and adds a select parameter for specifying returned columns across all actions.

Changes

Cohort / File(s) Summary
App Module Configuration
components/ahrefs/ahrefs.app.js, components/ahrefs/ahrefs.app.mjs, components/ahrefs/package.json
Converted to ES module exports; introduced centralized _baseUrl(), _makeRequest(), getBacklinks(), and getReferringDomains() methods; added select propDefinition; enhanced limit/mode/target propDefinitions with labels. Package version bumped to 0.1.0, main entry updated to .mjs, and @pipedream/platform dependency added.
Get Backlinks Action
components/ahrefs/actions/get-backlinks/get-backlinks.js, components/ahrefs/actions/get-backlinks/get-backlinks.mjs
Converted to ES module format; updated run method signature to run({ $ }); replaced direct axios call with this.ahrefs.getBacklinks(); added select prop; introduced annotations object; version bumped to 0.0.10.
Get Backlinks One Per Domain Action
components/ahrefs/actions/get-backlinks-one-per-domain/get-backlinks-one-per-domain.js, components/ahrefs/actions/get-backlinks-one-per-domain/get-backlinks-one-per-domain.mjs
Converted to ES module format; replaced direct axios with this.ahrefs.getBacklinks() using aggregation: "1_per_domain"; updated run method signature to run({ $ }); added select prop and annotations; version bumped to 0.0.6.
Get Referring Domains Action
components/ahrefs/actions/get-referring-domains/get-referring-domains.js, components/ahrefs/actions/get-referring-domains/get-referring-domains.mjs
Converted to ES module format; replaced direct axios call with this.ahrefs.getReferringDomains(); updated run method signature to run({ $ }); added select prop and annotations; version bumped to 0.0.18.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    actor User
    participant Action as Action Module<br/>(e.g., get-backlinks)
    participant AppMethods as ahrefs App<br/>Helper Methods
    participant Request as _makeRequest()
    participant API as Ahrefs v3 API

    User->>Action: Trigger action with params
    Note over Action: run({ $ })
    Action->>AppMethods: this.ahrefs.getBacklinks({$, params})
    AppMethods->>Request: _makeRequest({$, path, ...opts})
    Note over Request: Inject Bearer token<br/>from oauth_access_token
    Request->>API: POST https://api.ahrefs.com/v3/site-explorer/all-backlinks
    API-->>Request: Response data
    Request-->>AppMethods: Return response
    AppMethods-->>Action: Return response
    Action->>Action: $.export("$summary", "...")
    Action-->>User: Return API response
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20–25 minutes

  • Files affected: 8 files across app module and 3 action modules, each with both .js and .mjs variants
  • Change patterns: Mixed complexity—some files follow consistent module conversion patterns, while ahrefs.app.js/mjs introduces new centralized request handling logic
  • API migration: Transition from v2 to v3 endpoints requires validation of endpoint paths and parameter mappings
  • Interdependencies: Changes in app module methods directly impact all action modules' behavior
  • Additional attention areas:
    • Verify Bearer token injection in _makeRequest() correctly uses this.$auth.oauth_access_token
    • Confirm v3 API endpoint paths (/site-explorer/all-backlinks, /site-explorer/refdomains) are correct
    • Validate select parameter joining with comma in action methods (e.g., this.select.join(","))
    • Review aggregation parameter handling in get-backlinks-one-per-domain action
    • Ensure package.json main entry point change to .mjs is compatible with downstream consumers

Suggested reviewers

  • lcaresia

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description check ❓ Inconclusive The pull request description only contains 'Resolves #19054' without elaborating on the changes, objectives, or implementation details. Expand the description to include the WHY section per the repository template, explaining the motivation for the API migration and summarizing key changes.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Ahrefs - update to API v3' accurately and concisely summarizes the main objective of the changeset: migrating the Ahrefs integration to the v3 API.
Linked Issues check ✅ Passed The pull request successfully addresses the migration requirement from #19054 by converting the Ahrefs integration from deprecated v2 API to v3 API with updated endpoints, authentication, and module structure.
Out of Scope Changes check ✅ Passed All changes are directly related to the API v3 migration objective, including module format updates, endpoint changes, and supporting infrastructure modifications.
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-19054

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e811482 and 8827ba7.

📒 Files selected for processing (3)
  • components/ahrefs/actions/get-backlinks-one-per-domain/get-backlinks-one-per-domain.mjs (1 hunks)
  • components/ahrefs/actions/get-backlinks/get-backlinks.mjs (1 hunks)
  • components/ahrefs/actions/get-referring-domains/get-referring-domains.mjs (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 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/ahrefs/actions/get-referring-domains/get-referring-domains.mjs
  • components/ahrefs/actions/get-backlinks-one-per-domain/get-backlinks-one-per-domain.mjs
  • components/ahrefs/actions/get-backlinks/get-backlinks.mjs
🧬 Code graph analysis (3)
components/ahrefs/actions/get-referring-domains/get-referring-domains.mjs (2)
components/ahrefs/actions/get-backlinks-one-per-domain/get-backlinks-one-per-domain.mjs (1)
  • response (42-51)
components/ahrefs/actions/get-backlinks/get-backlinks.mjs (1)
  • response (42-50)
components/ahrefs/actions/get-backlinks-one-per-domain/get-backlinks-one-per-domain.mjs (2)
components/ahrefs/actions/get-backlinks/get-backlinks.mjs (1)
  • response (42-50)
components/ahrefs/actions/get-referring-domains/get-referring-domains.mjs (1)
  • response (43-51)
components/ahrefs/actions/get-backlinks/get-backlinks.mjs (2)
components/ahrefs/actions/get-backlinks-one-per-domain/get-backlinks-one-per-domain.mjs (1)
  • response (42-51)
components/ahrefs/actions/get-referring-domains/get-referring-domains.mjs (1)
  • response (43-51)
⏰ 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: Publish TypeScript components
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Lint Code Base
🔇 Additional comments (6)
components/ahrefs/actions/get-backlinks/get-backlinks.mjs (2)

1-1: LGTM! ES module import correctly applied.

The CommonJS require() has been successfully replaced with ES module import syntax, resolving the critical issue from the previous review.


41-50: LGTM! Correct implementation of the API call.

The run method correctly:

  • Normalizes the select array to a comma-separated string (line 46) as required by Ahrefs v3 API
  • Passes all required parameters to the getBacklinks helper
  • Follows the established pattern seen across other actions in this PR
components/ahrefs/actions/get-referring-domains/get-referring-domains.mjs (2)

1-1: LGTM! ES module import correctly applied.

The CommonJS require() has been successfully replaced with ES module import syntax, resolving the critical issue from the previous review.


42-51: LGTM! Correct implementation of the API call.

The run method correctly:

  • Normalizes the select array to a comma-separated string (line 47) as required by Ahrefs v3 API
  • Passes all required parameters to the getReferringDomains helper
  • Follows the established pattern across other actions
components/ahrefs/actions/get-backlinks-one-per-domain/get-backlinks-one-per-domain.mjs (2)

1-1: LGTM! ES module import correctly applied.

The CommonJS require() has been successfully replaced with ES module import syntax, resolving the critical issue from the previous review.


41-44: LGTM! Correct implementation of API call structure.

The run method correctly:

  • Normalizes the select array to a comma-separated string (line 47) as required by Ahrefs v3 API
  • Passes all required parameters (target, mode, limit) to the getBacklinks helper
  • Follows the established pattern across other actions

Note: See separate comment regarding the aggregation parameter on line 45.

Also applies to: 46-51


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

♻️ Duplicate comments (2)
components/ahrefs/actions/get-backlinks-one-per-domain/get-backlinks-one-per-domain.js (1)

22-27: Reuse the select normalization fix from get-backlinks

This action forwards select: this.select into params in the same way as get-backlinks. Given Ahrefs v3 expects a comma‑separated select string, please apply the same this.select?.join(",") normalization here once you adjust the other action. See the earlier comment on get-backlinks for details.

Also applies to: 41-50

components/ahrefs/actions/get-referring-domains/get-referring-domains.js (1)

22-27: Align select with v3 expectations (reuse join fix here)

For /site-explorer/refdomains as well, public examples show select as a comma‑separated string (e.g. select=domain,domain_rating). (blog.coupler.io)

Once you normalize select to this.select?.join(",") in the backlinks actions, please apply the same change here so refdomains requests follow the same pattern and match Ahrefs v3’s expected query shape.

Also applies to: 42-50

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d20d528 and 71582ef.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (5)
  • components/ahrefs/actions/get-backlinks-one-per-domain/get-backlinks-one-per-domain.js (3 hunks)
  • components/ahrefs/actions/get-backlinks/get-backlinks.js (3 hunks)
  • components/ahrefs/actions/get-referring-domains/get-referring-domains.js (3 hunks)
  • components/ahrefs/ahrefs.app.js (2 hunks)
  • components/ahrefs/package.json (1 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/ahrefs/package.json
📚 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/ahrefs/actions/get-referring-domains/get-referring-domains.js
  • components/ahrefs/actions/get-backlinks/get-backlinks.js
📚 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/ahrefs/ahrefs.app.js
📚 Learning: 2025-07-01T17:07:48.193Z
Learnt from: js07
Repo: PipedreamHQ/pipedream PR: 17375
File: components/zerobounce/actions/get-validation-results-file/get-validation-results-file.mjs:23-27
Timestamp: 2025-07-01T17:07:48.193Z
Learning: "dir" props in Pipedream components are hidden in the component form and not user-facing, so they don't require labels or descriptions for user clarity.

Applied to files:

  • components/ahrefs/ahrefs.app.js
🧬 Code graph analysis (3)
components/ahrefs/actions/get-referring-domains/get-referring-domains.js (2)
components/ahrefs/actions/get-backlinks-one-per-domain/get-backlinks-one-per-domain.js (2)
  • ahrefs (1-1)
  • response (42-51)
components/ahrefs/actions/get-backlinks/get-backlinks.js (2)
  • ahrefs (1-1)
  • response (42-50)
components/ahrefs/actions/get-backlinks-one-per-domain/get-backlinks-one-per-domain.js (2)
components/ahrefs/actions/get-backlinks/get-backlinks.js (2)
  • ahrefs (1-1)
  • response (42-50)
components/ahrefs/actions/get-referring-domains/get-referring-domains.js (2)
  • ahrefs (1-1)
  • response (43-51)
components/ahrefs/actions/get-backlinks/get-backlinks.js (2)
components/ahrefs/actions/get-backlinks-one-per-domain/get-backlinks-one-per-domain.js (2)
  • ahrefs (1-1)
  • response (42-51)
components/ahrefs/actions/get-referring-domains/get-referring-domains.js (2)
  • ahrefs (1-1)
  • response (43-51)
⏰ 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: Publish TypeScript components
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Lint Code Base
🔇 Additional comments (2)
components/ahrefs/package.json (1)

3-14: Verify main entry matches actual published app file

Bumping the version and adding @pipedream/platform look correct and align with the new axios usage. The only thing to double‑check is that ahrefs.app.mjs actually exists in the published package and exports the same app definition the actions expect; otherwise consumers importing @pipedream/ahrefs may resolve a missing or stale entrypoint.

components/ahrefs/ahrefs.app.js (1)

54-63: Confirm $auth mapping for v3 authentication

_makeRequest sends Authorization: Bearer ${this.$auth.oauth_access_token}. Ahrefs v3 docs and examples show authentication via an API key / token in the Bearer header, not the legacy v2 OAuth integrations. (help.ahrefs.com)

Please confirm that the Ahrefs app’s auth config now stores the v3 API token under oauth_access_token (or that this field name was updated appropriately in the app definition). If not, the header may be sending the wrong credential.

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 (4)
components/ahrefs/actions/get-backlinks/get-backlinks.mjs (1)

51-52: Consider including result count in summary.

As noted in previous reviews, the summary could be more informative by including the count of backlinks returned.

components/ahrefs/actions/get-referring-domains/get-referring-domains.mjs (1)

52-53: Consider including result count in summary.

As noted in previous reviews, the summary could be more informative by including the count of referring domains returned.

components/ahrefs/actions/get-backlinks-one-per-domain/get-backlinks-one-per-domain.mjs (2)

45-45: Verify aggregation: "1_per_domain" parameter support in Ahrefs v3.

As noted in previous reviews with web search verification, the aggregation: "1_per_domain" parameter is not documented in the official Ahrefs v3 API for the /site-explorer/all-backlinks endpoint. The v2 API used a dedicated backlinks_one_per_domain endpoint for this functionality. Please verify this parameter works with your specific Ahrefs v3 integration or use the officially documented approach.


52-53: Consider including result count in summary.

As noted in previous reviews, the summary could be more informative by including the count of backlinks returned.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 71582ef and e811482.

📒 Files selected for processing (4)
  • components/ahrefs/actions/get-backlinks-one-per-domain/get-backlinks-one-per-domain.mjs (1 hunks)
  • components/ahrefs/actions/get-backlinks/get-backlinks.mjs (1 hunks)
  • components/ahrefs/actions/get-referring-domains/get-referring-domains.mjs (1 hunks)
  • components/ahrefs/ahrefs.app.mjs (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 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/ahrefs/actions/get-backlinks/get-backlinks.mjs
  • components/ahrefs/actions/get-referring-domains/get-referring-domains.mjs
  • components/ahrefs/actions/get-backlinks-one-per-domain/get-backlinks-one-per-domain.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/ahrefs/ahrefs.app.mjs
🧬 Code graph analysis (3)
components/ahrefs/actions/get-backlinks/get-backlinks.mjs (2)
components/ahrefs/actions/get-backlinks-one-per-domain/get-backlinks-one-per-domain.mjs (2)
  • ahrefs (1-1)
  • response (42-51)
components/ahrefs/actions/get-referring-domains/get-referring-domains.mjs (2)
  • ahrefs (1-1)
  • response (43-51)
components/ahrefs/actions/get-referring-domains/get-referring-domains.mjs (2)
components/ahrefs/actions/get-backlinks-one-per-domain/get-backlinks-one-per-domain.mjs (2)
  • ahrefs (1-1)
  • response (42-51)
components/ahrefs/actions/get-backlinks/get-backlinks.mjs (2)
  • ahrefs (1-1)
  • response (42-50)
components/ahrefs/actions/get-backlinks-one-per-domain/get-backlinks-one-per-domain.mjs (2)
components/ahrefs/actions/get-backlinks/get-backlinks.mjs (2)
  • ahrefs (1-1)
  • response (42-50)
components/ahrefs/actions/get-referring-domains/get-referring-domains.mjs (2)
  • ahrefs (1-1)
  • response (43-51)
⏰ 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: Verify TypeScript components
  • GitHub Check: pnpm publish
  • GitHub Check: Lint Code Base
🔇 Additional comments (6)
components/ahrefs/actions/get-backlinks/get-backlinks.mjs (1)

41-50: LGTM: Select normalization is correctly implemented.

The .join(",") call properly converts the string[] prop to a comma-separated string as required by Ahrefs v3 API, addressing the concern raised in past reviews.

components/ahrefs/ahrefs.app.mjs (3)

1-13: LGTM: Correct ES module syntax and app structure.

The import statement properly uses ES module syntax, and the app metadata follows Pipedream conventions.


44-48: LGTM: Select propDefinition follows best practice.

Defining select as string[] provides better UX for multi-select in the UI, and the actions correctly normalize it to a comma-separated string before sending to the Ahrefs v3 API.


50-77: LGTM: API methods correctly implement v3 endpoints.

The base URL points to Ahrefs v3 API, authentication is properly configured with Bearer token, and the helper methods cleanly delegate to the centralized _makeRequest implementation.

components/ahrefs/actions/get-referring-domains/get-referring-domains.mjs (1)

42-51: LGTM: Select normalization is correctly implemented.

The .join(",") call properly converts the string[] prop to a comma-separated string as required by Ahrefs v3 API.

components/ahrefs/actions/get-backlinks-one-per-domain/get-backlinks-one-per-domain.mjs (1)

46-50: LGTM: Select normalization and other parameters correctly implemented.

The .join(",") call properly converts the string[] prop to a comma-separated string, and other parameters are correctly passed through.

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.

[BUG] Ahref - v2 API deprecated and we need to migrate to v3 API

2 participants