-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Implement comprehensive Trustpilot webhooks and review management #17613
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
Open
seynadio
wants to merge
5
commits into
PipedreamHQ:master
Choose a base branch
from
seynadio:trustpilot-webhooks-and-reviews
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,967
−8
Open
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
47cee75
Implement comprehensive Trustpilot integration with polling sources
seynadio 404d68f
Apply patches: Update pnpm-lock.yaml and fix security vulnerabilities…
Afstkla c685925
Address PR feedback: Update dependencies, improve code quality, and f…
Afstkla a75316b
Fix CI/CD failures: bump component version, update lockfile, fix Type…
Afstkla e53b455
typescript issues
Afstkla File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
*.js | ||
*.mjs | ||
dist |
40 changes: 40 additions & 0 deletions
40
components/trustpilot/actions/fetch-product-review-by-id/fetch-product-review-by-id.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import trustpilot from "../../app/trustpilot.app.ts"; | ||
|
||
export default { | ||
key: "trustpilot-fetch-product-review-by-id", | ||
name: "Fetch Product Review by ID", | ||
description: "Retrieves detailed information about a specific product review on Trustpilot. Use this action to get comprehensive data about a single product review, including customer feedback, star rating, review text, and metadata. Perfect for analyzing individual customer experiences, responding to specific feedback, or integrating review data into your customer service workflows. [See the documentation](https://developers.trustpilot.com/product-reviews-api#get-private-product-review)", | ||
version: "0.0.1", | ||
publishedAt: "2025-07-18T00:00:00.000Z", | ||
type: "action", | ||
props: { | ||
trustpilot, | ||
reviewId: { | ||
propDefinition: [ | ||
trustpilot, | ||
"reviewId", | ||
], | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const { reviewId } = this; | ||
|
||
try { | ||
const review = await this.trustpilot.getProductReviewById({ | ||
reviewId, | ||
}); | ||
|
||
$.export("$summary", `Successfully fetched product review ${reviewId}`); | ||
|
||
return { | ||
review, | ||
metadata: { | ||
reviewId, | ||
requestTime: new Date().toISOString(), | ||
}, | ||
}; | ||
} catch (error) { | ||
throw new Error(`Failed to fetch product review: ${error.message}`); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ideally we shouldn't be try/catching here, because |
||
} | ||
}, | ||
}; |
112 changes: 112 additions & 0 deletions
112
components/trustpilot/actions/fetch-product-reviews/fetch-product-reviews.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
import trustpilot from "../../app/trustpilot.app.ts"; | ||
|
||
export default { | ||
key: "trustpilot-fetch-product-reviews", | ||
name: "Fetch Product Reviews", | ||
description: "Retrieves a list of product reviews for a specific business unit on Trustpilot. This action enables you to fetch multiple product reviews with powerful filtering options including star ratings, language, tags, and sorting preferences. Ideal for monitoring product feedback trends, generating reports, analyzing customer sentiment across your product catalog, or building review dashboards. Supports pagination for handling large review volumes. [See the documentation](https://developers.trustpilot.com/product-reviews-api#get-private-product-reviews)", | ||
version: "0.0.1", | ||
publishedAt: "2025-07-18T00:00:00.000Z", | ||
type: "action", | ||
props: { | ||
trustpilot, | ||
businessUnitId: { | ||
propDefinition: [ | ||
trustpilot, | ||
"businessUnitId", | ||
], | ||
}, | ||
stars: { | ||
propDefinition: [ | ||
trustpilot, | ||
"stars", | ||
], | ||
}, | ||
sortBy: { | ||
propDefinition: [ | ||
trustpilot, | ||
"sortBy", | ||
], | ||
}, | ||
limit: { | ||
propDefinition: [ | ||
trustpilot, | ||
"limit", | ||
], | ||
}, | ||
includeReportedReviews: { | ||
propDefinition: [ | ||
trustpilot, | ||
"includeReportedReviews", | ||
], | ||
}, | ||
tags: { | ||
propDefinition: [ | ||
trustpilot, | ||
"tags", | ||
], | ||
}, | ||
language: { | ||
propDefinition: [ | ||
trustpilot, | ||
"language", | ||
], | ||
}, | ||
offset: { | ||
type: "integer", | ||
label: "Offset", | ||
description: "Number of results to skip (for pagination)", | ||
min: 0, | ||
default: 0, | ||
optional: true, | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const { | ||
businessUnitId, | ||
stars, | ||
sortBy, | ||
limit, | ||
includeReportedReviews, | ||
tags, | ||
language, | ||
offset, | ||
} = this; | ||
|
||
try { | ||
const result = await this.trustpilot.getProductReviews({ | ||
businessUnitId, | ||
stars, | ||
sortBy, | ||
limit, | ||
includeReportedReviews, | ||
tags, | ||
language, | ||
offset, | ||
}); | ||
|
||
const { | ||
reviews, pagination, | ||
} = result; | ||
|
||
$.export("$summary", `Successfully fetched ${reviews.length} product review(s) for business unit ${businessUnitId}`); | ||
|
||
return { | ||
reviews, | ||
pagination, | ||
metadata: { | ||
businessUnitId, | ||
filters: { | ||
stars, | ||
sortBy, | ||
includeReportedReviews, | ||
tags, | ||
language, | ||
}, | ||
requestTime: new Date().toISOString(), | ||
}, | ||
}; | ||
} catch (error) { | ||
throw new Error(`Failed to fetch product reviews: ${error.message}`); | ||
} | ||
}, | ||
}; |
51 changes: 51 additions & 0 deletions
51
components/trustpilot/actions/fetch-service-review-by-id/fetch-service-review-by-id.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import trustpilot from "../../app/trustpilot.app.ts"; | ||
|
||
export default { | ||
key: "trustpilot-fetch-service-review-by-id", | ||
name: "Fetch Service Review by ID", | ||
description: "Retrieves detailed information about a specific service review for your business on Trustpilot. Use this action to access comprehensive data about an individual service review, including the customer's rating, review content, date, and any responses. Essential for customer service teams to analyze specific feedback, track review history, or integrate individual review data into CRM systems and support tickets. [See the documentation](https://developers.trustpilot.com/business-units-api#get-business-unit-review)", | ||
version: "0.0.1", | ||
publishedAt: "2025-07-18T00:00:00.000Z", | ||
type: "action", | ||
props: { | ||
trustpilot, | ||
businessUnitId: { | ||
propDefinition: [ | ||
trustpilot, | ||
"businessUnitId", | ||
], | ||
}, | ||
reviewId: { | ||
propDefinition: [ | ||
trustpilot, | ||
"reviewId", | ||
], | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const { | ||
businessUnitId, | ||
reviewId, | ||
} = this; | ||
|
||
try { | ||
const review = await this.trustpilot.getServiceReviewById({ | ||
businessUnitId, | ||
reviewId, | ||
}); | ||
|
||
$.export("$summary", `Successfully fetched service review ${reviewId} for business unit ${businessUnitId}`); | ||
|
||
return { | ||
review, | ||
metadata: { | ||
businessUnitId, | ||
reviewId, | ||
requestTime: new Date().toISOString(), | ||
}, | ||
}; | ||
} catch (error) { | ||
throw new Error(`Failed to fetch service review: ${error.message}`); | ||
} | ||
}, | ||
}; |
112 changes: 112 additions & 0 deletions
112
components/trustpilot/actions/fetch-service-reviews/fetch-service-reviews.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
import trustpilot from "../../app/trustpilot.app.ts"; | ||
|
||
export default { | ||
key: "trustpilot-fetch-service-reviews", | ||
name: "Fetch Service Reviews", | ||
description: "Fetches service reviews for a specific business unit from Trustpilot with support for filtering by star rating, tags, language, and more. [See the documentation](https://developers.trustpilot.com/business-units-api#get-business-unit-reviews)", | ||
version: "0.0.1", | ||
type: "action", | ||
publishedAt: "2025-07-18T00:00:00.000Z", | ||
props: { | ||
trustpilot, | ||
businessUnitId: { | ||
propDefinition: [ | ||
trustpilot, | ||
"businessUnitId", | ||
], | ||
}, | ||
stars: { | ||
propDefinition: [ | ||
trustpilot, | ||
"stars", | ||
], | ||
}, | ||
sortBy: { | ||
propDefinition: [ | ||
trustpilot, | ||
"sortBy", | ||
], | ||
}, | ||
limit: { | ||
propDefinition: [ | ||
trustpilot, | ||
"limit", | ||
], | ||
}, | ||
includeReportedReviews: { | ||
propDefinition: [ | ||
trustpilot, | ||
"includeReportedReviews", | ||
], | ||
}, | ||
tags: { | ||
propDefinition: [ | ||
trustpilot, | ||
"tags", | ||
], | ||
}, | ||
language: { | ||
propDefinition: [ | ||
trustpilot, | ||
"language", | ||
], | ||
}, | ||
offset: { | ||
type: "integer", | ||
label: "Offset", | ||
description: "Number of results to skip (for pagination)", | ||
min: 0, | ||
default: 0, | ||
optional: true, | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const { | ||
businessUnitId, | ||
stars, | ||
sortBy, | ||
limit, | ||
includeReportedReviews, | ||
tags, | ||
language, | ||
offset, | ||
} = this; | ||
|
||
try { | ||
const result = await this.trustpilot.getServiceReviews({ | ||
businessUnitId, | ||
stars, | ||
sortBy, | ||
limit, | ||
includeReportedReviews, | ||
tags, | ||
language, | ||
offset, | ||
}); | ||
|
||
const { | ||
reviews, pagination, | ||
} = result; | ||
|
||
$.export("$summary", `Successfully fetched ${reviews.length} service review(s) for business unit ${businessUnitId}`); | ||
|
||
return { | ||
reviews, | ||
pagination, | ||
metadata: { | ||
businessUnitId, | ||
filters: { | ||
stars, | ||
sortBy, | ||
includeReportedReviews, | ||
tags, | ||
language, | ||
}, | ||
requestTime: new Date().toISOString(), | ||
}, | ||
}; | ||
} catch (error) { | ||
throw new Error(`Failed to fetch service reviews: ${error.message}`); | ||
} | ||
}, | ||
}; |
55 changes: 55 additions & 0 deletions
55
components/trustpilot/actions/reply-to-product-review/reply-to-product-review.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import trustpilot from "../../app/trustpilot.app.ts"; | ||
|
||
export default { | ||
key: "trustpilot-reply-to-product-review", | ||
name: "Reply to Product Review", | ||
description: "Posts a public reply to a product review on Trustpilot on behalf of your business. This action allows you to respond to customer feedback, address concerns, thank customers for positive reviews, or provide additional information about products. Replies help demonstrate your commitment to customer satisfaction and can improve your overall reputation. Note that replies are publicly visible and cannot be edited once posted. [See the documentation](https://developers.trustpilot.com/product-reviews-api#reply-to-product-review)", | ||
version: "0.0.1", | ||
publishedAt: "2025-07-18T00:00:00.000Z", | ||
type: "action", | ||
props: { | ||
trustpilot, | ||
reviewId: { | ||
propDefinition: [ | ||
trustpilot, | ||
"reviewId", | ||
], | ||
}, | ||
message: { | ||
type: "string", | ||
label: "Reply Message", | ||
description: "The message to reply to the review with", | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const { | ||
reviewId, | ||
message, | ||
} = this; | ||
|
||
if (!message || message.trim().length === 0) { | ||
throw new Error("Reply message cannot be empty"); | ||
} | ||
|
||
try { | ||
const result = await this.trustpilot.replyToProductReview({ | ||
reviewId, | ||
message: message.trim(), | ||
}); | ||
|
||
$.export("$summary", `Successfully replied to product review ${reviewId}`); | ||
|
||
return { | ||
success: true, | ||
reply: result, | ||
metadata: { | ||
reviewId, | ||
messageLength: message.trim().length, | ||
requestTime: new Date().toISOString(), | ||
}, | ||
}; | ||
} catch (error) { | ||
throw new Error(`Failed to reply to product review: ${error.message}`); | ||
} | ||
}, | ||
}; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
We should remove the 'publishedAt' line from all the components that have it