-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[Components] Create Blog Post - WIX #15954
base: master
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ |
WalkthroughThis pull request updates several Wix API integration modules by incrementing their version numbers from "0.0.1" to "0.0.2". A new module for creating draft posts has been introduced with complete API request and response handling. The package manifest has been updated to version "0.2.0" along with a dependency upgrade for Changes
Sequence Diagram(s)sequenceDiagram
participant Client as Client
participant DraftPost as CreateDraftPost Module
participant WixAPI as Wix API Endpoint
Client->>DraftPost: invoke run() with post details
DraftPost->>WixAPI: POST request to create draft post
WixAPI-->>DraftPost: Response (post ID and details)
DraftPost->>Client: Return summary message and full response
Assessment against linked issues
Suggested reviewers
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure. 🔧 ESLint
components/wix_api_key/actions/add-products-to-collection/add-products-to-collection.mjsOops! Something went wrong! :( ESLint: 8.57.1 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs components/wix_api_key/actions/create-draft-post/create-draft-post.mjsOops! Something went wrong! :( ESLint: 8.57.1 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs components/wix_api_key/actions/create-contact/create-contact.mjsOops! Something went wrong! :( ESLint: 8.57.1 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs
Tip ⚡🧪 Multi-step agentic review comment chat (experimental)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
components/wix_api_key/actions/create-draft-post/create-draft-post.mjs (1)
7-7
: Consider version consistency.The version is set to 0.0.1, but other components in this PR have been updated to 0.0.2. Consider whether this should also start at 0.0.2 for consistency.
- version: "0.0.1", + version: "0.0.2",
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (10)
components/wix_api_key/actions/add-products-to-collection/add-products-to-collection.mjs
(1 hunks)components/wix_api_key/actions/create-contact/create-contact.mjs
(1 hunks)components/wix_api_key/actions/create-draft-post/create-draft-post.mjs
(1 hunks)components/wix_api_key/actions/create-product/create-product.mjs
(1 hunks)components/wix_api_key/actions/get-contact/get-contact.mjs
(1 hunks)components/wix_api_key/package.json
(2 hunks)components/wix_api_key/sources/new-member-registered/new-member-registered.mjs
(1 hunks)components/wix_api_key/sources/new-order-created/new-order-created.mjs
(1 hunks)components/wix_api_key/sources/new-product-created/new-product-created.mjs
(1 hunks)components/wix_api_key/wix_api_key.app.mjs
(3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Publish TypeScript components
- GitHub Check: pnpm publish
- GitHub Check: Verify TypeScript components
🔇 Additional comments (22)
components/wix_api_key/actions/create-product/create-product.mjs (1)
7-7
: Version Update Consistency.
The version field has been incremented to "0.0.2", which keeps this module in line with the other Wix API integration modules and the overall package version update.components/wix_api_key/actions/create-contact/create-contact.mjs (1)
7-7
: Consistent Version Increment.
The update from "0.0.1" to "0.0.2" for the version property is straightforward and aligns with the other files in this component. No further changes are necessary.components/wix_api_key/actions/add-products-to-collection/add-products-to-collection.mjs (1)
7-7
: Maintaining Version Uniformity.
Updating the version field to "0.0.2" ensures uniformity across the different Wix action modules. The change is simple and effective.components/wix_api_key/sources/new-product-created/new-product-created.mjs (1)
9-9
: Version Update Verification.
The version property has been updated to "0.0.2". The rest of the code, including integration with common methods and constants, remains unchanged and correctly structured.components/wix_api_key/sources/new-member-registered/new-member-registered.mjs (1)
9-9
: Uniform Versioning Achieved.
The version field update to "0.0.2" aligns this source module with the overall upgrade. The changes are minimal and correctly implemented.components/wix_api_key/sources/new-order-created/new-order-created.mjs (1)
9-9
: Version bump from 0.0.1 to 0.0.2 looks good.This version update is consistent with the coordinated versioning effort across multiple Wix components in this PR.
components/wix_api_key/actions/get-contact/get-contact.mjs (1)
7-7
: Version bump from 0.0.1 to 0.0.2 looks good.This version update aligns with the coordinated versioning effort across the Wix API components.
components/wix_api_key/package.json (2)
3-3
: Package version update to 0.2.0 matches the scope of changes.The minor version bump (0.1.0 → 0.2.0) appropriately reflects the addition of the new "Create Draft Post" action and the coordinated component version updates.
16-16
:❓ Verification inconclusive
Significant dependency update.
The dependency on
@pipedream/platform
has been updated from ^1.5.1 to ^3.0.3, which is a major version jump. Ensure all components are compatible with this new version.
🏁 Script executed:
#!/bin/bash # Check for any breaking changes that might affect existing components echo "Checking for any imports of potentially removed/changed features from @pipedream/platform..." grep -r "from \"@pipedream/platform\"" --include="*.mjs" components/wix_api_key/ grep -r "require(\"@pipedream/platform\")" --include="*.js" components/wix_api_key/Length of output: 526
Major Dependency Update – Compatibility Verification Required
The dependency on
@pipedream/platform
has been updated from^1.5.1
to^3.0.3
, representing a major version jump. We found that the updated dependency is imported in two locations:
- components/wix_api_key/wix_api_key.app.mjs: Imports
{ axios }
from@pipedream/platform
.- components/wix_api_key/sources/common/common.mjs: Contains an import from
@pipedream/platform
.Given the significant version bump, please verify that these components are fully compatible with v3.0.3. This might involve reviewing the official migration guide or performing additional testing to ensure that no breaking API changes affect the current functionality.
components/wix_api_key/actions/create-draft-post/create-draft-post.mjs (5)
1-7
: Well-structured new action component.The component header and metadata are well-defined with appropriate documentation links.
9-112
: Props are comprehensive and well-documented.The component includes a thorough set of props with appropriate types, labels, and descriptions. The use of propDefinitions for related entities (categoryId, memberId, tagId, postId) demonstrates good reuse of existing definitions.
113-121
: API request method is properly encapsulated.The
createDraftPost
method follows the pattern used in other components, leveraging the app's_makeRequest
method with appropriate endpoint configuration.
122-159
: Well-implemented run method.The run method effectively:
- Destructures all necessary props
- Organizes data in the expected API structure
- Provides a clear success message with the created draft post ID
- Returns the complete response
138-155
:❓ Verification inconclusive
Verify Wix API endpoint structure.
The request structure looks good, but it's always helpful to verify against the latest Wix API documentation to ensure all required fields are included and formatted correctly.
🌐 Web query:
Wix Blog API draft-posts endpoint structure and required fields
💡 Result:
To create and manage draft blog posts using the Wix Blog API, you'll use the
/blog/v3/draft-posts
endpoints. Here's the essential structure and requirements:Draft Post Creation Structure
Send a POST request to
https://www.wixapis.com/blog/v3/draft-posts
with these components:{ "draftPost": { "title": "Your Post Title", "contentId": "auto-generated", "memberId": "REQUIRED_MEMBER_ID", "language": "en", "featured": false, "contentData": { "nodes": [ { "type": "PARAGRAPH", "textData": { "text": "Your content here..." } } ] } } }Required Fields
title
: Post title (string).memberId
: ID of the author (string)[1][18].Key Optional Fields
contentData
: Rich-text content using Wix's structured node system (e.g.,PARAGRAPH
,IMAGE
,HEADING
)[6].featured
: Boolean for featured status (default:false
).language
: ISO language code (default:en
).
Common Endpoints
Endpoint Method Description /draft-posts
POST Creates a draft post[1][18]. /draft-posts/{id}/publish
POST Publishes a draft post[7]. /draft-posts
GET Lists up to 100 drafts (sorted by editedDate
descending)[16].
Troubleshooting
HTTP 400 Errors:
- Ensure
fieldsToInclude
in GET requests uses a single value (e.g.,RICH_CONTENT
orCONTENT
)[2][4].- Validate node structures for
contentData
(e.g.,IMAGE
nodes requireimageData.src.url
)[6].Authorization: Include API key in headers[1]:
Authorization: YOUR_API_KEY Content-Type: application/jsonFor advanced content formatting, refer to Wix's unstructured documentation on node types, and use community examples as guidance[6].
Citations:
- 1: https://community.activepieces.com/t/creating-connection-api-wix-com-and-active-pieces/816
- 2: https://forum.wixstudio.com/t/rest-api-for-blog-post-content/41800
- 3: https://dev.wix.com/docs/rest/business-solutions/blog/draft-posts/query-draft-posts
- 4: https://forum.wixstudio.com/t/get-draft-post-rest-api-cant-get-rich-content-400-bad-request/54447
- 5: https://dev.wix.com/docs/velo/apis/wix-blog-backend/draft-posts/create-draft-post
- 6: https://forum.wixstudio.com/t/clarification-needed-on-draft-node-types-and-subtypes-in-dev-rest-api-wix-documentation/55621
- 7: https://dev.wix.com/docs/rest/business-solutions/blog/draft-posts/publish-draft-post
- 8: https://dev.wix.com/docs/velo/apis/wix-blog-backend/draft-posts/draft-posts-query-builder/eq
- 9: https://dev.wix.com/docs/rest/articles/what-s-new/release-notes
- 10: https://dev.wix.com/docs/velo/apis/wix-blog-backend/draft-posts/introduction
- 11: https://dev.wix.com/docs/velo/apis/wix-blog-backend/draft-posts/list-draft-posts
- 12: https://dev.wix.com/docs/velo/articles/release-notes/release-notes
- 13: https://dev.wix.com/docs/rest/business-solutions/blog/draft-posts/draft-post-created
- 14: https://dev.wix.com/docs/velo/apis/wix-blog-backend/draft-posts/bulk-create-draft-posts
- 15: https://dev.wix.com/docs/graphql
- 16: https://dev.wix.com/docs/rest/business-solutions/blog/draft-posts/list-draft-posts
- 17: https://dev.wix.com/docs/velo/apis/wix-blog-backend/draft-posts
- 18: https://dev.wix.com/docs/rest/business-solutions/blog/draft-posts/create-draft-post
- 19: https://community.zapier.com/code-webhooks-52/automated-upload-of-blog-article-to-wix-website-using-webhooks-37398
Action: Confirm Field Mapping Against Wix API Documentation
The request structure in this file appears correct at a glance since it includes the essential fields (
title
,memberId
,language
, etc.). However, based on the latest Wix Blog API documentation for the draft-posts endpoint, please verify that:
- Any additional fields (e.g.,
categoryIds
,hashtags
,commentingEnabled
,tagIds
, andrelatedPostIds
) are intentionally included and properly mapped by your integration. These are not standard per the Wix API sample, which focuses on fields liketitle
,memberId
, and optionallycontentData
.- If rich content is expected for the draft post, ensure that the absence of a
contentData
property is acceptable within your use case.- Confirm that the extra parameters (
publish
,fieldsets
) are transformed as needed before the request is sent to Wix.Overall, the code is clear, but please manually verify that the custom fields align with your backend processing logic and the Wix API requirements.
components/wix_api_key/wix_api_key.app.mjs (8)
136-156
: LGTM - Good implementation of the categoryId propertyThe implementation follows the established pattern in the codebase for defining properties with options that fetch data from the API. The pagination logic is properly implemented, and the mapping of category objects to value-label pairs is clean.
157-177
: LGTM - Well-structured memberId property definitionThis property definition correctly implements fetching members and mapping them to appropriate value-label pairs. The use of optional chaining in the mapping function helps prevent errors when dealing with potentially undefined values.
178-202
: LGTM - Proper implementation of tagId propertyThe tagId implementation correctly uses the queryTags method with appropriate pagination. The structure is consistent with other property definitions in the file.
203-236
: LGTM - Well-implemented postId property with search capabilityThe postId property implementation includes a nice added feature with the useQuery flag and filter implementation, allowing for searching posts by title. The pagination and mapping are properly implemented.
249-253
: LGTM - Improved getSiteHeaders methodThe update to getSiteHeaders now properly handles the case when no siteId is provided, returning just the wix-account-id. This is a good improvement that maintains backward compatibility.
342-347
: LGTM - Clean implementation of the listCategories methodThe listCategories method follows the established pattern in the codebase and correctly leverages the _makeRequest method.
348-354
: LGTM - Properly implemented queryTags methodThe queryTags method correctly uses POST for the API request and follows the same pattern as other query methods in the file.
355-361
: LGTM - Well-structured queryPosts methodThe queryPosts method is correctly implemented with appropriate HTTP method and path. The implementation is consistent with other methods in the file.
WHY
Resolves #15782
Summary by CodeRabbit
New Features
Chores