-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Ahrefs - update to API v3 #19063
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
base: master
Are you sure you want to change the base?
Ahrefs - update to API v3 #19063
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
WalkthroughThis 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
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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20–25 minutes
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: ASSERTIVE Plan: Pro 📒 Files selected for processing (3)
🧰 Additional context used🧠 Learnings (1)📚 Learning: 2024-07-04T18:11:59.822ZApplied to files:
🧬 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 (2)
components/ahrefs/actions/get-backlinks/get-backlinks.mjs (2)
⏰ 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)
🔇 Additional comments (6)
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: 6
♻️ Duplicate comments (2)
components/ahrefs/actions/get-backlinks-one-per-domain/get-backlinks-one-per-domain.js (1)
22-27: Reuse theselectnormalization fix fromget-backlinksThis action forwards
select: this.selectintoparamsin the same way asget-backlinks. Given Ahrefs v3 expects a comma‑separatedselectstring, please apply the samethis.select?.join(",")normalization here once you adjust the other action. See the earlier comment onget-backlinksfor details.Also applies to: 41-50
components/ahrefs/actions/get-referring-domains/get-referring-domains.js (1)
22-27: Alignselectwith v3 expectations (reuse join fix here)For
/site-explorer/refdomainsas well, public examples showselectas a comma‑separated string (e.g.select=domain,domain_rating). (blog.coupler.io)Once you normalize
selecttothis.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
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis 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.jscomponents/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: Verifymainentry matches actual published app fileBumping the version and adding
@pipedream/platformlook correct and align with the new axios usage. The only thing to double‑check is thatahrefs.app.mjsactually exists in the published package and exports the same app definition the actions expect; otherwise consumers importing@pipedream/ahrefsmay resolve a missing or stale entrypoint.components/ahrefs/ahrefs.app.js (1)
54-63: Confirm$authmapping for v3 authentication
_makeRequestsendsAuthorization: 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.
components/ahrefs/actions/get-backlinks-one-per-domain/get-backlinks-one-per-domain.mjs
Show resolved
Hide resolved
components/ahrefs/actions/get-backlinks-one-per-domain/get-backlinks-one-per-domain.mjs
Show resolved
Hide resolved
components/ahrefs/actions/get-referring-domains/get-referring-domains.mjs
Show resolved
Hide resolved
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 (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: Verifyaggregation: "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-backlinksendpoint. The v2 API used a dedicatedbacklinks_one_per_domainendpoint 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
📒 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.mjscomponents/ahrefs/actions/get-referring-domains/get-referring-domains.mjscomponents/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 thestring[]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
selectasstring[]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
_makeRequestimplementation.components/ahrefs/actions/get-referring-domains/get-referring-domains.mjs (1)
42-51: LGTM: Select normalization is correctly implemented.The
.join(",")call properly converts thestring[]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 thestring[]prop to a comma-separated string, and other parameters are correctly passed through.
Resolves #19054
Summary by CodeRabbit
New Features
Improvements
Chores