Skip to content
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

Initial commit of workflow SDK / OAuth docs #14053

Merged
merged 36 commits into from
Nov 4, 2024
Merged

Conversation

dylburger
Copy link
Contributor

@dylburger dylburger commented Sep 21, 2024

Summary by CodeRabbit

Release Notes

  • New Features

    • Enhanced documentation for the Connect API, including new sections on OAuth and invoking workflows.
    • Added guidance on managing connected accounts and account deletion options.
    • Introduced a migration guide for transitioning to OAuth clients from project keys.
  • Improvements

    • Improved clarity and organization of authentication methods.
    • Expanded examples for using the SDK in multiple programming languages.
    • Added a section on environments for safer testing and integration.
  • Bug Fixes

    • Minor typographical corrections for improved readability.
  • Chores

    • Updated metadata and dependencies in the documentation files.

Copy link

vercel bot commented Sep 21, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
docs-v2 ⬜️ Ignored (Inspect) Visit Preview Nov 4, 2024 9:17pm
pipedream-docs ⬜️ Ignored (Inspect) Nov 4, 2024 9:17pm
pipedream-docs-redirect-do-not-edit ⬜️ Ignored (Inspect) Nov 4, 2024 9:17pm

Copy link
Contributor

coderabbitai bot commented Sep 21, 2024

Walkthrough

The pull request includes extensive updates to the documentation for the Pipedream Connect API and related SDKs. Key changes involve the restructuring of authentication methods, the introduction of new sections detailing OAuth and workflow invocation, and the removal of outdated content. Additionally, various enhancements across multiple documentation files improve clarity and usability, while new methods and sections provide detailed guidance on managing accounts and utilizing the SDK effectively.

Changes

File Path Change Summary
docs-v2/pages/connect/api.mdx Updated for clarity on authentication methods; added sections for OAuth, invoking workflows, and account management. Removed REST API section.
docs-v2/pages/_meta.json Updated "rest-api" label from "API Reference" to "REST API."
docs-v2/pages/connect/index.mdx Rephrased introduction; added sections for OAuth app configuration and user management.
docs-v2/pages/privacy-and-security/index.mdx Added new section on API security and OAuth clients; updated audit frequency to annual.
docs-v2/pages/rest-api/auth.mdx Restructured authentication section; added details for OAuth and User API keys.
docs-v2/pages/rest-api/index.mdx Expanded overview; detailed authentication methods; updated endpoint examples.
docs-v2/pages/workflows/triggers.mdx Added section on authorizing HTTP requests; expanded troubleshooting guidance.
docs-v2/pages/connect/quickstart.mdx Removed VideoPlayer component; clarified integration steps and account connection process.
docs-v2/pages/connect/environments.mdx Added section on development and production environments for connected accounts.
docs-v2/pages/connect/tokens.mdx Updated to reference environments documentation for token creation.
docs-v2/pages/projects/index.mdx Added section on finding project IDs.
docs-v2/package.json Added dependency @pipedream/sdk with version ^0.1.9.
components/*/*.app.mjs Minor formatting changes (newline added) across multiple component files.
docs-v2/pages/connect/oauth-clients.mdx Minor textual modification for deployment context.
docs-v2/pages/connect/_meta.json Added hidden metadata entry for migrating from project keys to OAuth.
docs-v2/pages/connect/migrating-from-project-keys-to-oauth.mdx Introduced migration guide for SDK version transition focusing on OAuth.

Possibly related PRs

Suggested labels

enhancement, pd-api, javascript, User submitted

"In the garden of code, we hop with glee,
New paths to explore, oh what will there be?
OAuth and workflows, a fresh springtime bloom,
With each little update, we banish the gloom.
So gather your tokens, let’s dance and create,
In the world of APIs, we celebrate!" 🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai 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:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @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

Documentation and Community

  • 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: 0

Outside diff range and nitpick comments (1)
docs-v2/pages/connect/api.mdx (1)

48-49: Suggestion: Add a timeline for completing the OAuth documentation.

The "TO DO" placeholder is helpful to indicate that the OAuth documentation is a work in progress. Consider adding a timeline or estimated completion date to set expectations for when the documentation will be updated with the OAuth details.

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between b360576 and 97c5839.

Files selected for processing (2)
  • docs-v2/pages/connect/api.mdx (2 hunks)
  • packages/sdk/src/server/index.ts (1 hunks)
Additional comments not posted (5)
packages/sdk/src/server/index.ts (1)

646-646: LGTM!

The change to the example usage of the invokeWorkflow method looks good. Using a more generic endpoint URL in the example is a reasonable update.

docs-v2/pages/connect/api.mdx (4)

46-63: LGTM!

The addition of the OAuth and Project keys sections enhances the authentication documentation. The Project keys section provides clear instructions on how to authenticate using Basic Auth, and the cURL example is helpful to illustrate making an authenticated request.


143-168: LGTM!

The "Invoke workflows" section is a great addition to the documentation. The example code clearly demonstrates how to use the SDK to invoke workflows on behalf of users. Mentioning that invokeWorkflow uses Node's fetch API and accepts standard options is helpful for developers to customize the requests as needed.


147-165: LGTM!

The TypeScript code example for invoking a workflow using the SDK is well-written and easy to understand. It demonstrates the essential steps to create a client instance and invoke a workflow using the invokeWorkflow method. The code is properly formatted and follows TypeScript best practices.


167-168: LGTM!

The explanation mentioning that invokeWorkflow uses Node's fetch API and accepts standard options is concise and informative. It helps developers understand that they can customize the requests made by invokeWorkflow using standard options supported by Node's fetch API.

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

🧹 Outside diff range and nitpick comments (17)
docs-v2/pages/rest-api/auth.mdx (5)

3-11: Consider improving the transition to User API keys.

The introduction and OAuth recommendation are clear and informative. However, the transition to mentioning user API keys in the last paragraph seems abrupt. Consider adding a brief transitional sentence to improve the flow, such as:

"While OAuth is recommended for most use cases, there are situations where User API keys can be beneficial."

This would provide a smoother transition and context for when User API keys might be appropriate.


13-17: Consider explaining the rationale for using the Client Credentials flow.

The introduction to OAuth and the explanation of the client credentials flow are clear. To enhance understanding, consider adding a brief explanation of why this specific OAuth flow is used. For example:

"We use the Client Credentials flow because it's designed for server-to-server authentication, which aligns with how the Pipedream API is typically used."

This addition would provide context for developers who might be familiar with other OAuth flows.


27-67: Consider adding information on error handling for token acquisition.

The section on obtaining and using access tokens is comprehensive and includes helpful code examples for both SDK and curl usage. The mention of token expiration is crucial information.

To further improve this section, consider adding information on error handling, particularly for cases where token acquisition might fail. This could include:

  1. Common error scenarios (e.g., invalid credentials, network issues)
  2. How to interpret error responses
  3. Best practices for retrying or recovering from token acquisition failures

This addition would help developers build more robust integrations with the API.


69-77: Add information about the impact of revoking a client secret.

The instructions for revoking a client secret are clear, and the link to more detailed security information is helpful. To make this section more comprehensive, consider adding information about the impact of revoking a client secret on existing access tokens. For example:

"Note: Revoking a client secret will invalidate all existing access tokens generated using that secret. Applications using these tokens will need to obtain new access tokens using the new client secret."

This information would help users understand the full implications of revoking a client secret and plan accordingly.


79-91: Add security best practices for User API keys.

The explanation of user API keys and the instructions for their management are clear. To enhance the security aspect of this section, consider adding information about best practices for securing API keys and the potential risks of their misuse. For example:

  1. Store API keys securely and never expose them in client-side code.
  2. Use environment variables to manage API keys in your applications.
  3. Regularly rotate API keys as a security measure.
  4. Be cautious when sharing API keys, as they provide full access to your account.

Adding these best practices would help users understand the importance of API key security and how to properly manage them.

docs-v2/pages/connect/index.mdx (1)

58-60: Improved security information presentation. Consider minor clarification.

The changes effectively reorganize and clarify the security information, providing a more focused approach by linking directly to Connect-specific security details. This improvement helps users find relevant information more quickly.

Consider adding a brief introductory sentence to provide context for the two different security resources. For example:

-Pipedream takes the security of our products seriously. See details on the security of the Connect product [here](/privacy-and-security#pipedream-connect).
+Pipedream takes the security of our products seriously. For your reference:
+- See details specific to the security of the Connect product [here](/privacy-and-security#pipedream-connect).
+- Review our general security documentation [here](/privacy-and-security).

 Please also [review our general security docs](/privacy-and-security) and send us any questions or [suspected vulnerabilities](/privacy-and-security#reporting-a-vulnerability). You can also get a copy of our [SOC 2 Type 2 report](/privacy-and-security#soc-2), [sign HIPAA BAAs](/privacy-and-security#hipaa), and get information on other practices and controls.

This change would provide a clearer structure and help users understand the distinction between Connect-specific and general security information.

docs-v2/pages/privacy-and-security/index.mdx (4)

89-98: Excellent addition of API security information.

This new section provides crucial information about the Pipedream API's authentication methods. The clear recommendation for OAuth clients with explained benefits is particularly helpful for users.

Consider adding a brief explanation of what "scopes" are (line 95) for users who might be unfamiliar with the term. For example:

-✅ OAuth clients support scopes, limiting access to specific operations <br />
+✅ OAuth clients support scopes (permissions for specific API operations), limiting access to only what's needed <br />

99-105: Good explanation of OAuth clients and security practices.

This section provides valuable information about OAuth clients and how client secrets are securely stored.

To improve clarity for non-technical users, consider adding a brief explanation of what "client credentials OAuth clients" are. For example:

-Pipedream supports client credentials OAuth clients, which exchange a client ID and client secret for a short-lived access token. These clients are not tied to individual end users, and are meant to be used server-side. You must store these credentials securely on your server, never allowing them to be exposed in client-side code.
+Pipedream supports "client credentials" OAuth clients. This is a secure method where your application (the client) exchanges a client ID and a secret key for a short-lived access token to access Pipedream's API. These clients are not tied to individual end users and are meant to be used in server-side code. It's crucial to store these credentials securely on your server and never expose them in client-side code (like JavaScript running in a browser).

107-116: Comprehensive explanation of OAuth tokens.

This section provides detailed and accurate information about OAuth tokens, including their issuance, storage, and expiration. The inclusion of a workflow template for token validation is particularly helpful.

On line 109, consider rewording slightly for clarity:

-Since Pipedream uses client credentials grants, access tokens must not be shared with end users or stored anywhere outside of your server environment.
+Since Pipedream uses client credentials grants, access tokens must not be shared with end users or stored anywhere outside your server environment.

This removes the redundant "of" as suggested by the static analysis tool and improves readability.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~109-~109: Possible missing preposition found.
Context: ...Since Pipedream uses client credentials grants, access tokens must not be shared with ...

(AI_HYDRA_LEO_MISSING_TO)


[style] ~109-~109: This phrase is redundant. Consider using “outside”.
Context: ...hared with end users or stored anywhere outside of your server environment. Access tokens...

(OUTSIDE_OF)


135-143: Concise explanation of Connect Link and API relation.

This section effectively explains the Connect Link feature and its use cases. The reference to the REST API security section is helpful for users seeking more detailed information.

For consistency with the previous section, consider adding a brief mention of the security aspects of Connect Links. For example:

 Like tokens, Connect Links are coupled to specific users, and expire after 4 hours.

+Connect Links are designed with security in mind, being user-specific and short-lived to minimize potential misuse.
docs-v2/pages/rest-api/index.mdx (6)

7-7: Approved: Enhanced API description

The updated overview provides a more comprehensive description of the API's capabilities. This change improves clarity for users.

Consider adding "and more" at the end of the sentence to indicate that these are just examples of what the API can do, not an exhaustive list. This would future-proof the description against minor additions to the API's capabilities.


15-21: Approved: Improved authentication documentation

The updated authentication section now clearly describes the two supported methods: OAuth and User API keys. The example has been updated to use a token, which is consistent with the new authentication methods.

Consider adding a brief explanation of when to use OAuth vs User API keys to help users choose the appropriate method for their use case.


66-72: Approved: Added workspace_id parameter explanation

The new section clearly explains when the workspace_id parameter is required and how it's used with different authentication methods. This addition helps users understand how to properly use the parameter in their API requests.

Consider adding an example of how to include the workspace_id in an API request to make it even clearer for users.


152-156: Approved: Improved error code explanations

The updated error section provides clearer explanations of what different HTTP status code ranges indicate. This improvement helps users better understand and handle API responses.

To improve readability and address the style issue, consider rewording the second and third points to avoid starting three consecutive sentences with "Codes". For example:

- Codes in the `4xx` range indicate an error that failed (e.g., a required parameter was omitted). 
- Codes in the `5xx` range indicate an error with Pipedream's server.
+ The `4xx` range indicates a client-side error (e.g., a required parameter was omitted).
+ The `5xx` range signifies a server-side error with Pipedream's infrastructure.
🧰 Tools
🪛 LanguageTool

[style] ~156-~156: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ..., a required parameter was omitted). - Codes in the 5xx range indicate an error wi...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


162-200: Approved: Added Accounts section with detailed information

The new Accounts section provides comprehensive information about listing and retrieving account details. The inclusion of parameters, example requests, and example responses is very helpful for API users.

Consider adding a brief explanation of what "connected accounts" are and why they are important in the context of Pipedream. This would provide more context for users who might be new to the platform.


619-710: Approved: Added OAuth section with token management details

The new OAuth section provides comprehensive information about obtaining and revoking OAuth tokens. The inclusion of endpoints, parameters, example requests, and example responses is very helpful for developers implementing OAuth authentication.

Consider adding a brief introduction to the OAuth section explaining why and when a developer might need to use these endpoints. This would provide more context and help users understand the purpose of these operations in their authentication flow.

docs-v2/pages/connect/api.mdx (1)

Line range hint 1-1188: Overall, comprehensive and well-structured API documentation.

This documentation provides a thorough guide to the Connect API & SDK, covering key aspects such as installation, authentication, rate limits, workflow invocation, and token creation. The multi-language examples are particularly valuable for developers working with various tech stacks.

However, there are a couple of points to address:

  1. The OAuth section is currently incomplete and needs to be filled out.
  2. Consider adding a table of contents at the beginning of the document for easier navigation, especially given its length and the variety of topics covered.

These improvements would enhance the overall quality and usability of this already strong documentation.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 8cfb804 and 72921fe.

📒 Files selected for processing (6)
  • docs-v2/pages/_meta.json (1 hunks)
  • docs-v2/pages/connect/api.mdx (3 hunks)
  • docs-v2/pages/connect/index.mdx (1 hunks)
  • docs-v2/pages/privacy-and-security/index.mdx (2 hunks)
  • docs-v2/pages/rest-api/auth.mdx (1 hunks)
  • docs-v2/pages/rest-api/index.mdx (28 hunks)
✅ Files skipped from review due to trivial changes (1)
  • docs-v2/pages/_meta.json
🧰 Additional context used
🪛 LanguageTool
docs-v2/pages/privacy-and-security/index.mdx

[uncategorized] ~109-~109: Possible missing preposition found.
Context: ...Since Pipedream uses client credentials grants, access tokens must not be shared with ...

(AI_HYDRA_LEO_MISSING_TO)


[style] ~109-~109: This phrase is redundant. Consider using “outside”.
Context: ...hared with end users or stored anywhere outside of your server environment. Access tokens...

(OUTSIDE_OF)

docs-v2/pages/rest-api/index.mdx

[style] ~156-~156: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ..., a required parameter was omitted). - Codes in the 5xx range indicate an error wi...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[uncategorized] ~294-~294: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ...oauth_uid` — A unique identifier in the third party API's system, typically a user ID or em...

(EN_COMPOUND_ADJECTIVE_INTERNAL)

🔇 Additional comments (12)
docs-v2/pages/rest-api/auth.mdx (1)

19-25: LGTM: Clear and concise instructions for creating an OAuth application.

The step-by-step instructions for creating an OAuth application are well-written and easy to follow. The warning about the client secret not being accessible again is an important detail that helps prevent potential issues for users.

docs-v2/pages/privacy-and-security/index.mdx (2)

25-25: Improved clarity on audit frequency.

The change from "regular" to "annual" third-party audits provides more precise information about the frequency of these audits. This update enhances transparency and gives users a clearer understanding of Pipedream's compliance practices.


117-134: Clear introduction to Pipedream Connect and its SDK.

This section effectively introduces Pipedream Connect and provides a concise explanation of its client-side SDK. The step-by-step process for initiating authorization is particularly helpful for developers implementing this feature.

The security considerations, such as token expiration and limited permissions, are well-explained and demonstrate good security practices.

docs-v2/pages/rest-api/index.mdx (2)

28-28: Approved: Clarified header requirement

The updated text clearly emphasizes that the Authorization header is required for all endpoints. This is an important detail that helps prevent potential errors for API users.


Line range hint 1419-1720: Approved: Updated authentication examples in Workflows section

The authentication examples in the Workflows section have been consistently updated to use a token instead of an API key. This change aligns with the new authentication methods described earlier in the document, ensuring consistency throughout the API documentation.

Also applies to: 1743-1889

docs-v2/pages/connect/api.mdx (7)

Line range hint 1-13: LGTM: Clear introduction and important warning.

The introduction effectively sets up the context for the Connect API & SDK Reference. The warning about the different Base URL and authentication method is crucial for users to avoid potential integration issues.


Line range hint 15-19: LGTM: Clear presentation of the REST API Base URL.

The base URL for the Connect REST API is clearly stated, which is essential for users to construct their API requests correctly.


Line range hint 21-41: LGTM: Comprehensive installation instructions.

The installation instructions for the TypeScript SDK are clear and cover both npm and <script> tag methods. This provides flexibility for different use cases and environments.


Line range hint 51-114: LGTM: Clear instructions for SDK usage and external users concept.

The instructions for using the TypeScript SDK on both server and browser are clear and helpful. The introduction of the "external users" concept is important for understanding the API's user management approach.


Line range hint 116-124: LGTM: Clear presentation of rate limits.

The rate limits for different API endpoints are clearly stated in an easy-to-read table format. The note about contacting support for higher rate limits is helpful for users with more demanding needs.


126-151: LGTM: Clear example for invoking workflows.

The example provided for invoking workflows using the SDK is clear and demonstrates the key steps effectively. The note about invokeWorkflow using Node's fetch API is helpful for understanding the underlying mechanism.


Line range hint 153-1188: LGTM: Comprehensive token creation documentation with multi-language examples.

The "Tokens" section provides a clear explanation of the token creation process, including its purpose and usage. The multi-language examples (TypeScript, Node.js, Python, Java, C#, Go, PHP, and Ruby) are thorough and valuable for developers working with different tech stacks.

Comment on lines 43 to 49

## Authentication

### OAuth

TO DO

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

OAuth section needs to be completed.

The OAuth section is currently marked as "TO DO". This important authentication method should be documented to provide a complete reference for users.

Please complete the OAuth section with relevant details and examples.

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

🧹 Outside diff range and nitpick comments (15)
docs-v2/pages/privacy-and-security/best-practices.mdx (6)

Line range hint 7-11: Clearer guidance on secret management

The rephrasing of this section significantly improves the clarity and actionability of the advice on handling secrets. Starting with a clear directive against storing secrets in code sets the right tone. The outline of two specific methods for storing secrets (connected accounts and environment variables) provides valuable, practical guidance.

To further enhance this section, consider adding a brief explanation of why storing secrets in code is risky (e.g., potential exposure through version control, difficulty in rotating secrets).


16-16: Stronger emphasis on secure data transmission

The change from "Whenever possible, encrypt data in transit" to "Always send data over HTTPS" is a significant improvement. It provides a clear, unambiguous directive that enhances security practices.

To make this even more comprehensive, consider adding a brief explanation of why HTTPS is important (e.g., "HTTPS encrypts data in transit, protecting it from interception and tampering").


22-28: Improved clarity on HTTP trigger security

The renaming of this section to "Require authorization for HTTP triggers" and the subsequent rewording significantly improve the clarity of the security implications of HTTP triggers. The explicit statement that these triggers are public by default and require no authorization is crucial information for users.

To further enhance this section, consider adding a brief explanation of the potential risks of leaving HTTP triggers public (e.g., unauthorized access, potential for abuse) to underscore the importance of configuring authorization.


28-28: Helpful recommendation for webhook authentication

The addition of the recommendation to use the Validate Webhook Auth action for third-party services is a valuable enhancement to the documentation. It provides users with a practical, code-free solution for implementing webhook authentication.

To make this even more helpful, consider adding a brief explanation of what the Validate Webhook Auth action does and why it's beneficial (e.g., "This action simplifies the process of validating incoming webhooks, reducing the risk of processing unauthorized requests").


Line range hint 66-68: Clearer explanation of Pipedream's data retention

The refinement of this section provides more precise information about what data Pipedream retains, which is crucial for users managing sensitive information in their workflows. The explicit mention of event data, console logs, errors, step exports, and error stack traces gives users a clear picture of what information might be stored.

To further enhance this section, consider adding a brief note on how long this data is retained, or a link to Pipedream's data retention policy if one exists. This would give users a complete understanding of the lifecycle of their data within Pipedream.


Line range hint 70-71: Valuable information on data privacy and control

The addition of information about variables stored in memory and the ability to modify code to control logging is a significant enhancement to this section. It provides users with important knowledge about data privacy within Pipedream and empowers them to take control of what information is logged.

To make this even more helpful, consider adding a brief example of how a user might modify code to limit logging (e.g., "For instance, you could remove console.log statements or modify step exports to exclude sensitive data").

docs-v2/pages/workflows/triggers.mdx (1)

685-695: Helpful troubleshooting information added for email triggers.

The new section on troubleshooting expired tokens for email attachments is a valuable addition. It provides clear guidance on how to handle this common issue.

Consider adding a brief explanation of why the tokens expire (e.g., for security reasons) to help users understand the underlying reason for this behavior.

docs-v2/pages/rest-api/index.mdx (8)

15-24: Enhanced authentication documentation

The expanded authentication section greatly improves the clarity of the available options. The recommendation to use OAuth for most use cases is valuable guidance for users.

Consider adding a brief explanation of when User API keys might be preferred over OAuth to provide complete guidance.


66-77: Updated common parameters and improved clarity

The replacement of workspace_id with org_id and the added callout significantly improve the documentation's accuracy and usability. The explanation for when to use org_id is clear and helpful.

Consider adding a note about backward compatibility or migration steps for users who might be using the old workspace_id parameter in their existing integrations.


152-156: Improved error codes explanation

The reformatted list of error codes enhances readability and makes the information easier to scan.

However, there's a minor grammatical issue in the second list item. Consider revising it to:

- Codes in the `4xx` range indicate an error that failed (e.g., a required parameter was omitted). 
+ Codes in the `4xx` range indicate a client error (e.g., a required parameter was omitted).

This change maintains consistency with the other list items and improves clarity.

🧰 Tools
🪛 LanguageTool

[style] ~156-~156: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ..., a required parameter was omitted). - Codes in the 5xx range indicate an error wi...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


Line range hint 162-294: Comprehensive new Accounts section

The addition of the Accounts section is a significant improvement to the API documentation. It provides clear and detailed information on how to list and retrieve connected accounts, including parameters, example requests, and responses.

To further enhance this section, consider adding a brief explanation of what "connected accounts" are and their significance in the context of Pipedream, especially for new users who might not be familiar with the concept.

🧰 Tools
🪛 LanguageTool

[style] ~156-~156: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ..., a required parameter was omitted). - Codes in the 5xx range indicate an error wi...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


618-710: Valuable new OAuth section

The addition of the OAuth section significantly enhances the API documentation. It provides clear instructions on how to obtain and revoke access tokens, including detailed parameters, example requests, and responses.

To make this section even more helpful, consider adding a brief overview of the OAuth flow and how these endpoints fit into the larger authentication process. This context would be particularly useful for developers who are new to OAuth or Pipedream's implementation of it.


Line range hint 1120-1189: Updated Users section with important clarifications

The addition of the callout specifying that these endpoints only work with user API keys is crucial information for developers. The updated example response now includes workspace (org) information, which provides a more comprehensive view of the data structure.

To further improve this section, consider adding a brief explanation of the difference between user API keys and workspace-level OAuth clients, and why this limitation exists. This context would help developers understand the security model better.


Line range hint 1856-2024: Comprehensive new Workspaces section

The addition of the Workspaces section significantly enhances the API documentation. It provides clear and detailed information on how to retrieve workspace details, connected accounts, subscriptions, and sources, including parameters, example requests, and responses.

To make this section even more useful, consider adding a brief introduction explaining the concept of workspaces in Pipedream and their relationship to other resources (like accounts, subscriptions, and sources). This context would be particularly helpful for new users or those transitioning from individual accounts to workspace-based management.


294-294: Minor grammatical improvement

Consider adding a hyphen to the compound adjective "third party" when it's used to modify a noun:

- A unique identifier in the third party API's system, typically a user ID or email address
+ A unique identifier in the third-party API's system, typically a user ID or email address

This change improves grammatical correctness and readability.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~294-~294: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ...oauth_uid` — A unique identifier in the third party API's system, typically a user ID or em...

(EN_COMPOUND_ADJECTIVE_INTERNAL)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 72921fe and 28417e6.

📒 Files selected for processing (12)
  • components/ai_textraction/ai_textraction.app.mjs (1 hunks)
  • components/attractwell/attractwell.app.mjs (1 hunks)
  • components/deepimage/deepimage.app.mjs (1 hunks)
  • components/fluidforms/fluidforms.app.mjs (1 hunks)
  • components/gainsight_nxt/gainsight_nxt.app.mjs (1 hunks)
  • components/gainsight_px/gainsight_px.app.mjs (1 hunks)
  • components/runware/runware.app.mjs (1 hunks)
  • docs-v2/pages/connect/index.mdx (1 hunks)
  • docs-v2/pages/connect/quickstart.mdx (0 hunks)
  • docs-v2/pages/privacy-and-security/best-practices.mdx (2 hunks)
  • docs-v2/pages/rest-api/index.mdx (30 hunks)
  • docs-v2/pages/workflows/triggers.mdx (3 hunks)
💤 Files with no reviewable changes (1)
  • docs-v2/pages/connect/quickstart.mdx
✅ Files skipped from review due to trivial changes (7)
  • components/ai_textraction/ai_textraction.app.mjs
  • components/attractwell/attractwell.app.mjs
  • components/deepimage/deepimage.app.mjs
  • components/fluidforms/fluidforms.app.mjs
  • components/gainsight_nxt/gainsight_nxt.app.mjs
  • components/gainsight_px/gainsight_px.app.mjs
  • components/runware/runware.app.mjs
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs-v2/pages/connect/index.mdx
🧰 Additional context used
🪛 LanguageTool
docs-v2/pages/rest-api/index.mdx

[style] ~156-~156: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ..., a required parameter was omitted). - Codes in the 5xx range indicate an error wi...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[uncategorized] ~294-~294: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ...oauth_uid` — A unique identifier in the third party API's system, typically a user ID or em...

(EN_COMPOUND_ADJECTIVE_INTERNAL)

🔇 Additional comments (8)
docs-v2/pages/privacy-and-security/best-practices.mdx (2)

3-4: Improved clarity on user responsibility for security

The modification from "any Node.js code" to "any code" is a positive change. It accurately reflects that Pipedream can run various types of code, not just Node.js, and reinforces the user's responsibility in maintaining security across all code types.


Line range hint 1-71: Overall improvement in security guidance documentation

The changes made to this document significantly enhance its value to users. The revisions provide clearer, more actionable guidance on security best practices, with a stronger emphasis on user responsibility and more precise information about Pipedream's features and data handling practices.

Key improvements include:

  1. Clearer guidance on secret management
  2. Stronger emphasis on secure data transmission
  3. Improved clarity on HTTP trigger security
  4. More precise explanation of Pipedream's data retention practices
  5. Valuable information on data privacy and user control

These changes will help users better understand and implement security best practices in their Pipedream workflows. The document now provides a more comprehensive and practical guide to security within the Pipedream ecosystem.

docs-v2/pages/workflows/triggers.mdx (4)

3-3: Excellent additions to enhance security and user experience!

The new import of the Tabs component and the comprehensive section on authorizing HTTP requests are valuable additions to the documentation. The authorization section provides clear guidance on implementing custom tokens and OAuth, which significantly improves the security posture of HTTP triggers.

Also applies to: 104-199


202-203: Improved clarity in custom domains section.

The slight modification to the custom domains explanation enhances readability and provides clearer information about the default domain format.


699-703: Improved clarity in RSS trigger explanation.

The updates to the RSS trigger section provide a clearer explanation of how the trigger works and what users can expect when using it.


Line range hint 1-707: Overall excellent improvements to the triggers documentation!

The changes made to this file significantly enhance the quality and usefulness of the Pipedream triggers documentation. Key improvements include:

  1. Addition of comprehensive authorization guidance for HTTP triggers.
  2. Clearer explanations for various trigger types.
  3. New troubleshooting information for email triggers.
  4. Overall improved readability and structure.

These updates will greatly benefit users in understanding and implementing Pipedream triggers effectively.

docs-v2/pages/rest-api/index.mdx (2)

7-7: Improved API overview

The updated overview provides a more specific and comprehensive description of the API's capabilities, which will help users understand its scope better.


28-38: Clearer explanation of required headers

The rephrased section provides a more explicit explanation of the required headers, particularly emphasizing the necessity of the Authorization header for all endpoints. The updated example maintains consistency with the authentication section.

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

🧹 Outside diff range and nitpick comments (25)
docs-v2/pages/connect/_meta.json (1)

13-24: LGTM! Consider future organization improvements.

The new sections (Connect tokens, Environments, Webhooks, and Connect Link) have been correctly added to the documentation structure. The JSON syntax is valid, and the new entries follow the existing format consistently.

As the documentation grows, consider organizing related sections into nested objects for better hierarchy and readability. For example:

{
  "overview": { "title": "Overview" },
  "use-cases": { "title": "Use cases" },
  "quickstart": { "title": "Quickstart" },
  "api": { "title": "API & SDK Reference" },
  "connect": {
    "title": "Connect",
    "tokens": { "title": "Connect tokens" },
    "environments": { "title": "Environments" },
    "webhooks": { "title": "Webhooks" },
    "connect-link": { "title": "Connect Link" }
  }
}

This structure could provide a more organized navigation for users as the documentation expands.

docs-v2/pages/connect/connect-link.mdx (3)

9-23: Consider using a code block for the URL example

The instructions for generating a Connect Link URL are clear and well-structured. To improve readability, consider using a code block for the URL example in step 3. This will make it easier for users to distinguish the URL structure from the surrounding text.

Here's a suggested change:

 3. Before returning the URL to your user, add an `app` parameter to the end of the query string:

-```
-https://pipedream.com/_static/connect.html?token={token}&connectLink=true&app={appSlug}
-```
+```
+https://pipedream.com/_static/connect.html?token={token}&connectLink=true&app={appSlug}
+```
🧰 Tools
🪛 LanguageTool

[style] ~11-~11: This phrase is redundant. Consider writing “Connect”.
Context: ...kstart) for a full tutorial for getting Connect up and running. Here's a quick overview ...

(CONNECT_TOGETHER)


25-26: Enhance the workflow link presentation

The provided workflow link is valuable for users to test the code. However, its presentation could be improved to better integrate with the documentation and provide more context.

Consider revising the text as follows:

To test this code and see Connect Link in action, you can use [this example workflow](https://pipedream.com/new?h=tch_EvfbvQ). This workflow demonstrates the process of generating and using a Connect Link URL.

This change provides more context about the workflow's purpose and integrates it better with the documentation flow.


1-28: Overall: Well-structured documentation with a minor style suggestion

The Connect Link documentation is well-organized and provides comprehensive information on the feature. The content flows logically and is easy to follow.

There's a minor style suggestion from the static analysis tool:

On line 11, the phrase "for getting Connect up and running" is flagged as potentially redundant. Consider revising to:

-See [the Connect quickstart](/connect/quickstart) for a full tutorial for getting Connect up and running. 
+See [the Connect quickstart](/connect/quickstart) for a full tutorial on using Connect. 

This change maintains the meaning while making the sentence more concise.

🧰 Tools
🪛 LanguageTool

[style] ~11-~11: This phrase is redundant. Consider writing “Connect”.
Context: ...kstart) for a full tutorial for getting Connect up and running. Here's a quick overview ...

(CONNECT_TOGETHER)

docs-v2/pages/connect/tokens.mdx (4)

5-12: LGTM: Clear introduction with good examples.

The introduction effectively outlines the two main options for initiating account connection and provides clear guidance on when to use tokens. The examples are practical and help users understand the use cases.

Consider adding a brief sentence explaining the benefits of using tokens over the Connect Link feature to help users make an informed decision between the two options.


14-16: Consider expanding the "Creating a token" section.

While the reference to the API documentation is correct, this section could be more helpful to users by including:

  1. A brief overview of the token creation process.
  2. Key parameters required for token creation.
  3. A simple example of how to use the API to create a token.

This additional information would provide users with a quick understanding of the process without immediately redirecting them to another page.


18-22: LGTM: Clear explanation of webhooks with appropriate reference.

The section effectively explains the purpose and benefits of using webhooks in the token creation process. The reference to separate documentation for more details is appropriate.

Consider adding a brief example of a webhook payload or structure to give users a quick insight into what kind of data they can expect to receive.


1-28: Overall, excellent introduction to Connect tokens with room for minor enhancements.

The documentation provides a comprehensive and well-structured introduction to Connect tokens, covering key aspects such as token creation, webhooks, and scoping. The content is generally clear and informative.

To further improve the documentation:

  1. Consider adding more code examples or snippets to illustrate key concepts.
  2. Ensure consistent formatting throughout the document (e.g., use of backticks for code elements).
  3. Add a brief conclusion or summary section to reinforce the main points.
  4. Consider including links to related topics or next steps for users who want to implement Connect tokens.

These enhancements would make the documentation even more user-friendly and comprehensive.

docs-v2/pages/connect/index.mdx (2)

9-11: Improved clarity and call-to-action in the Callout.

The updates to the Callout component effectively communicate the preview status of Pipedream Connect and encourage user engagement. The addition of contact information and the Slack community link is particularly helpful.

Consider adding a brief mention of the potential benefits for design partners to further incentivize participation.


18-22: Comprehensive and user-focused feature list.

The expanded and reformatted feature list effectively communicates the capabilities of Pipedream Connect. The active language and additional details about the Client SDK, Connect Link, and workflow capabilities provide users with a clear understanding of the tools at their disposal.

Consider adding brief examples or use cases for each feature to further illustrate their practical applications.

docs-v2/pages/projects/index.mdx (1)

78-81: Enhance the "Finding your project's ID" section with more details and context.

The new section provides a clear, concise instruction for finding the project ID. However, it could be improved by:

  1. Explaining why a user might need the project ID.
  2. Providing more detailed steps on how to access the project settings.
  3. Adding a note about the format or appearance of the project ID to help users identify it.

Consider expanding the section like this:

## Finding your project's ID

You may need your project's ID for API calls, integrations, or troubleshooting. To find it:

1. Navigate to your project in the Pipedream dashboard.
2. Click on the "Settings" tab in the project navigation menu.
3. Look for the "Project ID" field - it's typically a long alphanumeric string.

Copy this ID when needed for API requests or when communicating with support about your project.
docs-v2/pages/connect/quickstart.mdx (7)

Line range hint 8-22: Improved introduction and visual overview

The updated introduction and new visual overview provide a clearer explanation of Pipedream Connect's functionality. The addition of two images effectively illustrates the Connect workflow and its integration with user applications.

Consider adding brief captions to the images to further enhance their clarity and context.


45-53: Clear instructions for creating a Pipedream OAuth application

The new subsection provides clear, step-by-step instructions for creating a Pipedream OAuth application. This addition is crucial for users to properly set up and use Connect.

Consider adding a brief explanation of why creating an OAuth application is necessary, to help users understand the importance of this step in the overall process.


57-66: Comprehensive guide for integrating Pipedream Connect

The updated instructions provide a more thorough and secure approach to integrating Pipedream Connect. The emphasis on secure API calls and the introduction of the Connect Link option offer users flexibility in implementation.

Consider adding a brief comparison between using the Pipedream SDK in the frontend and using Connect Link, to help users choose the best option for their specific use case.


84-126: Improved options for initiating account connections

The updated section on generating tokens and using Connect Link provides users with clear instructions and more flexibility in implementing account connections. Both methods are well-explained, catering to different use cases.

Consider adding a brief note about the security implications of each method, particularly regarding token handling and expiration, to help users make informed decisions about which method to use.


Line range hint 130-176: Clear instructions for connecting user accounts

The updated section on connecting user accounts provides comprehensive guidance, including detailed instructions for using the Pipedream SDK and code examples. This will greatly assist developers in implementing the account connection process.

Consider adding a brief example or code snippet for handling errors or edge cases in the account connection process, to provide a more robust implementation guide.


Line range hint 178-456: Comprehensive examples for retrieving user credentials

The updated section on retrieving credentials from the backend now includes code examples in multiple programming languages, making it more accessible to a diverse range of developers. The examples clearly demonstrate how to fetch credentials using the user's external_id and the app's name slug.

Consider adding a note about securely storing and handling the retrieved credentials, emphasizing the importance of not exposing sensitive information to the client-side.


Line range hint 458-460: Consider expanding the production deployment section

The current conclusion briefly mentions deploying the app to production. This section could be expanded to provide more value to users.

Consider adding more detailed guidance on transitioning from development to production. This could include:

  1. Best practices for securing production credentials
  2. Tips for testing the integration in a staging environment
  3. Considerations for scaling the integration in a production setting
  4. Links to relevant Pipedream documentation on production deployments, if available
docs-v2/pages/rest-api/index.mdx (7)

15-24: Enhanced authentication options and guidance

The introduction of OAuth as a recommended authentication method is a significant improvement. The example has been updated accordingly, and there's a reference to more detailed documentation.

Consider adding a brief explanation of the benefits of using OAuth over API keys to help users understand the recommendation better.


26-30: Clear explanation of workspace vs. user authentication

The new section effectively explains the difference between authenticating as a workspace and as a user. This information is crucial for users working with both personal and workspace accounts.

Consider adding a brief example or use case for each authentication type to further illustrate when each should be used.


72-81: Improved guidance on org_id parameter usage

The updated description of the org_id parameter provides clear guidance on its usage, particularly in the context of different authentication methods. This information is crucial for users to understand when they need to specify the workspace ID.

Consider adding a brief example of how to include the org_id parameter in a request to make it even clearer for users.


158-162: Improved formatting of error code descriptions

The reformatting of the error code descriptions improves readability and makes the information easier to scan.

Consider rewording one of the sentences to avoid starting three consecutive sentences with "Codes in the". For example:

- Codes in the `2xx` range indicate success. 
- Codes in the `4xx` range indicate an error that failed (e.g., a required parameter was omitted). 
- Codes in the `5xx` range indicate an error with Pipedream's server.
+ Codes in the `2xx` range indicate success. 
+ The `4xx` range signifies an error that failed (e.g., a required parameter was omitted). 
+ Codes in the `5xx` range indicate an error with Pipedream's server.
🧰 Tools
🪛 LanguageTool

[style] ~162-~162: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ..., a required parameter was omitted). - Codes in the 5xx range indicate an error wi...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


Line range hint 236-300: Enhanced Get account endpoint documentation

The updates to the Get account endpoint documentation provide comprehensive information on retrieving account details. The addition of instructions for finding the account ID and the option to include credentials is particularly helpful. The examples for both metadata and credential retrieval are clear and well-formatted.

Consider adding a hyphen to "third-party" in the oauth_uid description for grammatical correctness:

- oauth_uid` — A unique identifier in the third party API's system, typically a user ID or email address
+ oauth_uid` — A unique identifier in the third-party API's system, typically a user ID or email address

512-516: Informative new Connect section

The new Connect section provides a concise introduction to Pipedream Connect and its capabilities. The inclusion of links to more detailed documentation and use cases is helpful for users interested in exploring this feature further.

Consider adding a brief one-sentence explanation of what Pipedream Connect is, to provide immediate context for users unfamiliar with the feature.


628-723: Comprehensive new OAuth section

The new OAuth section is a valuable addition to the documentation, providing detailed information on obtaining and revoking OAuth tokens. The examples for both requests and responses are clear and informative.

For consistency, consider using single quotes for the curl command's Authorization header across all examples in the document. For instance:

- curl https://api.pipedream.com/v1/oauth/token \
-   -H "Authorization: Bearer <token>" \
+ curl https://api.pipedream.com/v1/oauth/token \
+   -H 'Authorization: Bearer <token>' \

Apply this change to all curl examples in the document for consistency.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 28417e6 and 9b798d5.

📒 Files selected for processing (9)
  • docs-v2/pages/connect/_meta.json (1 hunks)
  • docs-v2/pages/connect/connect-link.mdx (1 hunks)
  • docs-v2/pages/connect/environments.mdx (1 hunks)
  • docs-v2/pages/connect/index.mdx (2 hunks)
  • docs-v2/pages/connect/quickstart.mdx (6 hunks)
  • docs-v2/pages/connect/tokens.mdx (1 hunks)
  • docs-v2/pages/connect/webhooks.mdx (1 hunks)
  • docs-v2/pages/projects/index.mdx (1 hunks)
  • docs-v2/pages/rest-api/index.mdx (31 hunks)
✅ Files skipped from review due to trivial changes (2)
  • docs-v2/pages/connect/environments.mdx
  • docs-v2/pages/connect/webhooks.mdx
🧰 Additional context used
🪛 LanguageTool
docs-v2/pages/connect/connect-link.mdx

[style] ~11-~11: This phrase is redundant. Consider writing “Connect”.
Context: ...kstart) for a full tutorial for getting Connect up and running. Here's a quick overview ...

(CONNECT_TOGETHER)

docs-v2/pages/connect/index.mdx

[grammar] ~61-~61: There seems to be a noun/verb agreement error. Did you mean “secures” or “secured”?
Context: ...omatically redirected to HTTPS. - **Use secure, session-based auth between your client...

(SINGULAR_NOUN_VERB_AGREEMENT)

docs-v2/pages/connect/quickstart.mdx

[uncategorized] ~41-~41: Possible missing comma found.
Context: ...for the app you'd like to integrate. 2. Now when selecting an OAuth app in the **Ap...

(AI_HYDRA_LEO_MISSING_COMMA)

docs-v2/pages/rest-api/index.mdx

[style] ~162-~162: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ..., a required parameter was omitted). - Codes in the 5xx range indicate an error wi...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[uncategorized] ~300-~300: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ...oauth_uid` — A unique identifier in the third party API's system, typically a user ID or em...

(EN_COMPOUND_ADJECTIVE_INTERNAL)

🔇 Additional comments (12)
docs-v2/pages/connect/connect-link.mdx (1)

1-7: LGTM: Clear and informative introduction

The introduction and "When to use Connect Link" section provide a concise and clear explanation of the feature and its use cases. This information is valuable for users to understand when and why they should use Connect Link.

docs-v2/pages/connect/tokens.mdx (1)

1-3: LGTM: Import and title are appropriate.

The import statement and the document title are correctly implemented and provide a clear introduction to the topic.

docs-v2/pages/connect/index.mdx (4)

14-16: Enhanced introduction with improved clarity and structure.

The rewritten introduction effectively communicates the core value of Pipedream Connect while maintaining brevity. The separation of the code-level control statement and the addition of the use cases link improve the overall structure and provide valuable context for users.


51-51: Improved security information with specific Connect details.

The updated security section now includes a direct link to Connect-specific security information while retaining the general security documentation link. This change provides users with more targeted and comprehensive security information.


74-74: Updated "End User" definition for accuracy.

The change from external_id to external_user_id in the "End User" definition accurately reflects the parameter used in the Connect SDK and API. This update enhances the documentation's precision and helps prevent potential confusion for developers.


Line range hint 1-5: Removal of unused VideoPlayer component.

The removal of the unused VideoPlayer component import improves code cleanliness.

Please ensure that the video content previously displayed by this component is still accessible to users through alternative means, such as a link or embedded video, if it contained valuable information.

docs-v2/pages/projects/index.mdx (1)

Line range hint 1-81: LGTM! Approve with minor suggestions.

The addition of the "Finding your project's ID" section enhances the document's completeness. The overall structure and content of the document are well-maintained. The new section integrates seamlessly with the existing information about Pipedream projects.

Consider the earlier suggestions to:

  1. Enhance the new section with more details and context.
  2. Potentially move the new section earlier in the document for better user experience.

These minor improvements will further increase the document's value to users.

docs-v2/pages/connect/quickstart.mdx (2)

41-41: No change needed for comma placement

The static analysis tool suggested a possible missing comma, but upon review, the current sentence structure is clear and grammatically correct without the addition of a comma.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~41-~41: Possible missing comma found.
Context: ...for the app you'd like to integrate. 2. Now when selecting an OAuth app in the **Ap...

(AI_HYDRA_LEO_MISSING_COMMA)


Line range hint 1-460: Excellent improvements to the Pipedream Connect Quickstart guide

The updates to this document significantly enhance the quality and usefulness of the Pipedream Connect Quickstart guide. Key improvements include:

  1. Clearer explanations and visual aids for understanding Pipedream Connect's functionality
  2. Detailed instructions for creating a Pipedream OAuth application
  3. More comprehensive guidance on integrating Pipedream Connect, including secure API calls
  4. Introduction of the Connect Link option for greater flexibility
  5. Expanded code examples in multiple programming languages

These changes provide a more thorough, flexible, and developer-friendly guide for getting started with Pipedream Connect.

docs-v2/pages/rest-api/index.mdx (3)

7-7: Improved API overview description

The updated description provides a clearer and more comprehensive overview of the API's capabilities, which is beneficial for users.


34-43: Updated header requirements and example

The changes in this section correctly emphasize the requirement of the Authorization header and provide an updated example using a token instead of an API key. This aligns with the new authentication recommendations.


168-206: Comprehensive new Accounts section

The new Accounts section is a valuable addition to the documentation. It provides clear instructions on how to list and retrieve connected accounts, including well-formatted examples for both requests and responses. This information will be particularly useful for users managing multiple connected accounts.

**To test this code, check out this workflow:**
[https://pipedream.com/new?h=tch_EvfbvQ](https://pipedream.com/new?h=tch_EvfbvQ)

## Success and error redirect URLs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Add content to the "Success and error redirect URLs" section

The "Success and error redirect URLs" section is currently empty. This section could provide valuable information for users implementing Connect Link.

Consider adding content to explain how success and error redirects work with Connect Link. If you'd like assistance in drafting this section or need more information before completing it, please let me know. Alternatively, I can create a GitHub issue to track this task for future completion.

docs-v2/pages/connect/tokens.mdx Outdated Show resolved Hide resolved
docs-v2/pages/connect/index.mdx Show resolved Hide resolved
Comment on lines +78 to +81
## Finding your project's ID

Visit your project's **Settings** and copy the project ID.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Consider moving the "Finding your project's ID" section earlier in the document.

The new section about finding the project ID is valuable information that users might need when performing various actions described in the document. Consider moving this section closer to the beginning of the document, perhaps after the "Creating projects" section. This would ensure that users are aware of how to find their project ID before they need it for more advanced operations.

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

🧹 Outside diff range and nitpick comments (2)
docs-v2/pages/connect/index.mdx (2)

14-22: Enhanced introduction and feature list.

The rephrased introduction and expanded feature list provide a clearer, more comprehensive overview of Pipedream Connect's capabilities. The active voice and emphasis on user control make the content more engaging.

Consider adding a brief sentence or two after the feature list to summarize the benefits or potential impact of these features for the user. This could help reinforce the value proposition of Pipedream Connect.


59-62: Comprehensive security recommendations with practical examples.

The expanded "How to secure your Connect apps" section provides valuable, detailed security guidance. The inclusion of specific identity provider examples and advice on securing workflows contributes to a more holistic security approach.

There's a minor grammar issue in the phrase "Use secure, session-based auth". Consider changing it to "Use a secure, session-based auth mechanism" for better clarity and grammatical correctness.

🧰 Tools
🪛 LanguageTool

[grammar] ~61-~61: There seems to be a noun/verb agreement error. Did you mean “secures” or “secured”?
Context: ...omatically redirected to HTTPS. - **Use secure, session-based auth between your client...

(SINGULAR_NOUN_VERB_AGREEMENT)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 9b798d5 and f3bac44.

📒 Files selected for processing (3)
  • components/roamresearch/roamresearch.app.mjs (1 hunks)
  • components/smstools/smstools.app.mjs (1 hunks)
  • docs-v2/pages/connect/index.mdx (2 hunks)
✅ Files skipped from review due to trivial changes (2)
  • components/roamresearch/roamresearch.app.mjs
  • components/smstools/smstools.app.mjs
🧰 Additional context used
🪛 LanguageTool
docs-v2/pages/connect/index.mdx

[grammar] ~61-~61: There seems to be a noun/verb agreement error. Did you mean “secures” or “secured”?
Context: ...omatically redirected to HTTPS. - **Use secure, session-based auth between your client...

(SINGULAR_NOUN_VERB_AGREEMENT)

🔇 Additional comments (3)
docs-v2/pages/connect/index.mdx (3)

9-11: Improved clarity and focus in the callout section.

The updates to the callout effectively emphasize the preview phase of Pipedream Connect and the search for design partners. The reorganized content provides a clearer message to potential users and encourages feedback.


51-51: Improved security information accessibility.

The updated security section now includes a direct link to Connect-specific security details while retaining the general security documentation link. This change enhances the accessibility of relevant security information for users.


74-74: Improved clarity in End User definition.

The updated "End User" definition in the glossary now specifies the external_user_id parameter, providing more precise information about how end users are identified in the Connect SDK and API.

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

🧹 Outside diff range and nitpick comments (4)
docs-v2/pages/connect/index.mdx (1)

9-9: Consider structuring contact methods more prominently.

The preview phase messaging is clear, but the contact methods could be more visible. Consider using a bullet list for contact options:

-please reach out at `[email protected]` or in our [Slack community](https://pipedream.com/support).
+Please reach out through:
+- Email: `[email protected]`
+- [Slack community](https://pipedream.com/support)

Also applies to: 11-11

docs-v2/pages/connect/quickstart.mdx (3)

82-83: Add security considerations for environment variables.

While the environment variables are documented, consider adding:

  1. Instructions for secure storage in production
  2. Validation checks to ensure variables are set
  3. Warning about not committing these values to version control

Example validation:

if (!process.env.PIPEDREAM_OAUTH_CLIENT_ID || !process.env.PIPEDREAM_OAUTH_CLIENT_SECRET) {
  throw new Error('Missing required Pipedream OAuth credentials');
}

45-45: Fix grammar: Add missing comma.

Add a comma after "integrate" for better readability.

-for the app you'd like to integrate
+for the app you'd like to integrate,
🧰 Tools
🪛 LanguageTool

[uncategorized] ~45-~45: Possible missing comma found.
Context: ...for the app you'd like to integrate. 2. Now when selecting an OAuth app in the **Ap...

(AI_HYDRA_LEO_MISSING_COMMA)


90-90: Fix grammar: Add missing 'to'.

Add the missing "to" in the infinitive form.

-you'll need generate
+you'll need to generate
🧰 Tools
🪛 LanguageTool

[grammar] ~90-~90: The verb “generate” needs to be in the to-infinitive form.
Context: ...ount connections for your users, you'll need generate a short-lived token for your users and ...

(MISSING_TO_BEFORE_A_VERB)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between f3bac44 and cd7ce90.

📒 Files selected for processing (2)
  • docs-v2/pages/connect/index.mdx (2 hunks)
  • docs-v2/pages/connect/quickstart.mdx (7 hunks)
🧰 Additional context used
🪛 LanguageTool
docs-v2/pages/connect/index.mdx

[grammar] ~62-~62: There seems to be a noun/verb agreement error. Did you mean “secures” or “secured”?
Context: ...omatically redirected to HTTPS. - **Use secure, session-based auth between your client...

(SINGULAR_NOUN_VERB_AGREEMENT)

docs-v2/pages/connect/quickstart.mdx

[uncategorized] ~45-~45: Possible missing comma found.
Context: ...for the app you'd like to integrate. 2. Now when selecting an OAuth app in the **Ap...

(AI_HYDRA_LEO_MISSING_COMMA)


[grammar] ~90-~90: The verb “generate” needs to be in the to-infinitive form.
Context: ...ount connections for your users, you'll need generate a short-lived token for your users and ...

(MISSING_TO_BEFORE_A_VERB)

🔇 Additional comments (4)
docs-v2/pages/connect/index.mdx (3)

14-23: Well-structured product capabilities section!

The numbered list effectively communicates key features while maintaining good readability. Links to documentation are properly formatted and comprehensive.


60-63: ⚠️ Potential issue

Excellent security recommendations, minor grammar fix needed.

The security recommendations are comprehensive and well-explained. However, there's a minor grammar issue that should be addressed:

-Use secure, session-based auth between your client and server
+Use a secure, session-based auth mechanism between your client and server
🧰 Tools
🪛 LanguageTool

[grammar] ~62-~62: There seems to be a noun/verb agreement error. Did you mean “secures” or “secured”?
Context: ...omatically redirected to HTTPS. - **Use secure, session-based auth between your client...

(SINGULAR_NOUN_VERB_AGREEMENT)


69-69: Verify parameter name change consistency.

The End User definition has been updated to use external_user_id. Let's verify this change is consistent across the documentation and codebase.

✅ Verification successful

Based on the search results, I can see that there's a mix of both external_id and external_user_id usage in the codebase. Let me verify the Connect SDK and API usage specifically to determine the correct parameter name.


Parameter name change is correct and consistent

The change from external_id to external_user_id in the End User definition is accurate. The Connect SDK and API consistently use external_user_id when creating tokens and identifying users. While external_id appears in the API responses, it's used internally by the system to map to the external_user_id provided during token creation, as evidenced by the SDK code that maps external_user_id to external_id in the request body.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any remaining instances of the old parameter name
echo "Searching for old parameter name 'external_id'..."
rg "external_id" --type mdx

echo "Verifying new parameter name usage..."
rg "external_user_id" --type mdx

Length of output: 316


Script:

#!/bin/bash
# Search for any remaining instances of the old parameter name across all files
echo "Searching for old parameter name 'external_id'..."
rg "external_id"

echo -e "\nVerifying new parameter name usage..."
rg "external_user_id"

# Also check for markdown/mdx files specifically
echo -e "\nListing documentation files..."
fd -e md -e mdx

Length of output: 88832


Script:

#!/bin/bash
# Search for external_id and external_user_id specifically in Connect SDK and API related files
echo "Checking Connect SDK usage..."
rg -A 2 -B 2 "external_user_id|external_id" packages/sdk/src/server/

echo -e "\nChecking Connect API documentation..."
rg -A 2 -B 2 "external_user_id|external_id" "docs-v2/pages/connect/"

Length of output: 16556

docs-v2/pages/connect/quickstart.mdx (1)

8-8: LGTM! Clear introduction and effective visual overview.

The introduction clearly explains Pipedream Connect's purpose, and the visual diagrams effectively illustrate the system architecture and integration flow.

Also applies to: 17-20

Comment on lines 90 to 92
To securely initiate account connections for your users, you'll need generate a short-lived token for your users and use that in the [account connection flow](#connect-a-users-account). See [the docs on Connect tokens](/connect/tokens) for a general overview of why we need to create tokens and scope them to end users.

connect_token_opts = {
external_id: "USER_ID"
}

# Expose this code as an API endpoint in your server to fetch the token from the frontend
response = client.connect_token_create(connect_token_opts[:external_id])
```
</Tabs.Tab>
</Tabs>

In our Next.js app, we call the `serverConnectTokenCreate` method from the frontend to retrieve a token **for a specific user**.
In the Next.js example here, we're running [Next server components](https://nextjs.org/docs/app/building-your-application/rendering/server-components) in `app/server.ts`. We call the `serverConnectTokenCreate` method from the frontend to retrieve a token **for a specific user**.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add error handling for token generation.

The token generation section should include error handling examples to handle API failures gracefully.

Example error handling:

try {
  const { token, expires_at } = await serverConnectTokenCreate({
    external_user_id: externalUserId
  });
} catch (error) {
  console.error('Failed to generate token:', error);
  // Handle error appropriately
  throw new Error('Unable to initialize account connection');
}
🧰 Tools
🪛 LanguageTool

[grammar] ~90-~90: The verb “generate” needs to be in the to-infinitive form.
Context: ...ount connections for your users, you'll need generate a short-lived token for your users and ...

(MISSING_TO_BEFORE_A_VERB)

Comment on lines 162 to 164
1. First, [generate a token](#generate-a-token) for your users.
2. Extract the `connect_link_url` from the token response.
3. Before returning the URL to your user, add an `app` parameter to the end of the query string:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Ensure URL parameters are properly encoded.

When constructing the Connect Link URL, ensure parameters are properly encoded to prevent injection vulnerabilities.

Apply this change:

-https://pipedream.com/_static/connect.html?token={token}&connectLink=true&app={appSlug}
+https://pipedream.com/_static/connect.html?token=${encodeURIComponent(token)}&connectLink=true&app=${encodeURIComponent(appSlug)}

Committable suggestion was skipped due to low confidence.

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

🧹 Outside diff range and nitpick comments (1)
docs-v2/pages/connect/quickstart.mdx (1)

556-557: Add security considerations for production deployment.

Consider adding a security checklist that includes:

  1. Secure storage of OAuth credentials
  2. HTTPS enforcement
  3. Access token rotation
  4. Audit logging
  5. Regular security scanning

Would you like me to provide a detailed security checklist template?

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between d5b256b and 4516cf0.

📒 Files selected for processing (1)
  • docs-v2/pages/connect/quickstart.mdx (9 hunks)
🧰 Additional context used
🪛 LanguageTool
docs-v2/pages/connect/quickstart.mdx

[grammar] ~76-~76: The verb “generate” needs to be in the to-infinitive form.
Context: ...ount connections for your users, you'll need generate a short-lived token for your users and ...

(MISSING_TO_BEFORE_A_VERB)

Comment on lines 175 to 180

const pd = createClient({
publicKey: PIPEDREAM_PROJECT_PUBLIC_KEY,
secretKey: PIPEDREAM_PROJECT_SECRET_KEY,
oauth: {
clientId: "your-oauth-client-id",
clientSecret: "your-oauth-client-secret",
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Enhance error handling and add rate limiting.

Consider adding:

  1. Rate limiting to prevent API abuse
  2. Retry logic for transient failures
  3. Error handling for network issues

Example enhancement for the TypeScript client:

 const pd = createClient({
   oauth: {
     clientId: "your-oauth-client-id",
     clientSecret: "your-oauth-client-secret",
+    retryConfig: {
+      maxRetries: 3,
+      minTimeout: 1000,
+      maxTimeout: 5000
+    },
+    rateLimit: {
+      tokensPerInterval: 10,
+      interval: "minute"
+    }
   }
 });

Committable suggestion was skipped due to low confidence.

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

🧹 Outside diff range and nitpick comments (14)
docs-v2/pages/rest-api/auth.mdx (3)

33-57: Consider enhancing the SDK usage example with error handling.

While the code example is clear, it would be more robust with error handling and best practices for token management.

Consider adding error handling and token management examples:

 import { createBackendClient } from "@pipedream/sdk";
 
-// These secrets should be saved securely and passed to your environment
+// SECURITY: These secrets should be stored in environment variables or a secure secret manager
 const pd = createBackendClient({
   credentials: {
-    clientId: "YOUR_CLIENT_ID",
-    clientSecret: "YOUR_CLIENT_SECRET",
+    clientId: process.env.PIPEDREAM_CLIENT_ID,
+    clientSecret: process.env.PIPEDREAM_CLIENT_SECRET,
   },
 });
 
-// Use the SDK's helper methods to make requests
-const accounts = await pd.getAccounts({ include_credentials: 1 });
+try {
+  // Use the SDK's helper methods to make requests
+  const accounts = await pd.getAccounts({ include_credentials: 1 });
+} catch (error) {
+  // Handle specific error cases (e.g., token expired, invalid credentials)
+  console.error('Error fetching accounts:', error);
+  // Implement appropriate error handling strategy
+}

67-67: Add guidance on token expiration handling.

While you mention that tokens expire after 1 hour, it would be helpful to provide guidance on implementing token refresh strategies and handling expiration errors.

Consider adding a note about implementing automatic token refresh mechanisms and handling 401 Unauthorized responses.


95-102: Add security best practices for token transmission.

While the Bearer Authentication examples are clear, consider adding a security note about:

  • Always using HTTPS for token transmission
  • Not logging or exposing tokens in client-side code
  • Proper token storage practices

Add a security warning:

 ## Authorizing API requests

 Whether you use OAuth access tokens or user API keys, Pipedream uses [Bearer Authentication](https://oauth.net/2/bearer-tokens/) to authorize your access to the API or SSE event streams. When you make API requests, pass an `Authorization` header of the following format:
+
+> **Security Note**: Always transmit tokens over HTTPS, never log them, and store them securely server-side. Never expose tokens in client-side code or version control.
docs-v2/pages/connect/quickstart.mdx (3)

50-52: Consider adding security recommendations for handling sensitive credentials.

While the example shows environment variables, it's important to emphasize secure credential management:

  1. Use a secure secrets manager in production
  2. Rotate credentials periodically
  3. Never commit .env files to version control

Line range hint 121-140: Add error handling to the frontend SDK example.

The example should demonstrate handling potential errors during account connection:

 function connectAccount() {
   pd.connectAccount({
     app: appSlug,
     oauthAppId: appId,
     token: "YOUR_TOKEN",
     onSuccess: ({ id: accountId }) => {
       console.log(`Account successfully connected: ${accountId}`)
-    }
+    },
+    onError: (error) => {
+      console.error('Failed to connect account:', error)
+      // Handle error appropriately (e.g., show user-friendly error message)
+    }
   })
 }

Line range hint 164-554: Standardize error handling across language examples.

While the examples demonstrate basic credential retrieval, they should consistently handle:

  1. Network errors
  2. Authentication failures
  3. Rate limiting
  4. Invalid responses

This ensures users implement robust error handling regardless of their chosen language.

docs-v2/pages/workflows/triggers.mdx (2)

110-124: Add security considerations for custom token implementation.

While the custom token implementation is straightforward, consider adding security best practices:

  • Recommend using a strong token generation method
  • Advise on secure token storage
  • Suggest token rotation policies

689-699: Enhance the email attachment troubleshooting section.

Consider adding:

  • A code example demonstrating how to save attachments to File Store
  • Specific information about token expiration timing (e.g., "URLs expire after 30 minutes")
  • Best practices for handling large attachments
docs-v2/pages/rest-api/index.mdx (6)

15-30: Consider adding security best practices for token handling.

The authentication documentation clearly explains the shift to OAuth as the preferred method. Consider adding:

  • Token expiration and rotation best practices
  • Secure storage recommendations for tokens
  • Rate limiting information
  • Token scope and permission best practices

72-83: Add example requests with org_id parameter.

The documentation clearly explains when org_id is required. Consider adding example requests showing:

  • A request requiring org_id (with User API key)
  • A request without org_id (with OAuth token)

168-228: Enhance accounts endpoint documentation.

Consider adding:

  • Response status codes and error scenarios
  • Rate limiting information specific to these endpoints
  • Pagination examples for listing multiple accounts

827-917: Add security considerations for OAuth endpoints.

The OAuth endpoints documentation should include:

  • Token security best practices
  • Error handling scenarios
  • Token refresh flow documentation

160-162: Improve sentence variety in HTTP status codes section.

Consider rewording to avoid repetitive sentence beginnings:

-Codes in the `2xx` range indicate success. 
-Codes in the `4xx` range indicate an error that failed (e.g., a required parameter was omitted). 
-Codes in the `5xx` range indicate an error with Pipedream's server.
+Status codes in the `2xx` range indicate success.
+Any response with codes in the `4xx` range indicates a client error (e.g., a required parameter was omitted).
+Server-side issues are indicated by codes in the `5xx` range.
🧰 Tools
🪛 LanguageTool

[style] ~162-~162: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ..., a required parameter was omitted). - Codes in the 5xx range indicate an error wi...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


324-324: Fix compound adjective hyphenation.

-oauth_uid` — A unique identifier in the third party API's system
+oauth_uid` — A unique identifier in the third-party API's system
🧰 Tools
🪛 LanguageTool

[uncategorized] ~324-~324: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ...oauth_uid` — A unique identifier in the third party API's system, typically a user ID or em...

(EN_COMPOUND_ADJECTIVE_INTERNAL)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 4516cf0 and f5d7c0c.

📒 Files selected for processing (5)
  • docs-v2/pages/connect/index.mdx (2 hunks)
  • docs-v2/pages/connect/quickstart.mdx (7 hunks)
  • docs-v2/pages/rest-api/auth.mdx (1 hunks)
  • docs-v2/pages/rest-api/index.mdx (31 hunks)
  • docs-v2/pages/workflows/triggers.mdx (3 hunks)
🧰 Additional context used
🪛 LanguageTool
docs-v2/pages/connect/index.mdx

[grammar] ~76-~76: There seems to be a noun/verb agreement error. Did you mean “secures” or “secured”?
Context: ...omatically redirected to HTTPS. - **Use secure, session-based auth between your client...

(SINGULAR_NOUN_VERB_AGREEMENT)

docs-v2/pages/connect/quickstart.mdx

[grammar] ~76-~76: The verb “generate” needs to be in the to-infinitive form.
Context: ...ount connections for your users, you'll need generate a short-lived token for your users and ...

(MISSING_TO_BEFORE_A_VERB)

docs-v2/pages/rest-api/index.mdx

[style] ~162-~162: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ..., a required parameter was omitted). - Codes in the 5xx range indicate an error wi...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[uncategorized] ~324-~324: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ...oauth_uid` — A unique identifier in the third party API's system, typically a user ID or em...

(EN_COMPOUND_ADJECTIVE_INTERNAL)

🔇 Additional comments (7)
docs-v2/pages/rest-api/auth.mdx (2)

3-11: Well-structured introduction with clear authentication guidance!

The introduction effectively presents the authentication options and provides clear rationale for preferring OAuth, with specific benefits clearly outlined.


79-91: Clear and comprehensive API key documentation!

The section effectively explains API key usage, management, and revocation process, with appropriate emphasis on their intended use case for testing and CLI operations.

docs-v2/pages/connect/index.mdx (4)

8-17: Well-structured introduction and capabilities section!

The introduction effectively communicates the product's value proposition, and the capabilities are clearly enumerated with proper links to relevant documentation.


38-48: Clear app configuration instructions!

The steps for adding a new integration are accurate and well-explained, with appropriate guidance about OAuth client options.


54-56: Fix incorrect instruction in user management steps.

The previous review already identified this issue. Step 3 is incorrect as it mentions adding a new app in the Users section.


74-77: Grammar improvement in security recommendations.

The previous review already identified the grammar issue in the phrase "Use secure, session-based auth".

🧰 Tools
🪛 LanguageTool

[grammar] ~76-~76: There seems to be a noun/verb agreement error. Did you mean “secures” or “secured”?
Context: ...omatically redirected to HTTPS. - **Use secure, session-based auth between your client...

(SINGULAR_NOUN_VERB_AGREEMENT)

docs-v2/pages/workflows/triggers.mdx (1)

Line range hint 1-711: Documentation changes look good overall!

The additions to the HTTP authorization section and email troubleshooting provide valuable information for users. The content is well-structured and clear, with good examples and explanations.

## Glossary of terms

- **App**: GitHub, Notion, Slack, Google Sheets, and more. The app is the API you want your users to connect to in your product. See the [full list here](https://pipedream.com/apps).
- **Developer**: This is probably you, the Pipedream customer who's developing an app and wants to use Connect to make API requests on behalf of your end users.
- **End User**: Your customer or user, whose data you want to access on their behalf. End users are identifed via the `external_id` param in the Connect SDK and API.
- **End User**: Your customer or user, whose data you want to access on their behalf. End users are identifed via the `external_user_id` param in the Connect SDK and API.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Parameter name change needs attention

The codebase shows inconsistent usage between external_id and external_user_id:

  • The SDK code in packages/sdk/src/server/index.ts internally maps external_user_id to external_id
  • Documentation in docs-v2/pages/connect/* consistently uses external_user_id
  • Multiple components still use external_id for their own domain-specific purposes

This appears to be a deliberate API design where external_user_id is the public-facing parameter name, while external_id is used internally. However, the SDK's parameter mapping should be documented to avoid confusion.

🔗 Analysis chain

Verify parameter name change consistency.

The End User definition has been updated to use external_user_id instead of external_id. Let's verify this change is consistent across the documentation.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any remaining instances of the old parameter name
rg "external_id" --type mdx
# Search for the new parameter name to ensure consistent usage
rg "external_user_id" --type mdx

Length of output: 116


Script:

#!/bin/bash
# Search for any remaining instances of the old parameter name in all files
rg "external_id"

# Search for the new parameter name to ensure consistent usage
rg "external_user_id"

Length of output: 14135

Comment on lines +148 to +169
```typescript
import { createBackendClient, HTTPAuthType } from "@pipedream/sdk";

// These secrets should be saved securely and passed to your environment
const pd = createBackendClient({
credentials: {
clientId: "YOUR_CLIENT_ID",
clientSecret: "YOUR_CLIENT_SECRET",
},
});

await pd.invokeWorkflow(
"enabc123", // pass the endpoint ID or full URL here
{
method: "POST",
body: {
key: "value",
}
},
HTTPAuthType.OAuth // Will automatically send the Authorization header with a fresh token
)
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Add error handling to SDK examples.

The SDK examples should include error handling to demonstrate proper error management in production environments.

Here's an improved TypeScript example:

 import { createBackendClient, HTTPAuthType } from "@pipedream/sdk";
 
 // These secrets should be saved securely and passed to your environment
 const pd = createBackendClient({
   credentials: {
     clientId: "YOUR_CLIENT_ID",
     clientSecret: "YOUR_CLIENT_SECRET",
   },
 });
 
-await pd.invokeWorkflow(
-  "enabc123", // pass the endpoint ID or full URL here
-  {
-    method: "POST",
-    body: {
-      key: "value",
-    }
-  },
-  HTTPAuthType.OAuth // Will automatically send the Authorization header with a fresh token
-)
+try {
+  await pd.invokeWorkflow(
+    "enabc123", // pass the endpoint ID or full URL here
+    {
+      method: "POST",
+      body: {
+        key: "value",
+      }
+    },
+    HTTPAuthType.OAuth // Will automatically send the Authorization header with a fresh token
+  );
+} catch (error) {
+  console.error("Failed to invoke workflow:", error);
+  // Handle specific error types (e.g., token expired, network issues)
+  throw error;
+}

Also applies to: 172-193

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

🧹 Outside diff range and nitpick comments (4)
docs-v2/pages/connect/quickstart.mdx (2)

Line range hint 121-140: Add TypeScript types to improve code safety.

Consider adding proper TypeScript types to the function parameters and return values:

-function connectAccount() {
+interface ConnectAccountParams {
+  app: string;
+  oauthAppId?: string;
+  token: string;
+  onSuccess: (response: { id: string }) => void;
+}

+function connectAccount(): void {
   pd.connectAccount({
     app: appSlug,
     oauthAppId: appId,
     token: "YOUR_TOKEN",
     onSuccess: ({ id: accountId }) => {
       console.log(`Account successfully connected: ${accountId}`)
     }
   } as ConnectAccountParams)
 }

Line range hint 182-189: Enhance credential retrieval code examples.

The code examples should include:

  1. Return type annotations
  2. Error handling
  3. Type definition for the response

For TypeScript:

+interface Account {
+  id: string;
+  app: string;
+  credentials?: Record<string, unknown>;
+}

-async function getUserAccounts(external_user_id: string, include_credentials: boolean = false) {
+async function getUserAccounts(external_user_id: string, include_credentials: boolean = false): Promise<Account[]> {
+  try {
-    await pd.getAccounts({
+    const accounts = await pd.getAccounts({
       external_user_id,
       include_credentials,
     })
+    return accounts;
+  } catch (error) {
+    console.error('Failed to retrieve user accounts:', error);
+    throw new Error('Unable to retrieve user accounts');
+  }
-  // Parse and return the data you need...
}

For JavaScript:

async function getUserAccounts(external_user_id, include_credentials = false) {
+  try {
-    await pd.getAccounts({
+    const accounts = await pd.getAccounts({
       external_user_id,
       include_credentials,
     })
+    return accounts;
+  } catch (error) {
+    console.error('Failed to retrieve user accounts:', error);
+    throw new Error('Unable to retrieve user accounts');
+  }
-  // Parse and return the data you need...
}

Also applies to: 206-213

docs-v2/pages/rest-api/index.mdx (2)

158-162: Consider improving error codes documentation style.

The current format uses repetitive sentence structure. Consider using a more concise format:

-Codes in the `2xx` range indicate success. 
-Codes in the `4xx` range indicate an error that failed (e.g., a required parameter was omitted). 
-Codes in the `5xx` range indicate an error with Pipedream's server.
+HTTP status codes:
+- `2xx`: Success
+- `4xx`: Client errors (e.g., missing required parameters)
+- `5xx`: Server errors
🧰 Tools
🪛 LanguageTool

[style] ~162-~162: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ..., a required parameter was omitted). - Codes in the 5xx range indicate an error wi...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


324-324: Consider hyphenating compound adjective.

-oauth_uid` — A unique identifier in the third party API's system
+oauth_uid` — A unique identifier in the third-party API's system
🧰 Tools
🪛 LanguageTool

[uncategorized] ~324-~324: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ...oauth_uid` — A unique identifier in the third party API's system, typically a user ID or em...

(EN_COMPOUND_ADJECTIVE_INTERNAL)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between f5d7c0c and 0a5c3b6.

📒 Files selected for processing (2)
  • docs-v2/pages/connect/quickstart.mdx (7 hunks)
  • docs-v2/pages/rest-api/index.mdx (31 hunks)
🧰 Additional context used
🪛 LanguageTool
docs-v2/pages/connect/quickstart.mdx

[grammar] ~76-~76: The verb “generate” needs to be in the to-infinitive form.
Context: ...ount connections for your users, you'll need generate a short-lived token for your users and ...

(MISSING_TO_BEFORE_A_VERB)

docs-v2/pages/rest-api/index.mdx

[style] ~162-~162: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ..., a required parameter was omitted). - Codes in the 5xx range indicate an error wi...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[uncategorized] ~324-~324: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ...oauth_uid` — A unique identifier in the third party API's system, typically a user ID or em...

(EN_COMPOUND_ADJECTIVE_INTERNAL)

🔇 Additional comments (6)
docs-v2/pages/rest-api/index.mdx (6)

7-30: Well-structured authentication documentation!

The overview and authentication sections are clear, concise, and follow best practices by:

  • Clearly stating API capabilities
  • Recommending OAuth as the preferred authentication method
  • Using consistent terminology (<token> instead of <api_key>)

72-83: Clear explanation of org_id parameter usage!

The documentation effectively explains:

  • When org_id is required (only for User API keys)
  • How OAuth tokens automatically handle workspace association
  • Where to find the workspace ID

168-228: Excellent accounts API documentation!

The section provides:

  • Clear endpoint descriptions
  • Well-documented parameters
  • Helpful example requests and responses with explanatory comments
  • Proper formatting and consistent structure

825-918: Comprehensive OAuth implementation documentation!

The section effectively covers:

  • Token exchange endpoint with all required parameters
  • Token revocation process
  • Clear example requests and responses
  • Consistent formatting with other API sections

446-448: Clear documentation of API limitations!

The callout effectively communicates that components endpoints are only available with user API keys, helping developers avoid potential integration issues.


709-714: Excellent introduction to Pipedream Connect!

The section effectively:

  • Introduces the Connect feature and its capabilities
  • Provides relevant links to detailed documentation
  • Highlights key use cases and benefits

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

🧹 Outside diff range and nitpick comments (3)
docs-v2/pages/connect/index.mdx (1)

44-44: Consider adding "please" for politeness.

Consider revising to "Please let us know" for a more courteous tone.

-[Let us know](https://pipedream.com/support) if the app you're looking for isn't listed [here](https://pipedream.com/apps).
+[Please let us know](https://pipedream.com/support) if the app you're looking for isn't listed [here](https://pipedream.com/apps).
🧰 Tools
🪛 LanguageTool

[style] ~44-~44: This expression usually appears with a “please” in front of it.
Context: ...](/connected-accounts/oauth-clients). Let us know if the ...

(INSERT_PLEASE)

docs-v2/pages/connect/quickstart.mdx (2)

Line range hint 122-141: Add error handling for account connection.

The frontend account connection code should include error handling for failed connections.

 function connectAccount() {
+  try {
     pd.connectAccount({
       app: appSlug,
       oauthAppId: appId,
       token: "YOUR_TOKEN",
       onSuccess: ({ id: accountId }) => {
         console.log(`Account successfully connected: ${accountId}`)
       },
+      onError: (error) => {
+        console.error('Failed to connect account:', error);
+        // Handle error appropriately (e.g., show error message to user)
+      }
     })
+  } catch (error) {
+    console.error('Unexpected error:', error);
+    // Handle unexpected errors
+  }
 }

Line range hint 183-190: Add missing return statement in getUserAccounts function.

The getUserAccounts function makes the API call but doesn't return the response.

 async function getUserAccounts(external_user_id: string, include_credentials: boolean = false) {
-  await pd.getAccounts({
+  const accounts = await pd.getAccounts({
     external_user_id,
     include_credentials, // set to true to include credentials
   })
+  return accounts;
 }

Also applies to: 207-214

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 7cb7338 and 6bdfb2c.

📒 Files selected for processing (3)
  • docs-v2/pages/connect/index.mdx (2 hunks)
  • docs-v2/pages/connect/oauth-clients.mdx (1 hunks)
  • docs-v2/pages/connect/quickstart.mdx (7 hunks)
✅ Files skipped from review due to trivial changes (1)
  • docs-v2/pages/connect/oauth-clients.mdx
🧰 Additional context used
🪛 LanguageTool
docs-v2/pages/connect/index.mdx

[style] ~44-~44: This expression usually appears with a “please” in front of it.
Context: ...](/connected-accounts/oauth-clients). Let us know if the ...

(INSERT_PLEASE)


[grammar] ~72-~72: There seems to be a noun/verb agreement error. Did you mean “secures” or “secured”?
Context: ...omatically redirected to HTTPS. - **Use secure, session-based auth between your client...

(SINGULAR_NOUN_VERB_AGREEMENT)

docs-v2/pages/connect/quickstart.mdx

[grammar] ~77-~77: The verb “generate” needs to be in the to-infinitive form.
Context: ...ount connections for your users, you'll need generate a short-lived token for your users and ...

(MISSING_TO_BEFORE_A_VERB)

🔇 Additional comments (8)
docs-v2/pages/connect/index.mdx (5)

8-17: Well-structured introduction and capabilities section!

The introduction effectively communicates the value proposition, and the capabilities list is comprehensive and well-organized.


50-52: Referencing existing issue.

This issue was previously identified in a past review comment.


70-73: Referencing existing grammar issue.

This grammar issue was previously identified in a past review comment.

🧰 Tools
🪛 LanguageTool

[grammar] ~72-~72: There seems to be a noun/verb agreement error. Did you mean “secures” or “secured”?
Context: ...omatically redirected to HTTPS. - **Use secure, session-based auth between your client...

(SINGULAR_NOUN_VERB_AGREEMENT)


79-79: Referencing existing parameter name inconsistency.

This parameter name inconsistency issue was previously identified in a past review comment.


Line range hint 1-82: Well-structured and comprehensive documentation!

The documentation is well-organized, with clear sections covering all essential aspects of Pipedream Connect. The navigation flow is logical, and cross-references are properly maintained.

🧰 Tools
🪛 LanguageTool

[style] ~44-~44: This expression usually appears with a “please” in front of it.
Context: ...](/connected-accounts/oauth-clients). Let us know if the ...

(INSERT_PLEASE)


[grammar] ~72-~72: There seems to be a noun/verb agreement error. Did you mean “secures” or “secured”?
Context: ...omatically redirected to HTTPS. - **Use secure, session-based auth between your client...

(SINGULAR_NOUN_VERB_AGREEMENT)

docs-v2/pages/connect/quickstart.mdx (3)

50-53: Add environment variable validation.

The environment variables setup would benefit from validation to ensure required credentials are present before initializing the client.

Referencing previous suggestion to add validation code:

if (!process.env.PIPEDREAM_OAUTH_CLIENT_ID || !process.env.PIPEDREAM_OAUTH_CLIENT_SECRET) {
  throw new Error('Missing required Pipedream OAuth credentials');
}

Line range hint 82-87: Add error handling for token generation.

The token generation example should include error handling to gracefully handle API failures.

Referencing previous suggestion to add error handling:

try {
  const { token, expires_at } = await serverConnectTokenCreate({
    external_user_id: externalUserId
  });
} catch (error) {
  console.error('Failed to generate token:', error);
  // Handle error appropriately
  throw new Error('Unable to initialize account connection');
}

Line range hint 156-158: Ensure URL parameters are properly encoded.

When constructing the Connect Link URL, parameters should be properly encoded to prevent injection vulnerabilities.

Referencing previous suggestion to encode URL parameters:

-https://pipedream.com/_static/connect.html?token={token}&connectLink=true&app={appSlug}&oauthAppId={oauthAppId}
+https://pipedream.com/_static/connect.html?token=${encodeURIComponent(token)}&connectLink=true&app=${encodeURIComponent(appSlug)}&oauthAppId=${encodeURIComponent(oauthAppId)}

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

🧹 Outside diff range and nitpick comments (3)
docs-v2/pages/rest-api/auth.mdx (3)

9-10: Consider adding timeline information for upcoming features.

The documentation mentions "coming soon" for scopes and project-specific access. To set proper expectations, consider adding an estimated timeline or linking to a roadmap for these features.


82-86: Add security best practices for API key storage.

Consider adding a note about securely storing API keys, similar to the OAuth token security guidance. For example:

  • Store keys in environment variables
  • Never commit keys to version control
  • Use secret management services in production

96-102: Consider adding more language-specific examples.

The Bearer token usage is well explained, but consider adding examples in popular languages like Python, Node.js, or Go to help developers get started quickly.

Example addition:

# Python example
import requests

headers = {
    'Authorization': 'Bearer <access_token>'
}
response = requests.get('https://api.pipedream.com/v1/users/me', headers=headers)
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 6bdfb2c and 6e1d464.

📒 Files selected for processing (1)
  • docs-v2/pages/rest-api/auth.mdx (1 hunks)

Comment on lines +3 to +102
When you sign up for Pipedream, an API key is automatically generated for your account. You can use this key to authorize requests to the API.
**We recommend OAuth** for a few reasons:

✅ OAuth clients are tied to the workspace, administered by workspace admins <br />
✅ Tokens are short-lived <br />
✅ OAuth clients support scopes, limiting access to specific operations (coming soon!)<br />
✅ Limit access to specific Pipedream projects (coming soon!)<br />

When testing the API or using the CLI, you can use your user API key. This key is tied to your user account and provides full access to any resources your user has access to, across workspaces.

## OAuth

Workspace administrators can create OAuth clients in your workspace's [API settings](https://pipedream.com/settings/api).

Since API requests are meant to be made server-side, and since grants are not tied to individual end users, all OAuth clients are [**Client Credentials** applications](https://www.oauth.com/oauth2-servers/access-tokens/client-credentials/).

### Creating an OAuth client

1. Visit the [API settings](https://pipedream.com/settings/api) for your workspace.
2. Click the **New OAuth Client** button.
3. Name your client and click **Create**.
4. Copy the client secret. **It will not be accessible again**. Click **Close**.
5. Copy the client ID from the list.

### How to get an access token

In the client credentials model, you exchange your OAuth client ID and secret for an access token. Then you use the access token to make API requests.

If you're running a server that executes JavaScript, we recommend using [the Pipedream SDK](/connect/api#installing-the-typescript-sdk), which automatically refreshes tokens for you.

```javascript
import { createBackendClient } from "@pipedream/sdk";

// These secrets should be saved securely and passed to your environment
const pd = createBackendClient({
credentials: {
clientId: "YOUR_CLIENT_ID",
clientSecret: "YOUR_CLIENT_SECRET",
},
});

// Use the SDK's helper methods to make requests
const accounts = await pd.getAccounts({ include_credentials: 1 });

// Or make any Pipedream API request with the fresh token
const accounts = await pd.makeRequest("/accounts", {
method: "GET"
headers: {
"Authorization": await this.oauthAuthorizationHeader(), // Automatically uses a fresh token
},
params: {
include_credentials: 1,
}
});
```

You can also manage this token refresh process yourself, using the `/oauth/token` API endpoint:

```bash
curl https://api.pipedream.com/v1/oauth/token \
-H 'Content-Type: application/json' \
-d '{ "grant_type": "client_credentials", "client_id": "<client_id>", "client_secret": "<client secret>" }'
```

Access tokens expire after 1 hour. Store access tokens securely, server-side.

### Revoking a client secret

1. Visit your workspace's [API settings](https://pipedream.com/settings/api).
2. Click the **...** button to the right of the OAuth client whose secret you want to revoke, then click **Rotate client secret**.
3. Copy the new client secret. **It will not be accessible again**.

### OAuth security

See [the OAuth section of the security docs](/privacy-and-security#pipedream-rest-api-security-oauth-clients) for more information on how Pipedream secures OAuth credentials.

## User API keys

When you sign up for Pipedream, an API key is automatically generated for your user account. You can use this key to authorize requests to the API.

You'll find this API key in your [User Settings](https://pipedream.com/user) (**My Account** -> **API Key**).

**Use user API keys when testing the API or using the CLI**. This key is tied to your user account and provides full access to any resources your user has access to, across workspaces.

### Revoking your API key

You can revoke your API key in your [Account Settings](https://pipedream.com/settings/account) (**Settings** -> **Account**). Click on the **REVOKE** button directly to the right of your API key.

This will revoke your original API key, generating a new one. Any API requests made with the original token will yield a `401 Unauthorized` error.

## Authorizing API requests

Pipedream uses [Bearer Authentication](https://oauth.net/2/bearer-tokens/) to authorize your access to the API or SSE event streams. When you make API requests, pass an `Authorization` header of the following format:
Whether you use OAuth access tokens or user API keys, Pipedream uses [Bearer Authentication](https://oauth.net/2/bearer-tokens/) to authorize your access to the API or SSE event streams. When you make API requests, pass an `Authorization` header of the following format:

```
# OAuth access token
Authorization: Bearer <access token>

# User API key
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Consider adding a troubleshooting section.

The documentation would be more complete with a troubleshooting section that covers common authentication issues and their solutions, such as:

  • Invalid token errors
  • Token expiration handling
  • Rate limiting
  • Common OAuth setup issues

Would you like me to provide a template for the troubleshooting section?

Comment on lines +34 to +58
```javascript
import { createBackendClient } from "@pipedream/sdk";

// These secrets should be saved securely and passed to your environment
const pd = createBackendClient({
credentials: {
clientId: "YOUR_CLIENT_ID",
clientSecret: "YOUR_CLIENT_SECRET",
},
});

// Use the SDK's helper methods to make requests
const accounts = await pd.getAccounts({ include_credentials: 1 });

// Or make any Pipedream API request with the fresh token
const accounts = await pd.makeRequest("/accounts", {
method: "GET"
headers: {
"Authorization": await this.oauthAuthorizationHeader(), // Automatically uses a fresh token
},
params: {
include_credentials: 1,
}
});
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

JavaScript code example needs improvements.

The code example has a few issues that should be addressed:

  1. Missing semicolon after the method property
  2. Incorrect this context in this.oauthAuthorizationHeader()
  3. No error handling demonstrated

Here's the corrected version with error handling:

 const pd = createBackendClient({
   credentials: {
     clientId: "YOUR_CLIENT_ID",
     clientSecret: "YOUR_CLIENT_SECRET",
   },
 });

-// Use the SDK's helper methods to make requests
-const accounts = await pd.getAccounts({ include_credentials: 1 });
+// Use the SDK's helper methods to make requests
+try {
+  const accounts = await pd.getAccounts({ include_credentials: 1 });
+  console.log('Accounts retrieved:', accounts);
+} catch (error) {
+  console.error('Error fetching accounts:', error);
+}

-// Or make any Pipedream API request with the fresh token
-const accounts = await pd.makeRequest("/accounts", {
-  method: "GET"
-  headers: {
-    "Authorization": await this.oauthAuthorizationHeader(), // Automatically uses a fresh token
-  },
-  params: {
-    include_credentials: 1,
-  }
-});
+// Or make any Pipedream API request with the fresh token
+try {
+  const accounts = await pd.makeRequest("/accounts", {
+    method: "GET",
+    headers: {
+      "Authorization": await pd.oauthAuthorizationHeader(), // Automatically uses a fresh token
+    },
+    params: {
+      include_credentials: 1,
+    }
+  });
+  console.log('Accounts retrieved:', accounts);
+} catch (error) {
+  console.error('Error fetching accounts:', error);
+}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
```javascript
import { createBackendClient } from "@pipedream/sdk";
// These secrets should be saved securely and passed to your environment
const pd = createBackendClient({
credentials: {
clientId: "YOUR_CLIENT_ID",
clientSecret: "YOUR_CLIENT_SECRET",
},
});
// Use the SDK's helper methods to make requests
const accounts = await pd.getAccounts({ include_credentials: 1 });
// Or make any Pipedream API request with the fresh token
const accounts = await pd.makeRequest("/accounts", {
method: "GET"
headers: {
"Authorization": await this.oauthAuthorizationHeader(), // Automatically uses a fresh token
},
params: {
include_credentials: 1,
}
});
```
```javascript
import { createBackendClient } from "@pipedream/sdk";
// These secrets should be saved securely and passed to your environment
const pd = createBackendClient({
credentials: {
clientId: "YOUR_CLIENT_ID",
clientSecret: "YOUR_CLIENT_SECRET",
},
});
// Use the SDK's helper methods to make requests
try {
const accounts = await pd.getAccounts({ include_credentials: 1 });
console.log('Accounts retrieved:', accounts);
} catch (error) {
console.error('Error fetching accounts:', error);
}
// Or make any Pipedream API request with the fresh token
try {
const accounts = await pd.makeRequest("/accounts", {
method: "GET",
headers: {
"Authorization": await pd.oauthAuthorizationHeader(), // Automatically uses a fresh token
},
params: {
include_credentials: 1,
}
});
console.log('Accounts retrieved:', accounts);
} catch (error) {
console.error('Error fetching accounts:', error);
}
```

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

🧹 Outside diff range and nitpick comments (3)
docs-v2/pages/connect/quickstart.mdx (3)

50-53: Add security recommendations for credential handling.

While the environment variables are correctly defined, consider adding these security recommendations:

  1. Use a secure secrets manager in production
  2. Rotate client secrets periodically
  3. Never commit .env files to version control

Line range hint 122-141: Consider adding TypeScript type annotations.

The frontend code example could benefit from explicit type annotations for better maintainability and developer experience:

-function connectAccount() {
+interface ConnectAccountParams {
+  app: string;
+  oauthAppId?: string;
+  token: string;
+  onSuccess: (response: { id: string }) => void;
+}

+function connectAccount(): void {

Line range hint 183-190: Enhance type safety and security warning.

  1. Add return type and error handling:
-async function getUserAccounts(external_user_id: string, include_credentials: boolean = false) {
+async function getUserAccounts(external_user_id: string, include_credentials: boolean = false): Promise<Account[]> {
+  try {
     await pd.getAccounts({
       external_user_id,
       include_credentials,
     })
+  } catch (error) {
+    console.error('Failed to retrieve accounts:', error);
+    throw new Error('Unable to retrieve user accounts');
+  }
  1. Consider adding a more prominent security warning using the Callout component:
+<Callout type="warning">
+Never return raw credentials to the client. Always process and store credentials securely on your backend.
+</Callout>

Also applies to: 207-214

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 6e1d464 and d5df964.

📒 Files selected for processing (1)
  • docs-v2/pages/connect/quickstart.mdx (7 hunks)
🧰 Additional context used
🪛 LanguageTool
docs-v2/pages/connect/quickstart.mdx

[grammar] ~77-~77: The verb “generate” needs to be in the to-infinitive form.
Context: ...ount connections for your users, you'll need generate a short-lived token for your users and ...

(MISSING_TO_BEFORE_A_VERB)

🔇 Additional comments (2)
docs-v2/pages/connect/quickstart.mdx (2)

8-8: LGTM! Clear and accurate introduction.

The updated introduction and architectural overview provide clear, accurate information about Pipedream Connect's capabilities and integration points.

Also applies to: 17-17


Line range hint 219-222: LGTM! Clear deployment guidance.

The deployment section effectively directs users to relevant documentation for production deployment.

```
</Tabs.Tab>
</Tabs>
To securely initiate account connections for your users, you'll need generate a short-lived token for your users and use that in the [account connection flow](#connect-a-users-account). See [the docs on Connect tokens](/connect/tokens) for a general overview of why we need to create tokens and scope them to end users.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix grammar in the sentence.

Change "you'll need generate" to "you'll need to generate".

🧰 Tools
🪛 LanguageTool

[grammar] ~77-~77: The verb “generate” needs to be in the to-infinitive form.
Context: ...ount connections for your users, you'll need generate a short-lived token for your users and ...

(MISSING_TO_BEFORE_A_VERB)

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

🧹 Outside diff range and nitpick comments (2)
docs-v2/pages/connect/migrating-from-project-keys-to-oauth.mdx (2)

13-19: Consider enhancing the changes overview section.

While the current overview is good, it could be more helpful with these improvements:

  1. Group changes by category (Authentication, API Changes, New Features)
  2. Add brief descriptions of new methods (projectInfo, invokeWorkflow)
  3. Consider adding code comparison examples for the renamed methods

Example structure:

 ## What changed
 
+### Authentication
 - In the `0.x` version of the SDK and the original Connect API, you could authenticate with keys scoped to a specific project. In the `1.x` version of the SDK, you need to authenticate with [OAuth clients](/rest-api/auth#oauth).
 
+### API Changes
 - The `createClient` method from both the browser and Node.js SDKs has been replaced with separate methods: `createFrontendClient` and `createBackendClient`, respectively.
 - The `connectTokenCreate` method has been renamed `createConnectToken`
 
+### New Features
+- `projectInfo`: Retrieve information about your Pipedream project
+- `invokeWorkflow`: Programmatically trigger workflow executions

79-85: Add security best practices for credential handling.

The comment about secrets being "saved securely" could be more specific. Consider adding guidance about:

  • Using a secure secrets management service
  • Avoiding hardcoding credentials in code
  • Implementing credential rotation
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between d5df964 and ce0bdeb.

📒 Files selected for processing (2)
  • docs-v2/pages/connect/_meta.json (1 hunks)
  • docs-v2/pages/connect/migrating-from-project-keys-to-oauth.mdx (1 hunks)
🧰 Additional context used
🪛 LanguageTool
docs-v2/pages/connect/migrating-from-project-keys-to-oauth.mdx

[style] ~50-~50: You have already used this phrasing in nearby sentences. Consider using an alternative to add variety to your writing.
Context: ...env.PIPEDREAM_PROJECT_SECRETshould be replaced withprocess.env.PIPEDREAM_OAUTH_CLIENT_SEC...

(REP_REPLACEMENT)

🔇 Additional comments (2)
docs-v2/pages/connect/_meta.json (1)

28-30: LGTM! Verify related documentation files.

The addition of the hidden migration guide entry is well-structured and follows good documentation practices. The hidden display property is appropriate for migration documentation that should be accessible but not prominently displayed in navigation.

Let's verify the existence and structure of the related documentation files mentioned in the summary:

✅ Verification successful

Migration guide and API documentation are properly linked

The verification confirms that:

  • The migration guide file exists and contains the expected client-related content
  • The API documentation includes OAuth-related information
  • Both files are correctly placed in the docs-v2/pages/connect/ directory
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence and basic structure of related documentation files

# Check if the migration guide file exists and contains expected content
echo "Checking migration guide..."
rg -l "createFrontendClient|createBackendClient|createConnectToken" "docs-v2/pages/connect/migrating-from-project-keys-to-oauth.mdx"

# Check if the API documentation contains the OAuth section
echo "Checking API documentation..."
rg -l "OAuth" "docs-v2/pages/connect/api.mdx"

Length of output: 403

docs-v2/pages/connect/migrating-from-project-keys-to-oauth.mdx (1)

1-11: LGTM! Clear and well-structured introduction.

The prerequisites are specific and help users quickly determine if this migration guide applies to them.

Comment on lines +61 to +64
```typescript
import { createFrontendClient } from "@pipedream/sdk"
const pd = createFrontendClient()
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Consider adding error handling to code examples.

The client initialization examples should demonstrate proper error handling:

try {
  const pd = createFrontendClient()
  // Verify client initialization
  await pd.projectInfo()
  console.log("Client initialized successfully")
} catch (error) {
  console.error("Failed to initialize client:", error)
  // Handle initialization failure
}

Also applies to: 89-99

Comment on lines +20 to +102
## How to migrate

<Steps>

### Create an OAuth client

Follow the instructions [here](/rest-api/auth#oauth) to create an OAuth client.

### Update your SDK version

Change the `@pipedream/sdk` version in your `package.json`:

```json
{
"dependencies": {
"@pipedream/sdk": "1.0.0"
}
}
```

Then run

```bash
npm install
```

### Update your project key references to use your OAuth client

You may have been referencing project keys in environment variables or other config. Replace these with references to the OAuth client you created in step 1.

For example, `process.env.PIPEDREAM_PROJECT_KEY` should be replaced with `process.env.PIPEDREAM_OAUTH_CLIENT_ID`, and `process.env.PIPEDREAM_PROJECT_SECRET` should be replaced with `process.env.PIPEDREAM_OAUTH_CLIENT_SECRET`.

### Update your SDK code

#### Frontend client

You'll need to make two changes to your frontend client code:

1. Replace references to `@pipedream/sdk/browser`. Instead, import directly from `@pipedream/sdk`.
2. Change the `createClient` method to `createFrontendClient`.

```typescript
import { createFrontendClient } from "@pipedream/sdk"
const pd = createFrontendClient()
```

#### Backend client

You'll need to make three changes to your backend code:

1. Change the `createClient` method to `createBackendClient`.
2. Pass your OAuth client ID and secret to the `createBackendClient` method, removing references to project keys.
3. Change any token create method references from `connectTokenCreate` to `createConnectToken`.

<Tabs items={['TypeScript', 'Node.js']}>
<Tabs.Tab>
```typescript
import { createBackendClient, HTTPAuthType } from "@pipedream/sdk";

// These secrets should be saved securely and passed to your environment
const pd = createBackendClient({
credentials: {
clientId: "YOUR_CLIENT_ID",
clientSecret: "YOUR_CLIENT_SECRET",
},
});
```
</Tabs.Tab>
<Tabs.Tab>
```javascript
import { createBackendClient } from "@pipedream/sdk";

// These secrets should be saved securely and passed to your environment
const pd = createBackendClient({
credentials: {
clientId: "YOUR_CLIENT_ID",
clientSecret: "YOUR_CLIENT_SECRET",
},
});
```
</Tabs.Tab>
</Tabs>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Based on the gathered information, I can now generate the final response since I've found that:

  1. The current SDK version is 0.1.9 in both the main package and docs
  2. The migration guide references version 1.0.0 which doesn't exist yet
  3. There's no changelog available to reference version compatibility

Migration guide references non-existent SDK version and lacks critical information

The migration guide references version 1.0.0 of @pipedream/sdk, but the latest version is 0.1.9. Additionally, the guide lacks essential information for a safe migration:

  • The target version (1.0.0) doesn't exist in the repository
  • No version compatibility information is provided
  • No rollback steps are documented
  • No testing guidance is included

Please update the guide to:

  • Reference the correct SDK version (0.1.9)
  • Add a compatibility matrix for different SDK versions
  • Include rollback instructions
  • Add testing recommendations
  • Document common migration issues and solutions
🔗 Analysis chain

Add rollback instructions and version compatibility information.

Consider adding:

  1. Version compatibility matrix
  2. Instructions for rolling back if migration fails
  3. Common troubleshooting steps
  4. Testing recommendations before full migration

Let me help verify the SDK version compatibility:


Based on the script results, I can see that the current SDK version in the repository is 0.1.9, but the migration guide references version 1.0.0. Let me verify the changelog or release information to understand the version compatibility better.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check package.json files in the repository for @pipedream/sdk version references
rg -l '"@pipedream/sdk"' | while read -r file; do
  echo "=== $file ==="
  cat "$file" | grep -A 5 '"@pipedream/sdk"'
done

Length of output: 7401


Script:

#!/bin/bash
# Check for CHANGELOG.md or similar files
fd -i changelog
fd -i release

# Also check package.json for any version-related scripts or notes
cat packages/sdk/package.json

# Look for any migration-related tests or examples
rg -l "migration|upgrade|rollback" -g "!*.lock"

Length of output: 3492

🧰 Tools
🪛 LanguageTool

[style] ~50-~50: You have already used this phrasing in nearby sentences. Consider using an alternative to add variety to your writing.
Context: ...env.PIPEDREAM_PROJECT_SECRETshould be replaced withprocess.env.PIPEDREAM_OAUTH_CLIENT_SEC...

(REP_REPLACEMENT)

@dylburger dylburger merged commit 97b820e into master Nov 4, 2024
11 of 12 checks passed
@dylburger dylburger deleted the connect/workflow-sdk-docs branch November 4, 2024 21:28
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.

2 participants