n8n-nodes-google-maps-places-api 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +19 -0
- package/README.md +117 -0
- package/dist/credentials/ApifyApi.credentials.d.ts +10 -0
- package/dist/credentials/ApifyApi.credentials.js +36 -0
- package/dist/credentials/ApifyApi.credentials.js.map +1 -0
- package/dist/credentials/ApifyOAuth2Api.credentials.d.ts +9 -0
- package/dist/credentials/ApifyOAuth2Api.credentials.js +66 -0
- package/dist/credentials/ApifyOAuth2Api.credentials.js.map +1 -0
- package/dist/nodes/ApifyGoogleMapsPlaces/ApifyGoogleMapsPlaces.node.d.ts +13 -0
- package/dist/nodes/ApifyGoogleMapsPlaces/ApifyGoogleMapsPlaces.node.js +82 -0
- package/dist/nodes/ApifyGoogleMapsPlaces/ApifyGoogleMapsPlaces.node.js.map +1 -0
- package/dist/nodes/ApifyGoogleMapsPlaces/ApifyGoogleMapsPlaces.node.json +34 -0
- package/dist/nodes/ApifyGoogleMapsPlaces/ApifyGoogleMapsPlaces.properties.d.ts +3 -0
- package/dist/nodes/ApifyGoogleMapsPlaces/ApifyGoogleMapsPlaces.properties.js +177 -0
- package/dist/nodes/ApifyGoogleMapsPlaces/ApifyGoogleMapsPlaces.properties.js.map +1 -0
- package/dist/nodes/ApifyGoogleMapsPlaces/helpers/executeActor.d.ts +5 -0
- package/dist/nodes/ApifyGoogleMapsPlaces/helpers/executeActor.js +97 -0
- package/dist/nodes/ApifyGoogleMapsPlaces/helpers/executeActor.js.map +1 -0
- package/dist/nodes/ApifyGoogleMapsPlaces/helpers/genericFunctions.d.ts +10 -0
- package/dist/nodes/ApifyGoogleMapsPlaces/helpers/genericFunctions.js +91 -0
- package/dist/nodes/ApifyGoogleMapsPlaces/helpers/genericFunctions.js.map +1 -0
- package/dist/nodes/ApifyGoogleMapsPlaces/logo.svg +7 -0
- package/dist/package.json +75 -0
- package/package.json +75 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright 2026 John Cole
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
4
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
5
|
+
the Software without restriction, including without limitation the rights to
|
|
6
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
7
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
|
8
|
+
so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# n8n-nodes-google-maps-places-api
|
|
2
|
+
|
|
3
|
+
An [n8n](https://n8n.io/) community node that searches Google Maps and returns structured places: title, address, rating, type, phone, website, and coordinates. It is backed by the [Google Maps Places API](https://apify.com/johnvc/google-maps-places-api?fpr=9n7kx3) on [Apify](https://apify.com?fpr=9n7kx3) and bills per result, so there are no subscriptions and no minimums.
|
|
4
|
+
|
|
5
|
+
[Installation](#installation) · [Credentials](#credentials) · [Operations](#operations) · [Output](#output) · [Example workflows](#example-workflows) · [Pricing](#pricing) · [Resources](#resources)
|
|
6
|
+
|
|
7
|
+
## What it does
|
|
8
|
+
|
|
9
|
+
Give the node a search term and an optional location, and it returns one item per place with the title, address, rating, review count, category, phone, website, and GPS coordinates. It also works as an **AI Agent tool**, so an agent can pull local business data on demand. This is great for **lead generation** and local research.
|
|
10
|
+
|
|
11
|
+
- Search Google Maps for any business or place
|
|
12
|
+
- Localize with a location and language
|
|
13
|
+
- Control how many results to return
|
|
14
|
+
- Choose how much data to return per place: Simplified, Raw, or Selected Fields
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
Follow the n8n [community nodes installation guide](https://docs.n8n.io/integrations/community-nodes/installation/):
|
|
19
|
+
|
|
20
|
+
1. In n8n, open **Settings > Community Nodes**.
|
|
21
|
+
2. Select **Install**.
|
|
22
|
+
3. Enter `n8n-nodes-google-maps-places-api` as the npm package name.
|
|
23
|
+
4. Agree to the risks of using community nodes, then select **Install**.
|
|
24
|
+
|
|
25
|
+
After it installs, the **Google Maps Places** node appears in the nodes panel.
|
|
26
|
+
|
|
27
|
+
> n8n Cloud only allows verified community nodes. Until this node is verified, install it on a self-hosted n8n instance.
|
|
28
|
+
|
|
29
|
+
## Credentials
|
|
30
|
+
|
|
31
|
+
You need a free [Apify account](https://apify.com?fpr=9n7kx3) and an API token.
|
|
32
|
+
|
|
33
|
+
1. Sign in to the [Apify Console](https://console.apify.com?fpr=9n7kx3).
|
|
34
|
+
2. Open **Settings > Integrations** and copy your **Personal API token**.
|
|
35
|
+
3. In n8n, create a new **Apify API** credential and paste the token.
|
|
36
|
+
4. Use the credential's **Test** button to confirm it works.
|
|
37
|
+
|
|
38
|
+
The node also supports **Apify OAuth2** if you prefer to connect that way.
|
|
39
|
+
|
|
40
|
+
## Operations
|
|
41
|
+
|
|
42
|
+
**Place > Search** returns places that match a search term.
|
|
43
|
+
|
|
44
|
+
| Parameter | Description |
|
|
45
|
+
| --- | --- |
|
|
46
|
+
| Search Term | What to search Google Maps for. Required. |
|
|
47
|
+
| Location | Location to center the search on. Optional. |
|
|
48
|
+
| Language | Two-letter language code for the results. Optional. |
|
|
49
|
+
| Maximum Results per Search | How many places to return. |
|
|
50
|
+
| Output | How much data to return: Simplified, Raw, or Selected Fields. |
|
|
51
|
+
|
|
52
|
+
## Output
|
|
53
|
+
|
|
54
|
+
Each place is returned as its own n8n item. The API returns more than ten fields per place, so the **Output** parameter lets you choose how much to return:
|
|
55
|
+
|
|
56
|
+
- **Simplified** (default): a compact object with `title`, `address`, `rating`, `ratingCount`, `type`, `phoneNumber`, `website`, `latitude`, `longitude`, and `placeId`. This mode is also used automatically when the node runs as an AI Agent tool, to keep responses small.
|
|
57
|
+
- **Raw**: every field the API returns for each place, using the original field names below.
|
|
58
|
+
- **Selected Fields**: pick exactly which fields to include.
|
|
59
|
+
|
|
60
|
+
### Fields (Raw and Selected Fields)
|
|
61
|
+
|
|
62
|
+
| Field | Type | Description |
|
|
63
|
+
| --- | --- | --- |
|
|
64
|
+
| `searchTerm` | string | The term that produced this result |
|
|
65
|
+
| `position` | integer | Rank in the results |
|
|
66
|
+
| `title` | string | Place name |
|
|
67
|
+
| `address` | string | Full address |
|
|
68
|
+
| `latitude` | number | Latitude |
|
|
69
|
+
| `longitude` | number | Longitude |
|
|
70
|
+
| `rating` | number | Average rating |
|
|
71
|
+
| `ratingCount` | integer | Number of ratings |
|
|
72
|
+
| `priceLevel` | string | Price level |
|
|
73
|
+
| `type` | string | Primary category |
|
|
74
|
+
| `types` | array | All categories |
|
|
75
|
+
| `phoneNumber` | string | Phone number |
|
|
76
|
+
| `website` | string | Website URL |
|
|
77
|
+
| `description` | string | Short description |
|
|
78
|
+
| `openingHours` | object | Hours by day |
|
|
79
|
+
| `thumbnailUrl` | string | Thumbnail image URL |
|
|
80
|
+
| `cid` | string | Google customer ID |
|
|
81
|
+
| `fid` | string | Google feature ID |
|
|
82
|
+
| `placeId` | string | Google place identifier |
|
|
83
|
+
|
|
84
|
+
## Example workflows
|
|
85
|
+
|
|
86
|
+
### 1. Build a local lead list
|
|
87
|
+
|
|
88
|
+
1. **Manual Trigger**.
|
|
89
|
+
2. **Google Maps Places**: Search Term a category and city, Output `Simplified`.
|
|
90
|
+
3. **Google Sheets**: append each place's `title`, `address`, `phoneNumber`, and `website`.
|
|
91
|
+
|
|
92
|
+
### 2. Enrich place data
|
|
93
|
+
|
|
94
|
+
1. **Read** a list of business names.
|
|
95
|
+
2. **Google Maps Places**: search each name.
|
|
96
|
+
3. **Set**: keep `rating`, `ratingCount`, and `website`.
|
|
97
|
+
|
|
98
|
+
### 3. Let an AI Agent find places
|
|
99
|
+
|
|
100
|
+
1. **AI Agent** node.
|
|
101
|
+
2. Attach **Google Maps Places** as a tool.
|
|
102
|
+
3. Ask "Find top-rated plumbers in Denver." The agent calls the node (in Simplified mode) and answers with live places.
|
|
103
|
+
|
|
104
|
+
## Pricing
|
|
105
|
+
|
|
106
|
+
This node calls the [Google Maps Places API](https://apify.com/johnvc/google-maps-places-api?fpr=9n7kx3) on Apify, which is billed **pay-per-result**, with no subscription and no minimums. Apify also includes a free monthly usage tier that covers typical volumes. See the [Actor page](https://apify.com/johnvc/google-maps-places-api?fpr=9n7kx3) for current rates.
|
|
107
|
+
|
|
108
|
+
## Resources
|
|
109
|
+
|
|
110
|
+
- [Google Maps Places API on Apify](https://apify.com/johnvc/google-maps-places-api?fpr=9n7kx3)
|
|
111
|
+
- [npm package](https://www.npmjs.com/package/n8n-nodes-google-maps-places-api)
|
|
112
|
+
- [n8n community nodes documentation](https://docs.n8n.io/integrations/community-nodes/)
|
|
113
|
+
- [Apify n8n integration guide](https://docs.apify.com/platform/integrations/n8n)
|
|
114
|
+
|
|
115
|
+
## License
|
|
116
|
+
|
|
117
|
+
[MIT](LICENSE.md)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IAuthenticateGeneric, Icon, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare class ApifyApi implements ICredentialType {
|
|
3
|
+
name: string;
|
|
4
|
+
displayName: string;
|
|
5
|
+
documentationUrl: string;
|
|
6
|
+
icon: Icon;
|
|
7
|
+
properties: INodeProperties[];
|
|
8
|
+
authenticate: IAuthenticateGeneric;
|
|
9
|
+
test: ICredentialTestRequest;
|
|
10
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApifyApi = void 0;
|
|
4
|
+
class ApifyApi {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.name = 'apifyApi';
|
|
7
|
+
this.displayName = 'Apify API';
|
|
8
|
+
this.documentationUrl = 'https://docs.apify.com/platform/integrations/api#api-token';
|
|
9
|
+
this.icon = "file:../nodes/ApifyGoogleMapsPlaces/logo.svg";
|
|
10
|
+
this.properties = [
|
|
11
|
+
{
|
|
12
|
+
displayName: 'API Key',
|
|
13
|
+
name: 'apiKey',
|
|
14
|
+
type: 'string',
|
|
15
|
+
typeOptions: { password: true },
|
|
16
|
+
default: '',
|
|
17
|
+
},
|
|
18
|
+
];
|
|
19
|
+
this.authenticate = {
|
|
20
|
+
type: 'generic',
|
|
21
|
+
properties: {
|
|
22
|
+
headers: {
|
|
23
|
+
Authorization: '=Bearer {{$credentials.apiKey}}',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
this.test = {
|
|
28
|
+
request: {
|
|
29
|
+
method: 'GET',
|
|
30
|
+
url: 'https://api.apify.com/v2/me',
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.ApifyApi = ApifyApi;
|
|
36
|
+
//# sourceMappingURL=ApifyApi.credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApifyApi.credentials.js","sourceRoot":"","sources":["../../credentials/ApifyApi.credentials.ts"],"names":[],"mappings":";;;AAEA,MAAa,QAAQ;IAArB;QACC,SAAI,GAAG,UAAU,CAAC;QAElB,gBAAW,GAAG,WAAW,CAAC;QAE1B,qBAAgB,GAAG,4DAA4D,CAAC;QAEhF,SAAI,GAAS,8CAA8C,CAAA;QAE3D,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;aACX;SACD,CAAC;QAEF,iBAAY,GAAyB;YACpC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACX,OAAO,EAAE;oBACR,aAAa,EAAE,iCAAiC;iBAChD;aACD;SACD,CAAC;QAKF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,MAAM,EAAE,KAAK;gBACb,GAAG,EAAE,6BAA6B;aAClC;SACD,CAAC;IACH,CAAC;CAAA;AArCD,4BAqCC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Icon, ICredentialType, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare class ApifyOAuth2Api implements ICredentialType {
|
|
3
|
+
name: string;
|
|
4
|
+
extends: string[];
|
|
5
|
+
displayName: string;
|
|
6
|
+
icon: Icon;
|
|
7
|
+
documentationUrl: string;
|
|
8
|
+
properties: INodeProperties[];
|
|
9
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApifyOAuth2Api = void 0;
|
|
4
|
+
const scopes = ['profile', 'full_api_access'];
|
|
5
|
+
class ApifyOAuth2Api {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.name = 'apifyOAuth2Api';
|
|
8
|
+
this.extends = ['oAuth2Api'];
|
|
9
|
+
this.displayName = 'Apify OAuth2 API';
|
|
10
|
+
this.icon = "file:../nodes/ApifyGoogleMapsPlaces/logo.svg";
|
|
11
|
+
this.documentationUrl = 'https://docs.apify.com/api/v2';
|
|
12
|
+
this.properties = [
|
|
13
|
+
{
|
|
14
|
+
displayName: 'Grant Type',
|
|
15
|
+
name: 'grantType',
|
|
16
|
+
type: 'hidden',
|
|
17
|
+
default: 'pkce',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
displayName: 'Authorization URL',
|
|
21
|
+
name: 'authUrl',
|
|
22
|
+
type: 'hidden',
|
|
23
|
+
default: 'https://console.apify.com/authorize/oauth',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
displayName: 'Access Token URL',
|
|
27
|
+
name: 'accessTokenUrl',
|
|
28
|
+
type: 'hidden',
|
|
29
|
+
default: 'https://console-backend.apify.com/oauth/apps/token',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
displayName: 'Scope',
|
|
33
|
+
name: 'scope',
|
|
34
|
+
type: 'hidden',
|
|
35
|
+
default: `${scopes.join(' ')}`,
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
displayName: 'Auth URI Query Parameters',
|
|
39
|
+
name: 'authQueryParameters',
|
|
40
|
+
type: 'hidden',
|
|
41
|
+
default: '',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
displayName: 'Authentication',
|
|
45
|
+
name: 'authentication',
|
|
46
|
+
type: 'hidden',
|
|
47
|
+
default: 'header',
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
displayName: 'Client ID',
|
|
51
|
+
name: 'clientId',
|
|
52
|
+
type: 'hidden',
|
|
53
|
+
default: '',
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
displayName: 'Client Secret',
|
|
57
|
+
name: 'clientSecret',
|
|
58
|
+
type: 'hidden',
|
|
59
|
+
default: '',
|
|
60
|
+
typeOptions: { password: true },
|
|
61
|
+
},
|
|
62
|
+
];
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
exports.ApifyOAuth2Api = ApifyOAuth2Api;
|
|
66
|
+
//# sourceMappingURL=ApifyOAuth2Api.credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApifyOAuth2Api.credentials.js","sourceRoot":"","sources":["../../credentials/ApifyOAuth2Api.credentials.ts"],"names":[],"mappings":";;;AAEA,MAAM,MAAM,GAAG,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC;AAE9C,MAAa,cAAc;IAA3B;QACC,SAAI,GAAG,gBAAgB,CAAC;QAExB,YAAO,GAAG,CAAC,WAAW,CAAC,CAAC;QAExB,gBAAW,GAAG,kBAAkB,CAAC;QAEjC,SAAI,GAAS,8CAA8C,CAAA;QAG3D,qBAAgB,GAAG,+BAA+B,CAAC;QAEnD,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,YAAY;gBACzB,IAAI,EAAE,WAAW;gBACjB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,MAAM;aACf;YACD;gBACC,WAAW,EAAE,mBAAmB;gBAChC,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,2CAA2C;aACpD;YACD;gBACC,WAAW,EAAE,kBAAkB;gBAC/B,IAAI,EAAE,gBAAgB;gBACtB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,oDAAoD;aAC7D;YACD;gBACC,WAAW,EAAE,OAAO;gBACpB,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;aAC9B;YACD;gBACC,WAAW,EAAE,2BAA2B;gBACxC,IAAI,EAAE,qBAAqB;gBAC3B,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;aACX;YACD;gBACC,WAAW,EAAE,gBAAgB;gBAC7B,IAAI,EAAE,gBAAgB;gBACtB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,QAAQ;aACjB;YACD;gBACC,WAAW,EAAE,WAAW;gBACxB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;aACX;YACD;gBACC,WAAW,EAAE,eAAe;gBAC5B,IAAI,EAAE,cAAc;gBACpB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;aAC/B;SACD,CAAC;IACH,CAAC;CAAA;AA/DD,wCA+DC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
+
export declare const ACTOR_ID: string;
|
|
3
|
+
export declare const PACKAGE_NAME: string;
|
|
4
|
+
export declare const CLASS_NAME: string;
|
|
5
|
+
export declare const ClassNameCamel: string;
|
|
6
|
+
export declare const X_PLATFORM_HEADER_ID: string;
|
|
7
|
+
export declare const X_PLATFORM_APP_HEADER_ID: string;
|
|
8
|
+
export declare const DISPLAY_NAME: string;
|
|
9
|
+
export declare const DESCRIPTION: string;
|
|
10
|
+
export declare class ApifyGoogleMapsPlaces implements INodeType {
|
|
11
|
+
description: INodeTypeDescription;
|
|
12
|
+
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApifyGoogleMapsPlaces = exports.DESCRIPTION = exports.DISPLAY_NAME = exports.X_PLATFORM_APP_HEADER_ID = exports.X_PLATFORM_HEADER_ID = exports.ClassNameCamel = exports.CLASS_NAME = exports.PACKAGE_NAME = exports.ACTOR_ID = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const ApifyGoogleMapsPlaces_properties_1 = require("./ApifyGoogleMapsPlaces.properties");
|
|
6
|
+
const executeActor_1 = require("./helpers/executeActor");
|
|
7
|
+
exports.ACTOR_ID = 'WQbrHYgrJV5fP6b09';
|
|
8
|
+
exports.PACKAGE_NAME = 'n8n-nodes-google-maps-places-api';
|
|
9
|
+
exports.CLASS_NAME = 'ApifyGoogleMapsPlaces';
|
|
10
|
+
exports.ClassNameCamel = exports.CLASS_NAME.charAt(0).toLowerCase() + exports.CLASS_NAME.slice(1);
|
|
11
|
+
exports.X_PLATFORM_HEADER_ID = 'n8n';
|
|
12
|
+
exports.X_PLATFORM_APP_HEADER_ID = 'google-maps-places-app';
|
|
13
|
+
exports.DISPLAY_NAME = 'Google Maps Places';
|
|
14
|
+
exports.DESCRIPTION = 'Search Google Maps and return places with ratings, addresses, phone numbers, and coordinates';
|
|
15
|
+
class ApifyGoogleMapsPlaces {
|
|
16
|
+
constructor() {
|
|
17
|
+
this.description = {
|
|
18
|
+
displayName: exports.DISPLAY_NAME,
|
|
19
|
+
name: exports.ClassNameCamel,
|
|
20
|
+
icon: 'file:logo.svg',
|
|
21
|
+
group: ['transform'],
|
|
22
|
+
version: [1],
|
|
23
|
+
defaultVersion: 1,
|
|
24
|
+
subtitle: 'Search Places',
|
|
25
|
+
description: exports.DESCRIPTION,
|
|
26
|
+
defaults: {
|
|
27
|
+
name: exports.DISPLAY_NAME,
|
|
28
|
+
},
|
|
29
|
+
inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
30
|
+
outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
31
|
+
usableAsTool: true,
|
|
32
|
+
credentials: [
|
|
33
|
+
{
|
|
34
|
+
displayName: 'Apify API key connection',
|
|
35
|
+
name: 'apifyApi',
|
|
36
|
+
required: false,
|
|
37
|
+
displayOptions: {
|
|
38
|
+
show: {
|
|
39
|
+
authentication: ['apifyApi'],
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
displayName: 'Apify OAuth2 connection',
|
|
45
|
+
name: 'apifyOAuth2Api',
|
|
46
|
+
required: false,
|
|
47
|
+
displayOptions: {
|
|
48
|
+
show: {
|
|
49
|
+
authentication: ['apifyOAuth2Api'],
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
properties: ApifyGoogleMapsPlaces_properties_1.properties,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
async execute() {
|
|
58
|
+
const items = this.getInputData();
|
|
59
|
+
const returnData = [];
|
|
60
|
+
for (let i = 0; i < items.length; i++) {
|
|
61
|
+
try {
|
|
62
|
+
const data = await executeActor_1.runActor.call(this, i);
|
|
63
|
+
for (const item of data) {
|
|
64
|
+
returnData.push({ ...item, pairedItem: { item: i } });
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
if (this.continueOnFail()) {
|
|
69
|
+
returnData.push({
|
|
70
|
+
json: { error: error.message },
|
|
71
|
+
pairedItem: { item: i },
|
|
72
|
+
});
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), error, { itemIndex: i });
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return [returnData];
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
exports.ApifyGoogleMapsPlaces = ApifyGoogleMapsPlaces;
|
|
82
|
+
//# sourceMappingURL=ApifyGoogleMapsPlaces.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApifyGoogleMapsPlaces.node.js","sourceRoot":"","sources":["../../../nodes/ApifyGoogleMapsPlaces/ApifyGoogleMapsPlaces.node.ts"],"names":[],"mappings":";;;AAAA,+CAQsB;AACtB,yFAAgE;AAChE,yDAAkD;AAGrC,QAAA,QAAQ,GAAG,mBAA6B,CAAC;AAEzC,QAAA,YAAY,GAAG,kCAA4C,CAAC;AAC5D,QAAA,UAAU,GAAG,uBAAiC,CAAC;AAC/C,QAAA,cAAc,GAAG,kBAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,E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C,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACvC,IAAI,CAAC;gBACJ,MAAM,IAAI,GAAG,MAAM,uBAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;gBAC1C,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE,CAAC;oBACzB,UAAU,CAAC,IAAI,CAAC,EAAE,GAAG,IAAI,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;gBACvD,CAAC;YACF,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,IAAI,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC;oBAC3B,UAAU,CAAC,IAAI,CAAC;wBACf,IAAI,EAAE,EAAE,KAAK,EAAG,KAAe,CAAC,OAAO,EAAE;wBACzC,UAAU,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;qBACvB,CAAC,CAAC;oBACH,SAAS;gBACV,CAAC;gBACD,MAAM,IAAI,2BAAY,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,KAAmB,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC;YAC/E,CAAC;QACF,CAAC;QAED,OAAO,CAAC,UAAU,CAAC,CAAC;IACrB,CAAC;CACD;AAzED,sDAyEC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"node": "n8n-nodes-google-maps-places-api",
|
|
3
|
+
"nodeVersion": "1.0",
|
|
4
|
+
"codexVersion": "1.0",
|
|
5
|
+
"categories": [
|
|
6
|
+
"Data & Storage",
|
|
7
|
+
"Analytics",
|
|
8
|
+
"Sales"
|
|
9
|
+
],
|
|
10
|
+
"resources": {
|
|
11
|
+
"credentialDocumentation": [
|
|
12
|
+
{
|
|
13
|
+
"url": "https://docs.apify.com/platform/integrations/n8n"
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"primaryDocumentation": [
|
|
17
|
+
{
|
|
18
|
+
"url": "https://apify.com/johnvc/google-maps-places-api?fpr=9n7kx3"
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
},
|
|
22
|
+
"alias": [
|
|
23
|
+
"google maps",
|
|
24
|
+
"maps",
|
|
25
|
+
"places",
|
|
26
|
+
"local business",
|
|
27
|
+
"business search",
|
|
28
|
+
"lead generation",
|
|
29
|
+
"map scraper",
|
|
30
|
+
"poi",
|
|
31
|
+
"local seo",
|
|
32
|
+
"apify"
|
|
33
|
+
]
|
|
34
|
+
}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.properties = void 0;
|
|
4
|
+
exports.buildActorInput = buildActorInput;
|
|
5
|
+
function buildActorInput(context, itemIndex, defaultInput) {
|
|
6
|
+
const input = {
|
|
7
|
+
...defaultInput,
|
|
8
|
+
searchTerms: [context.getNodeParameter('searchTerm', itemIndex)],
|
|
9
|
+
maxResultsPerSearch: context.getNodeParameter('maxResultsPerSearch', itemIndex),
|
|
10
|
+
};
|
|
11
|
+
const location = context.getNodeParameter('location', itemIndex, '');
|
|
12
|
+
const language = context.getNodeParameter('language', itemIndex, '');
|
|
13
|
+
if (location)
|
|
14
|
+
input.location = location;
|
|
15
|
+
if (language)
|
|
16
|
+
input.language = language;
|
|
17
|
+
return input;
|
|
18
|
+
}
|
|
19
|
+
const resourceProperties = [
|
|
20
|
+
{
|
|
21
|
+
displayName: 'Resource',
|
|
22
|
+
name: 'resource',
|
|
23
|
+
type: 'options',
|
|
24
|
+
noDataExpression: true,
|
|
25
|
+
options: [
|
|
26
|
+
{
|
|
27
|
+
name: 'Place',
|
|
28
|
+
value: 'place',
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
default: 'place',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
displayName: 'Operation',
|
|
35
|
+
name: 'operation',
|
|
36
|
+
type: 'options',
|
|
37
|
+
noDataExpression: true,
|
|
38
|
+
displayOptions: {
|
|
39
|
+
show: {
|
|
40
|
+
resource: ['place'],
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
options: [
|
|
44
|
+
{
|
|
45
|
+
name: 'Search',
|
|
46
|
+
value: 'search',
|
|
47
|
+
action: 'Search places',
|
|
48
|
+
description: 'Search Google Maps and return one item per place',
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
default: 'search',
|
|
52
|
+
},
|
|
53
|
+
];
|
|
54
|
+
const actorProperties = [
|
|
55
|
+
{
|
|
56
|
+
displayName: 'Search Term',
|
|
57
|
+
name: 'searchTerm',
|
|
58
|
+
type: 'string',
|
|
59
|
+
required: true,
|
|
60
|
+
default: '',
|
|
61
|
+
placeholder: 'e.g. coffee shops in Austin, TX',
|
|
62
|
+
description: 'What to search Google Maps for',
|
|
63
|
+
displayOptions: { show: { resource: ['place'], operation: ['search'] } },
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
displayName: 'Location',
|
|
67
|
+
name: 'location',
|
|
68
|
+
type: 'string',
|
|
69
|
+
default: '',
|
|
70
|
+
placeholder: 'e.g. Austin, TX',
|
|
71
|
+
description: 'Location to center the search on. Optional.',
|
|
72
|
+
displayOptions: { show: { resource: ['place'], operation: ['search'] } },
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
displayName: 'Language',
|
|
76
|
+
name: 'language',
|
|
77
|
+
type: 'string',
|
|
78
|
+
default: '',
|
|
79
|
+
placeholder: 'e.g. en',
|
|
80
|
+
description: 'Two-letter language code for the results. Optional.',
|
|
81
|
+
displayOptions: { show: { resource: ['place'], operation: ['search'] } },
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
displayName: 'Maximum Results per Search',
|
|
85
|
+
name: 'maxResultsPerSearch',
|
|
86
|
+
type: 'number',
|
|
87
|
+
default: 20,
|
|
88
|
+
typeOptions: { minValue: 1 },
|
|
89
|
+
description: 'How many places to return',
|
|
90
|
+
displayOptions: { show: { resource: ['place'], operation: ['search'] } },
|
|
91
|
+
},
|
|
92
|
+
];
|
|
93
|
+
const outputProperties = [
|
|
94
|
+
{
|
|
95
|
+
displayName: 'Output',
|
|
96
|
+
name: 'output',
|
|
97
|
+
type: 'options',
|
|
98
|
+
noDataExpression: true,
|
|
99
|
+
displayOptions: { show: { resource: ['place'], operation: ['search'] } },
|
|
100
|
+
options: [
|
|
101
|
+
{
|
|
102
|
+
name: 'Raw',
|
|
103
|
+
value: 'raw',
|
|
104
|
+
description: 'Return every field the API produces for each place',
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
name: 'Selected Fields',
|
|
108
|
+
value: 'selected',
|
|
109
|
+
description: 'Choose exactly which fields to return',
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
name: 'Simplified',
|
|
113
|
+
value: 'simplified',
|
|
114
|
+
description: 'Return a compact set of the most useful place fields',
|
|
115
|
+
},
|
|
116
|
+
],
|
|
117
|
+
default: 'simplified',
|
|
118
|
+
description: 'How much data to return for each place',
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
displayName: 'Fields to Include',
|
|
122
|
+
name: 'fields',
|
|
123
|
+
type: 'multiOptions',
|
|
124
|
+
displayOptions: {
|
|
125
|
+
show: { resource: ['place'], operation: ['search'], output: ['selected'] },
|
|
126
|
+
},
|
|
127
|
+
options: [
|
|
128
|
+
{ name: 'Address', value: 'address' },
|
|
129
|
+
{ name: 'CID', value: 'cid' },
|
|
130
|
+
{ name: 'Description', value: 'description' },
|
|
131
|
+
{ name: 'FID', value: 'fid' },
|
|
132
|
+
{ name: 'Latitude', value: 'latitude' },
|
|
133
|
+
{ name: 'Longitude', value: 'longitude' },
|
|
134
|
+
{ name: 'Opening Hours', value: 'openingHours' },
|
|
135
|
+
{ name: 'Phone Number', value: 'phoneNumber' },
|
|
136
|
+
{ name: 'Place ID', value: 'placeId' },
|
|
137
|
+
{ name: 'Position', value: 'position' },
|
|
138
|
+
{ name: 'Price Level', value: 'priceLevel' },
|
|
139
|
+
{ name: 'Rating', value: 'rating' },
|
|
140
|
+
{ name: 'Rating Count', value: 'ratingCount' },
|
|
141
|
+
{ name: 'Search Term', value: 'searchTerm' },
|
|
142
|
+
{ name: 'Thumbnail URL', value: 'thumbnailUrl' },
|
|
143
|
+
{ name: 'Title', value: 'title' },
|
|
144
|
+
{ name: 'Type', value: 'type' },
|
|
145
|
+
{ name: 'Types', value: 'types' },
|
|
146
|
+
{ name: 'Website', value: 'website' },
|
|
147
|
+
],
|
|
148
|
+
default: ['title', 'address', 'rating', 'type', 'phoneNumber'],
|
|
149
|
+
description: 'Which fields to return when Output is set to Selected Fields',
|
|
150
|
+
},
|
|
151
|
+
];
|
|
152
|
+
const authenticationProperties = [
|
|
153
|
+
{
|
|
154
|
+
displayName: 'Authentication',
|
|
155
|
+
name: 'authentication',
|
|
156
|
+
type: 'options',
|
|
157
|
+
options: [
|
|
158
|
+
{
|
|
159
|
+
name: 'API Key',
|
|
160
|
+
value: 'apifyApi',
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
name: 'OAuth2',
|
|
164
|
+
value: 'apifyOAuth2Api',
|
|
165
|
+
},
|
|
166
|
+
],
|
|
167
|
+
default: 'apifyApi',
|
|
168
|
+
description: 'Choose which authentication method to use',
|
|
169
|
+
},
|
|
170
|
+
];
|
|
171
|
+
exports.properties = [
|
|
172
|
+
...resourceProperties,
|
|
173
|
+
...actorProperties,
|
|
174
|
+
...outputProperties,
|
|
175
|
+
...authenticationProperties,
|
|
176
|
+
];
|
|
177
|
+
//# sourceMappingURL=ApifyGoogleMapsPlaces.properties.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApifyGoogleMapsPlaces.properties.js","sourceRoot":"","sources":["../../../nodes/ApifyGoogleMapsPlaces/ApifyGoogleMapsPlaces.properties.ts"],"names":[],"mappings":";;;AAQA,0CAkBC;AAlBD,SAAgB,eAAe,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kB;IACrB,GAAG,eAAe;IAClB,GAAG,gBAAgB;IACnB,GAAG,wBAAwB;CAC3B,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
|
|
2
|
+
export declare function getDefaultBuild(this: IExecuteFunctions, actorId: string): Promise<any>;
|
|
3
|
+
export declare function getDefaultInputsFromBuild(build: any): Record<string, any>;
|
|
4
|
+
export declare function runActorApi(this: IExecuteFunctions, actorId: string, mergedInput: Record<string, any>, qs: Record<string, any>): Promise<any>;
|
|
5
|
+
export declare function runActor(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]>;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDefaultBuild = getDefaultBuild;
|
|
4
|
+
exports.getDefaultInputsFromBuild = getDefaultInputsFromBuild;
|
|
5
|
+
exports.runActorApi = runActorApi;
|
|
6
|
+
exports.runActor = runActor;
|
|
7
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
8
|
+
const genericFunctions_1 = require("./genericFunctions");
|
|
9
|
+
const ApifyGoogleMapsPlaces_node_1 = require("../ApifyGoogleMapsPlaces.node");
|
|
10
|
+
const ApifyGoogleMapsPlaces_properties_1 = require("../ApifyGoogleMapsPlaces.properties");
|
|
11
|
+
async function getDefaultBuild(actorId) {
|
|
12
|
+
const defaultBuildResp = await genericFunctions_1.apiRequest.call(this, {
|
|
13
|
+
method: 'GET',
|
|
14
|
+
uri: `/v2/acts/${actorId}/builds/default`,
|
|
15
|
+
});
|
|
16
|
+
if (!(defaultBuildResp === null || defaultBuildResp === void 0 ? void 0 : defaultBuildResp.data)) {
|
|
17
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
18
|
+
message: `Could not fetch default build for Actor ${actorId}`,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return defaultBuildResp.data;
|
|
22
|
+
}
|
|
23
|
+
function getDefaultInputsFromBuild(build) {
|
|
24
|
+
var _a, _b;
|
|
25
|
+
const buildInputProperties = (_b = (_a = build === null || build === void 0 ? void 0 : build.actorDefinition) === null || _a === void 0 ? void 0 : _a.input) === null || _b === void 0 ? void 0 : _b.properties;
|
|
26
|
+
const defaultInput = {};
|
|
27
|
+
if (buildInputProperties && typeof buildInputProperties === 'object') {
|
|
28
|
+
for (const [key, property] of Object.entries(buildInputProperties)) {
|
|
29
|
+
if (property &&
|
|
30
|
+
typeof property === 'object' &&
|
|
31
|
+
'prefill' in property &&
|
|
32
|
+
property.prefill !== undefined &&
|
|
33
|
+
property.prefill !== null) {
|
|
34
|
+
defaultInput[key] = property.prefill;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return defaultInput;
|
|
39
|
+
}
|
|
40
|
+
async function runActorApi(actorId, mergedInput, qs) {
|
|
41
|
+
return await genericFunctions_1.apiRequest.call(this, {
|
|
42
|
+
method: 'POST',
|
|
43
|
+
uri: `/v2/acts/${actorId}/runs`,
|
|
44
|
+
body: mergedInput,
|
|
45
|
+
qs,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function shapeItem(item, mode, fields) {
|
|
49
|
+
if (mode === 'raw') {
|
|
50
|
+
return item;
|
|
51
|
+
}
|
|
52
|
+
if (mode === 'selected') {
|
|
53
|
+
const picked = {};
|
|
54
|
+
for (const field of fields) {
|
|
55
|
+
if (field in item) {
|
|
56
|
+
picked[field] = item[field];
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return picked;
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
title: item.title,
|
|
63
|
+
address: item.address,
|
|
64
|
+
rating: item.rating,
|
|
65
|
+
ratingCount: item.ratingCount,
|
|
66
|
+
type: item.type,
|
|
67
|
+
phoneNumber: item.phoneNumber,
|
|
68
|
+
website: item.website,
|
|
69
|
+
latitude: item.latitude,
|
|
70
|
+
longitude: item.longitude,
|
|
71
|
+
placeId: item.placeId,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
async function runActor(i) {
|
|
75
|
+
var _a, _b;
|
|
76
|
+
const build = await getDefaultBuild.call(this, ApifyGoogleMapsPlaces_node_1.ACTOR_ID);
|
|
77
|
+
const defaultInput = getDefaultInputsFromBuild(build);
|
|
78
|
+
const mergedInput = (0, ApifyGoogleMapsPlaces_properties_1.buildActorInput)(this, i, defaultInput);
|
|
79
|
+
const run = await runActorApi.call(this, ApifyGoogleMapsPlaces_node_1.ACTOR_ID, mergedInput, { waitForFinish: 0 });
|
|
80
|
+
if (!((_a = run === null || run === void 0 ? void 0 : run.data) === null || _a === void 0 ? void 0 : _a.id)) {
|
|
81
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
82
|
+
message: 'Run ID not found after starting the Actor',
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
const runId = run.data.id;
|
|
86
|
+
const datasetId = run.data.defaultDatasetId;
|
|
87
|
+
await genericFunctions_1.pollRunStatus.call(this, runId);
|
|
88
|
+
const items = await genericFunctions_1.getResults.call(this, datasetId);
|
|
89
|
+
let mode = this.getNodeParameter('output', i, 'simplified');
|
|
90
|
+
if ((0, genericFunctions_1.isUsedAsAiTool)(this.getNode().type)) {
|
|
91
|
+
mode = 'simplified';
|
|
92
|
+
}
|
|
93
|
+
const fields = (_b = this.getNodeParameter('fields', i, [])) !== null && _b !== void 0 ? _b : [];
|
|
94
|
+
const shaped = items.map((item) => shapeItem(item, mode, fields));
|
|
95
|
+
return this.helpers.returnJsonArray(shaped);
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=executeActor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executeActor.js","sourceRoot":"","sources":["../../../../nodes/ApifyGoogleMapsPlaces/helpers/executeActor.ts"],"names":[],"mappings":";;AAKA,0CAWC;AAED,8DAiBC;AAED,kCAYC;AAwCD,4B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CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type IExecuteFunctions, type IHookFunctions, type ILoadOptionsFunctions, type IHttpRequestOptions } from 'n8n-workflow';
|
|
2
|
+
type IApiRequestOptions = Omit<IHttpRequestOptions, 'url'> & {
|
|
3
|
+
uri?: string;
|
|
4
|
+
url?: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function apiRequest(this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, requestOptions: IApiRequestOptions): Promise<any>;
|
|
7
|
+
export declare function isUsedAsAiTool(nodeType: string): boolean;
|
|
8
|
+
export declare function pollRunStatus(this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, runId: string): Promise<any>;
|
|
9
|
+
export declare function getResults(this: IExecuteFunctions, datasetId: string): Promise<any[]>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.apiRequest = apiRequest;
|
|
4
|
+
exports.isUsedAsAiTool = isUsedAsAiTool;
|
|
5
|
+
exports.pollRunStatus = pollRunStatus;
|
|
6
|
+
exports.getResults = getResults;
|
|
7
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
8
|
+
const ApifyGoogleMapsPlaces_node_1 = require("../ApifyGoogleMapsPlaces.node");
|
|
9
|
+
async function apiRequest(requestOptions) {
|
|
10
|
+
var _a;
|
|
11
|
+
const { method = 'GET', qs, uri, ...rest } = requestOptions;
|
|
12
|
+
const query = qs || {};
|
|
13
|
+
const endpoint = `https://api.apify.com${uri !== null && uri !== void 0 ? uri : ''}`;
|
|
14
|
+
const headers = {
|
|
15
|
+
'x-apify-integration-platform': ApifyGoogleMapsPlaces_node_1.X_PLATFORM_HEADER_ID,
|
|
16
|
+
...(ApifyGoogleMapsPlaces_node_1.X_PLATFORM_APP_HEADER_ID && { 'x-apify-integration-app-id': ApifyGoogleMapsPlaces_node_1.X_PLATFORM_APP_HEADER_ID }),
|
|
17
|
+
};
|
|
18
|
+
if (isUsedAsAiTool(this.getNode().type)) {
|
|
19
|
+
headers['x-apify-integration-ai-tool'] = 'true';
|
|
20
|
+
}
|
|
21
|
+
const options = {
|
|
22
|
+
...rest,
|
|
23
|
+
method,
|
|
24
|
+
qs: query,
|
|
25
|
+
url: endpoint,
|
|
26
|
+
headers,
|
|
27
|
+
json: true,
|
|
28
|
+
};
|
|
29
|
+
if (method === 'GET' && 'body' in options) {
|
|
30
|
+
delete options.body;
|
|
31
|
+
}
|
|
32
|
+
try {
|
|
33
|
+
const authenticationMethod = this.getNodeParameter('authentication', 0);
|
|
34
|
+
try {
|
|
35
|
+
await this.getCredentials(authenticationMethod);
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `No valid credentials found for ${authenticationMethod}. Please configure them first.`);
|
|
39
|
+
}
|
|
40
|
+
return await this.helpers.httpRequestWithAuthentication.call(this, authenticationMethod, options);
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
const apiError = error;
|
|
44
|
+
const body = (_a = apiError.response) === null || _a === void 0 ? void 0 : _a.body;
|
|
45
|
+
if (body) {
|
|
46
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), apiError, {
|
|
47
|
+
message: typeof body === 'string' ? body : JSON.stringify(body),
|
|
48
|
+
description: apiError.message,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), apiError);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function isUsedAsAiTool(nodeType) {
|
|
55
|
+
const parts = nodeType.split('.');
|
|
56
|
+
return parts[parts.length - 1] === `${ApifyGoogleMapsPlaces_node_1.ClassNameCamel}Tool`;
|
|
57
|
+
}
|
|
58
|
+
async function pollRunStatus(runId) {
|
|
59
|
+
var _a;
|
|
60
|
+
let lastRunData;
|
|
61
|
+
while (true) {
|
|
62
|
+
try {
|
|
63
|
+
const pollResult = await apiRequest.call(this, {
|
|
64
|
+
method: 'GET',
|
|
65
|
+
uri: `/v2/actor-runs/${runId}`,
|
|
66
|
+
});
|
|
67
|
+
const status = (_a = pollResult === null || pollResult === void 0 ? void 0 : pollResult.data) === null || _a === void 0 ? void 0 : _a.status;
|
|
68
|
+
lastRunData = pollResult === null || pollResult === void 0 ? void 0 : pollResult.data;
|
|
69
|
+
if (['SUCCEEDED', 'FAILED', 'TIMED-OUT', 'ABORTED'].includes(status))
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
catch (err) {
|
|
73
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
74
|
+
message: `Error polling run status: ${err}`,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
await (0, n8n_workflow_1.sleep)(1000);
|
|
78
|
+
}
|
|
79
|
+
return lastRunData;
|
|
80
|
+
}
|
|
81
|
+
async function getResults(datasetId) {
|
|
82
|
+
const results = await apiRequest.call(this, {
|
|
83
|
+
method: 'GET',
|
|
84
|
+
uri: `/v2/datasets/${datasetId}/items`,
|
|
85
|
+
});
|
|
86
|
+
if (Array.isArray(results)) {
|
|
87
|
+
return results;
|
|
88
|
+
}
|
|
89
|
+
return results ? [results] : [];
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=genericFunctions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"genericFunctions.js","sourceRoot":"","sources":["../../../../nodes/ApifyGoogleMapsPlaces/helpers/genericFunctions.ts"],"names":[],"mappings":";;AAuBA,gCAiEC;AAKD,wCAGC;AAKD,sCAuBC;AAMD,gCAUC;AA5ID,+CASsB;AACtB,8EAA+G;AAaxG,KAAK,UAAU,UAAU,CAE/B,cAAkC;;IAElC,MAAM,EAAE,MAAM,GAAG,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,GAAG,cAAc,CAAC;IAE5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AAI,CAAC,OAAO,EAAE,EAAE;gBACtC,OAAO,EAAE,6BAA6B,GAAG,EAAE;aAC3C,CAAC,CAAC;QACJ,CAAC;QACD,MAAM,IAAA,oBAAK,EAAC,IAAI,CAAC,CAAC;IACnB,CAAC;IACD,OAAO,WAAW,CAAC;AACpB,CAAC;AAMM,KAAK,UAAU,UAAU,CAA0B,SAAiB;IAC1E,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE;QAC3C,MAAM,EAAE,KAAK;QACb,GAAG,EAAE,gBAAgB,SAAS,QAAQ;KACtC,CAAC,CAAC;IAEH,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QAC5B,OAAO,OAAO,CAAC;IAChB,CAAC;IACD,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64" fill="none">
|
|
2
|
+
<!-- badge -->
|
|
3
|
+
<rect x="4" y="4" width="56" height="56" rx="14" fill="#16A34A"/>
|
|
4
|
+
<!-- map pin -->
|
|
5
|
+
<path d="M32 13 C23.7 13 17 19.7 17 28 C17 39 32 51 32 51 C32 51 47 39 47 28 C47 19.7 40.3 13 32 13 Z" fill="#DCFCE7"/>
|
|
6
|
+
<circle cx="32" cy="28" r="6" fill="#16A34A"/>
|
|
7
|
+
</svg>
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "n8n-nodes-google-maps-places-api",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Search Google Maps and return places with ratings, addresses, phone numbers, and coordinates. Apify-backed n8n community node, pay-per-result, and usable as an AI agent tool.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"n8n-community-node-package",
|
|
7
|
+
"n8n-nodes",
|
|
8
|
+
"n8n",
|
|
9
|
+
"google-maps",
|
|
10
|
+
"maps",
|
|
11
|
+
"places",
|
|
12
|
+
"local-business",
|
|
13
|
+
"lead-generation",
|
|
14
|
+
"poi",
|
|
15
|
+
"local-seo",
|
|
16
|
+
"apify",
|
|
17
|
+
"ai-tool"
|
|
18
|
+
],
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"author": {
|
|
21
|
+
"name": "John Cole",
|
|
22
|
+
"email": "tirade.charge_4v@icloud.com"
|
|
23
|
+
},
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "git+https://github.com/johnisanerd/n8n-nodes-google-maps-places-api.git"
|
|
27
|
+
},
|
|
28
|
+
"homepage": "https://github.com/johnisanerd/n8n-nodes-google-maps-places-api#readme",
|
|
29
|
+
"bugs": {
|
|
30
|
+
"url": "https://github.com/johnisanerd/n8n-nodes-google-maps-places-api/issues"
|
|
31
|
+
},
|
|
32
|
+
"engines": {
|
|
33
|
+
"node": ">=18.10"
|
|
34
|
+
},
|
|
35
|
+
"packageManager": "npm@10.8.2",
|
|
36
|
+
"main": "index.js",
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "n8n-node build",
|
|
39
|
+
"dev": "n8n-node dev",
|
|
40
|
+
"lint": "n8n-node lint",
|
|
41
|
+
"lint:fix": "n8n-node lint --fix"
|
|
42
|
+
},
|
|
43
|
+
"files": [
|
|
44
|
+
"dist"
|
|
45
|
+
],
|
|
46
|
+
"n8n": {
|
|
47
|
+
"n8nNodesApiVersion": 1,
|
|
48
|
+
"credentials": [
|
|
49
|
+
"dist/credentials/ApifyApi.credentials.js",
|
|
50
|
+
"dist/credentials/ApifyOAuth2Api.credentials.js"
|
|
51
|
+
],
|
|
52
|
+
"nodes": [
|
|
53
|
+
"dist/nodes/ApifyGoogleMapsPlaces/ApifyGoogleMapsPlaces.node.js"
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
"peerDependencies": {
|
|
57
|
+
"n8n-workflow": "*"
|
|
58
|
+
},
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"@n8n/node-cli": "0.32.1",
|
|
61
|
+
"@types/jest": "^29.5.14",
|
|
62
|
+
"@types/node": "^24.0.1",
|
|
63
|
+
"apify-client": "^2.16.0",
|
|
64
|
+
"chalk": "^5.6.0",
|
|
65
|
+
"eslint": "9.29.0",
|
|
66
|
+
"glob": "^11.0.3",
|
|
67
|
+
"gulp": "^4.0.2",
|
|
68
|
+
"jest": "^29.7.0",
|
|
69
|
+
"nock": "^14.0.5",
|
|
70
|
+
"prettier": "^3.6.2",
|
|
71
|
+
"sharp": "^0.34.2",
|
|
72
|
+
"ts-jest": "^29.3.2",
|
|
73
|
+
"typescript": "5.9.2"
|
|
74
|
+
}
|
|
75
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "n8n-nodes-google-maps-places-api",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Search Google Maps and return places with ratings, addresses, phone numbers, and coordinates. Apify-backed n8n community node, pay-per-result, and usable as an AI agent tool.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"n8n-community-node-package",
|
|
7
|
+
"n8n-nodes",
|
|
8
|
+
"n8n",
|
|
9
|
+
"google-maps",
|
|
10
|
+
"maps",
|
|
11
|
+
"places",
|
|
12
|
+
"local-business",
|
|
13
|
+
"lead-generation",
|
|
14
|
+
"poi",
|
|
15
|
+
"local-seo",
|
|
16
|
+
"apify",
|
|
17
|
+
"ai-tool"
|
|
18
|
+
],
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"author": {
|
|
21
|
+
"name": "John Cole",
|
|
22
|
+
"email": "tirade.charge_4v@icloud.com"
|
|
23
|
+
},
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "git+https://github.com/johnisanerd/n8n-nodes-google-maps-places-api.git"
|
|
27
|
+
},
|
|
28
|
+
"homepage": "https://github.com/johnisanerd/n8n-nodes-google-maps-places-api#readme",
|
|
29
|
+
"bugs": {
|
|
30
|
+
"url": "https://github.com/johnisanerd/n8n-nodes-google-maps-places-api/issues"
|
|
31
|
+
},
|
|
32
|
+
"engines": {
|
|
33
|
+
"node": ">=18.10"
|
|
34
|
+
},
|
|
35
|
+
"packageManager": "npm@10.8.2",
|
|
36
|
+
"main": "index.js",
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "n8n-node build",
|
|
39
|
+
"dev": "n8n-node dev",
|
|
40
|
+
"lint": "n8n-node lint",
|
|
41
|
+
"lint:fix": "n8n-node lint --fix"
|
|
42
|
+
},
|
|
43
|
+
"files": [
|
|
44
|
+
"dist"
|
|
45
|
+
],
|
|
46
|
+
"n8n": {
|
|
47
|
+
"n8nNodesApiVersion": 1,
|
|
48
|
+
"credentials": [
|
|
49
|
+
"dist/credentials/ApifyApi.credentials.js",
|
|
50
|
+
"dist/credentials/ApifyOAuth2Api.credentials.js"
|
|
51
|
+
],
|
|
52
|
+
"nodes": [
|
|
53
|
+
"dist/nodes/ApifyGoogleMapsPlaces/ApifyGoogleMapsPlaces.node.js"
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
"peerDependencies": {
|
|
57
|
+
"n8n-workflow": "*"
|
|
58
|
+
},
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"@n8n/node-cli": "0.32.1",
|
|
61
|
+
"@types/jest": "^29.5.14",
|
|
62
|
+
"@types/node": "^24.0.1",
|
|
63
|
+
"apify-client": "^2.16.0",
|
|
64
|
+
"chalk": "^5.6.0",
|
|
65
|
+
"eslint": "9.29.0",
|
|
66
|
+
"glob": "^11.0.3",
|
|
67
|
+
"gulp": "^4.0.2",
|
|
68
|
+
"jest": "^29.7.0",
|
|
69
|
+
"nock": "^14.0.5",
|
|
70
|
+
"prettier": "^3.6.2",
|
|
71
|
+
"sharp": "^0.34.2",
|
|
72
|
+
"ts-jest": "^29.3.2",
|
|
73
|
+
"typescript": "5.9.2"
|
|
74
|
+
}
|
|
75
|
+
}
|