-
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
Merged
michelle0927
merged 15 commits into
PipedreamHQ:master
from
seynadio:trustpilot-webhooks-and-reviews
Jul 28, 2025
Merged
Changes from all commits
Commits
Show all changes
15 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 2111a22
Update components/trustpilot/app/trustpilot.app.ts
Afstkla 5e68182
Update components/trustpilot/app/trustpilot.app.ts
Afstkla c1c55f7
Update trustpilot.app.ts
Afstkla b48d6b5
Rename app
Afstkla e530686
add back app
Afstkla bce521a
ts --> js
Afstkla b770dea
fixes
Afstkla 6046c49
Merge branch 'master' into trustpilot-webhooks-and-reviews
Afstkla c9e9081
delete .gitignore, update package.json
michelle0927 4e811a1
pnpm-lock.yaml
michelle0927 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 was deleted.
Oops, something went wrong.
39 changes: 39 additions & 0 deletions
39
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,39 @@ | ||
import trustpilot from "../../trustpilot.app.mjs"; | ||
|
||
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", | ||
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}`); | ||
} | ||
}, | ||
}; |
111 changes: 111 additions & 0 deletions
111
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,111 @@ | ||
import trustpilot from "../../trustpilot.app.mjs"; | ||
|
||
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", | ||
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}`); | ||
} | ||
}, | ||
}; |
50 changes: 50 additions & 0 deletions
50
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,50 @@ | ||
import trustpilot from "../../trustpilot.app.mjs"; | ||
|
||
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", | ||
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}`); | ||
} | ||
}, | ||
}; |
111 changes: 111 additions & 0 deletions
111
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,111 @@ | ||
import trustpilot from "../../trustpilot.app.mjs"; | ||
|
||
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", | ||
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}`); | ||
} | ||
}, | ||
}; |
51 changes: 51 additions & 0 deletions
51
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,51 @@ | ||
import trustpilot from "../../trustpilot.app.mjs"; | ||
import { ConfigurationError } from "@pipedream/platform"; | ||
|
||
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", | ||
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 ConfigurationError("Reply message cannot be empty"); | ||
} | ||
|
||
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(), | ||
}, | ||
}; | ||
}, | ||
}; |
Oops, something went wrong.
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.
Ideally we shouldn't be try/catching here, because
@pipedream/platform
's axios already handles error responses and emits metadata for the request and response - this would make it harder to debug. The same applies for all components using a try/catch here in the request method