-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Google Business new components #18074
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
Merged
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
a4e13df
package version bump
GTFalcao 067c384
Adding new google my business actions
GTFalcao 08e96ef
Fixing entity format
GTFalcao 116ada9
Merge branch 'master' into 17821-google-business-new-components
GTFalcao 76d7e2b
Creating source
GTFalcao f16d7eb
pnpm
GTFalcao 0dcedf7
Version bumps
GTFalcao f0894d3
Adjusting some things
GTFalcao ac78af4
ESLint run
GTFalcao 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
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
84 changes: 84 additions & 0 deletions
84
...ogle_my_business/actions/get-reviews-multiple-locations/get-reviews-multiple-locations.ts
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,84 @@ | ||
| import { defineAction } from "@pipedream/types"; | ||
| import app from "../../app/google_my_business.app"; | ||
| import { BatchGetReviewsParams } from "../../common/requestParams"; | ||
|
|
||
| const DOCS_LINK = "https://developers.google.com/my-business/content/review-data#get_reviews_from_multiple_locations"; | ||
|
|
||
| export default defineAction({ | ||
| key: "google_my_business-get-reviews-multiple-locations", | ||
| name: "Get Reviews from Multiple Locations", | ||
| description: `Get reviews from multiple locations at once. [See the documentation](${DOCS_LINK})`, | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| account: { | ||
| propDefinition: [ | ||
| app, | ||
| "account", | ||
| ], | ||
| }, | ||
| locationNames: { | ||
| propDefinition: [ | ||
| app, | ||
| "location", | ||
| ({ account }: { account: string; }) => ({ | ||
| account, | ||
| }), | ||
| ], | ||
| type: "string[]", | ||
| label: "Location Names", | ||
| description: "One or more locations to get reviews from", | ||
| }, | ||
| pageSize: { | ||
| type: "integer", | ||
| label: "Page Size", | ||
| description: "The number of reviews to return per location (max 50)", | ||
| optional: true, | ||
| default: 50, | ||
| min: 1, | ||
| max: 50, | ||
| }, | ||
| orderBy: { | ||
| type: "string", | ||
| label: "Order By", | ||
| description: "How to order the reviews: by createTime or updateTime, and ascending or descending", | ||
| optional: true, | ||
| options: [ | ||
| "createTime desc", | ||
| "createTime asc", | ||
| "updateTime desc", | ||
| "updateTime asc", | ||
| ], | ||
| }, | ||
| ignoreRatingOnlyReviews: { | ||
| type: "boolean", | ||
| label: "Ignore Rating Only Reviews", | ||
| description: "If true, only return reviews that have textual content", | ||
| optional: true, | ||
| default: false, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const { | ||
| account, locationNames, pageSize, orderBy, ignoreRatingOnlyReviews, | ||
| } = this; | ||
|
|
||
| const params: BatchGetReviewsParams = { | ||
| $, | ||
| account, | ||
| data: { | ||
| locationNames: locationNames?.map((locationName: string) => `accounts/${account}/locations/${locationName}`), | ||
| pageSize, | ||
| orderBy, | ||
| ignoreRatingOnlyReviews, | ||
| }, | ||
| }; | ||
|
|
||
| const response = await this.app.batchGetReviews(params); | ||
|
|
||
| $.export("$summary", `Successfully retrieved reviews from ${locationNames.length} locations`); | ||
|
|
||
| return response; | ||
| }, | ||
| }); | ||
61 changes: 61 additions & 0 deletions
61
components/google_my_business/actions/get-specific-review/get-specific-review.ts
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,61 @@ | ||
| import { defineAction } from "@pipedream/types"; | ||
| import app from "../../app/google_my_business.app"; | ||
| import { GetReviewParams } from "../../common/requestParams"; | ||
|
|
||
| const DOCS_LINK = "https://developers.google.com/my-business/content/review-data#get_a_specific_review"; | ||
|
|
||
| export default defineAction({ | ||
| key: "google_my_business-get-specific-review", | ||
| name: "Get a Specific Review", | ||
| description: `Return a specific review by name. [See the documentation](${DOCS_LINK})`, | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| account: { | ||
| propDefinition: [ | ||
| app, | ||
| "account", | ||
| ], | ||
| }, | ||
| location: { | ||
| propDefinition: [ | ||
| app, | ||
| "location", | ||
| ({ account }: { account: string; }) => ({ | ||
| account, | ||
| }), | ||
| ], | ||
| }, | ||
| review: { | ||
| propDefinition: [ | ||
| app, | ||
| "review", | ||
| ({ | ||
| account, location, | ||
| }: Record<string, string>) => ({ | ||
| account, | ||
| location, | ||
| }), | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const { | ||
| account, location, review, | ||
| } = this; | ||
|
|
||
| const params: GetReviewParams = { | ||
| $, | ||
| account, | ||
| location, | ||
| review, | ||
| }; | ||
|
|
||
| const response = await this.app.getReview(params); | ||
|
|
||
| $.export("$summary", `Successfully retrieved review: ${review}`); | ||
|
|
||
| return response; | ||
| }, | ||
| }); |
48 changes: 48 additions & 0 deletions
48
components/google_my_business/actions/list-all-reviews/list-all-reviews.ts
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,48 @@ | ||
| import { defineAction } from "@pipedream/types"; | ||
| import app from "../../app/google_my_business.app"; | ||
| import { ListReviewsParams } from "../../common/requestParams"; | ||
|
|
||
| const DOCS_LINK = "https://developers.google.com/my-business/content/review-data#list_all_reviews"; | ||
|
|
||
| export default defineAction({ | ||
| key: "google_my_business-list-all-reviews", | ||
| name: "List All Reviews", | ||
| description: `List all reviews of a location to audit reviews in bulk. [See the documentation](${DOCS_LINK})`, | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| account: { | ||
| propDefinition: [ | ||
| app, | ||
| "account", | ||
| ], | ||
| }, | ||
| location: { | ||
| propDefinition: [ | ||
| app, | ||
| "location", | ||
| ({ account }: { account: string; }) => ({ | ||
| account, | ||
| }), | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const { | ||
| account, location, | ||
| } = this; | ||
|
|
||
| const params: ListReviewsParams = { | ||
| $, | ||
| account, | ||
| location, | ||
| }; | ||
|
|
||
| const response = await this.app.listReviews(params); | ||
|
|
||
| $.export("$summary", `Successfully listed ${response.length} reviews`); | ||
|
|
||
| return response; | ||
| }, | ||
| }); |
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
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
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
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
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
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
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
63 changes: 63 additions & 0 deletions
63
...ss/sources/new-review-created-multiple-locations/new-review-created-multiple-locations.ts
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,63 @@ | ||
| import { defineSource } from "@pipedream/types"; | ||
| import { BatchGetReviewsParams } from "../../common/requestParams"; | ||
| import { BatchGetReviewsResponse, Review } from "../../common/responseSchemas"; | ||
|
Check failure on line 3 in components/google_my_business/sources/new-review-created-multiple-locations/new-review-created-multiple-locations.ts
|
||
| import app from "../../app/google_my_business.app"; | ||
| import common from "../common"; | ||
|
|
||
| const DOCS_LINK = "https://developers.google.com/my-business/content/review-data#get_reviews_from_multiple_locations"; | ||
|
|
||
| export default defineSource({ | ||
| ...common, | ||
| key: "google_my_business-new-review-created-multiple-locations", | ||
| name: "New Review Created (Multiple Locations)", | ||
| description: `Emit new event for each new review on any of the selected locations [See the documentation](${DOCS_LINK})`, | ||
| version: "0.0.1", | ||
| type: "source", | ||
| dedupe: "unique", | ||
| props: { | ||
| ...common.props, | ||
| location: { | ||
| propDefinition: [ | ||
| app, | ||
| "location", | ||
| ({ account }: { account: string; }) => ({ | ||
| account, | ||
| }), | ||
| ], | ||
| type: "string[]", | ||
| label: "Location Names", | ||
| description: "One or more locations to monitor for new reviews", | ||
| }, | ||
| }, | ||
| hooks: { | ||
| async deploy() { | ||
| await this.getAndProcessData(); | ||
| }, | ||
| }, | ||
| methods: { | ||
| ...common.methods, | ||
| async getItems(): Promise<Review[]> { | ||
| const { | ||
| account, location, | ||
| } = this; | ||
|
|
||
| const params: BatchGetReviewsParams = { | ||
| account, | ||
| data: { | ||
| locationNames: location?.map((locationName: string) => `accounts/${account}/locations/${locationName}`), | ||
| }, | ||
| }; | ||
|
|
||
| const response: BatchGetReviewsResponse = await this.app.batchGetReviews(params); | ||
|
|
||
| return response?.locationReviews?.map((item) => item.review); | ||
| }, | ||
| getSummary({ comment }: Review) { | ||
| return `New Review${comment | ||
| ? `: "${comment.length > 50 | ||
| ? comment.slice(0, 45) + "[...]" | ||
| : comment}"` | ||
| : ""}`; | ||
| }, | ||
| }, | ||
| }); | ||
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
💡 Verification agent
🧩 Analysis chain
Response shape likely needs
reviews: Review[](not singular), and optional fieldsThe Google Business Profile batch endpoint typically returns multiple reviews per location. Current typing (
review: Review) risks runtime issues when mapping in consumers and may drop reviews. Consider supporting both shapes or aligning toreviews: Review[]. Also add trailing semicolons for consistency.If you want to confirm the official schema first:
🌐 Web query:
💡 Result:
The response schema of the Google Business Profile API
batchGetReviewsendpoint consists of a top-level object containing a list calledlocationReviews, with each element representing reviews for a specific location. EachlocationReviewcontains the location's identifier and a singlereviewobject (not a list), with all standard review fields present.Key structure and fields:
Top-level fields in response:
locationReviews: An array of objects, each corresponding to a location and its associated review.nextPageToken: A string for pagination, present if more results are available[1][4][5].Fields under
locationReviews:name: The location resource name (string), e.g.,"accounts/123/locations/456".review: An object containing the review data for the location[1].Example response schema (JSON representation):
{ "locationReviews": [ { "name": "accounts/123/locations/456", "review": { "reviewId": "string", "comment": "string", "reviewer": { /* reviewer info */ }, "starRating": "INTEGER", "createTime": "timestamp", "reviewReply": { "comment": "string", "updateTime": "timestamp" } // ...other review fields } } // ...more locationReview objects ], "nextPageToken": "string" }Important details:
locationReviewsdoes not return a list of reviews per location. Instead, each entry inlocationReviewsrepresents a single review for a location. When requesting reviews for multiple locations, the endpoint returns a flattened list of individual reviews, with each including information about its associated location. You do not get a grouped list like{"location": ..., "reviews": [...]}[1][4].reviewmirror those available in the standard Review object (seeaccounts.locations.reviews.listor.get), including, but not limited to:reviewIdcommentreviewerstarRatingcreateTimereviewReply(optional, may be missing for some reviews)[4][1][3]Summary Table
In summary:
batchGetReviewsresponse does not return a list of reviews per location.locationReviews, each with one review and the associated location name[1][4][5].locationReviewsarenameandreview, withreviewcontaining all standard review data fields.This design allows you to efficiently process reviews across multiple locations in one API call, but grouping reviews by location must be handled client-side if needed[1][4].
Citations:
Align
BatchGetReviewsResponsewith actual API schemaThe
batchGetReviewsendpoint returns a flat list of location reviews—each entry has a singlereviewplus the location’s resource name—and an optional top-levelnextPageToken. There is noreviews: Review[]array per location.Please update your interface accordingly:
• File:
components/google_my_business/common/responseSchemas.ts• Replace existing definition with:
• Add trailing semicolons for consistency.
• Remove any
reviews?: Review[]fields—those are not part of this endpoint’s response.🤖 Prompt for AI Agents