@chez14org/n8n-nodes-facebook-page 0.0.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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Gunawan "chez14" Christianto <chris@christianto.net>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,124 @@
1
+ # @chez14org/n8n-nodes-facebook-page-api
2
+
3
+ This is an n8n community node. It adds a **Facebook Page API** node: a generic request node for the [Facebook Graph API](https://developers.facebook.com/docs/graph-api/overview), similar to n8n's HTTP Request node but preset for Graph API, with an **Act as Page** field that swaps your user access token for a Page access token.
4
+
5
+ > **Not endorsed by, affiliated with, or supported by Meta.** This is an unofficial, community-built integration.
6
+
7
+ [n8n](https://n8n.io/) is a [fair-code licensed](https://docs.n8n.io/sustainable-use-license/) workflow automation platform.
8
+
9
+ [Installation](#installation)
10
+ [Usage](#usage)
11
+ [Credentials](#credentials)
12
+ [Act as Page](#act-as-page)
13
+ [Compatibility](#compatibility)
14
+ [Local testing](#local-testing)
15
+ [Development](#development)
16
+ [Releasing](#releasing)
17
+ [Resources](#resources)
18
+
19
+ ## Installation
20
+
21
+ Follow the [installation guide](https://docs.n8n.io/integrations/community-nodes/installation/) in the n8n community nodes documentation.
22
+
23
+ Use the package name to install:
24
+
25
+ ```
26
+ @chez14org/n8n-nodes-facebook-page-api
27
+ ```
28
+
29
+ ## Usage
30
+
31
+ The node sends one Graph API request per input item.
32
+
33
+ | Field | Description |
34
+ | ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
35
+ | Authentication | `OAuth2` or `Access Token`. Selects the credential. |
36
+ | Act as Page | Optional Page to act as (from list, or by ID). Placed right after the credential. |
37
+ | Method | GET, POST, PUT, PATCH, DELETE or HEAD. |
38
+ | Path | Required. The Graph API path, for example `/v25.0/me/accounts`; the node adds `https://graph.facebook.com`. Include the version if you want one; an unversioned path uses the app's default version ([versioning](https://developers.facebook.com/docs/graph-api/guides/versioning)). |
39
+ | Query Parameters | Name/value pairs added to the query string. |
40
+ | Send Body, Body Content Type, Body | JSON or form-urlencoded body. |
41
+ | Options | Full Response (status, headers, body) and Ignore HTTP Errors. |
42
+
43
+ Example paths:
44
+
45
+ - `/v25.0/me` - the authenticated user.
46
+ - `/v25.0/me/accounts` - Pages the user manages (query parameter `fields=id,name`).
47
+ - `/v25.0/{page-id}/feed` - list posts on a Page (use Act as Page, or a Page token credential).
48
+ - `/v25.0/{page-id}/feed` with POST and body `{ "message": "Hello" }` - publish a post.
49
+ - `/v25.0/{post-id}` with DELETE - delete a post.
50
+
51
+ Relevant Meta docs: [Graph API overview](https://developers.facebook.com/docs/graph-api/overview), [Pages API](https://developers.facebook.com/docs/pages-api), [permissions reference](https://developers.facebook.com/docs/permissions), [access tokens](https://developers.facebook.com/docs/facebook-login/guides/access-tokens), [`/me/accounts`](https://developers.facebook.com/docs/graph-api/reference/user/accounts).
52
+
53
+ ## Credentials
54
+
55
+ ### Facebook Account OAuth2 API
56
+
57
+ 1. Create an app in [Meta for Developers](https://developers.facebook.com/apps/) and add the **Facebook Login** product.
58
+ 2. Add the OAuth Redirect URL shown in the n8n credential to **Valid OAuth Redirect URIs**.
59
+ 3. Copy the App ID and App Secret into Client ID and Client Secret.
60
+ 4. Keep or adjust the scope (default `pages_show_list pages_read_engagement pages_manage_posts business_management`) and connect. `business_management` is needed for Pages you manage through a business (Meta Business Suite). Apps in development mode only work for users with a role on the app.
61
+
62
+ ### Facebook Account Access Token API
63
+
64
+ Paste a user or Page access token (for example from the [Graph Explorer](https://developers.facebook.com/tools/explorer)). The node sends it as the `access_token` query parameter. The credential test calls `GET /me`.
65
+
66
+ ## Act as Page
67
+
68
+ Page-level actions such as publishing usually need a Page access token. When **Act as Page** is set, the node:
69
+
70
+ 1. requests `GET https://graph.facebook.com/{page-id}?fields=access_token` (unversioned, so Meta uses the app's default version) through the credential, which adds the user token (for OAuth2, n8n refreshes an expired token and retries); the Page list in the picker comes from the unversioned `GET https://graph.facebook.com/me/accounts?fields=id,name`,
71
+ 2. caches the Page token per Page ID for the whole execution, so it is fetched once, not once per item,
72
+ 3. sends your request with `access_token=<page token>`.
73
+
74
+ If the Page is not accessible or no token comes back, the node fails with a clear error. Leave the field empty to use the credential's token as is.
75
+
76
+ ### The Page list is empty
77
+
78
+ `/me/accounts` only returns Pages the token can act on. If the picker reports that Facebook returned no Pages, check:
79
+
80
+ - the token has `pages_show_list` (the [Access Token Debugger](https://developers.facebook.com/tools/debug/accesstoken/) shows the granted scopes),
81
+ - the Pages were selected in the Facebook login dialog when connecting (reconnect the credential to change the selection),
82
+ - for Pages managed through a business (Meta Business Suite), the token also has `business_management`.
83
+
84
+ You can always enter the Page ID with **By ID** instead.
85
+
86
+ ## Compatibility
87
+
88
+ Requires n8n's `n8nNodesApiVersion` 1. The node pins no Graph API version; put one in the path if you need it.
89
+
90
+ ## Local testing
91
+
92
+ ```sh
93
+ pnpm install
94
+ pnpm build
95
+ docker compose up --watch # n8n at http://localhost:5678
96
+ pnpm dev # in another terminal: rebuild dist/ on change
97
+ ```
98
+
99
+ ## Development
100
+
101
+ ```sh
102
+ pnpm install
103
+ pnpm dev # run n8n locally with this node loaded (or see Local testing)
104
+ pnpm lint # n8n-node lint (eslint)
105
+ pnpm build
106
+ pnpm test # vitest unit tests
107
+ pnpm test:coverage
108
+ pnpm lint:publish # publint --strict on the packed package (build first)
109
+ ```
110
+
111
+ Linting uses [`@net.christianto/eslint-config`](https://gitlab.com/net.christianto/codestyle/js)
112
+ layered on top of `@n8n/node-cli`'s config, and formatting uses prettier.
113
+
114
+ ## Releasing
115
+
116
+ Releases are automated by GitLab CI: on the protected default branch, the
117
+ pipeline tags the next version and publishes to npm with provenance.
118
+
119
+ Add `[skip-release]` to a commit message to skip a single release.
120
+
121
+ ## Resources
122
+
123
+ - [n8n community nodes documentation](https://docs.n8n.io/integrations/#community-nodes)
124
+ - [Source code](https://gitlab.com/chez14org/n8n-nodes/facebook-page-api)
@@ -0,0 +1,10 @@
1
+ import type { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, Icon, INodeProperties } from 'n8n-workflow';
2
+ export declare class Ch14FacebookAccessTokenApi implements ICredentialType {
3
+ name: string;
4
+ displayName: string;
5
+ icon: Icon;
6
+ documentationUrl: string;
7
+ properties: INodeProperties[];
8
+ authenticate: IAuthenticateGeneric;
9
+ test: ICredentialTestRequest;
10
+ }
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Ch14FacebookAccessTokenApi = void 0;
4
+ class Ch14FacebookAccessTokenApi {
5
+ constructor() {
6
+ this.name = 'ch14FacebookAccessTokenApi';
7
+ this.displayName = 'Facebook Account Access Token API';
8
+ this.icon = {
9
+ light: 'file:../icons/facebookPageApi.svg',
10
+ dark: 'file:../icons/facebookPageApi.dark.svg',
11
+ };
12
+ this.documentationUrl = 'https://gitlab.com/chez14org/n8n-nodes/facebook-page-api#credentials';
13
+ this.properties = [
14
+ {
15
+ displayName: 'Access Token',
16
+ name: 'accessToken',
17
+ type: 'string',
18
+ typeOptions: { password: true },
19
+ default: '',
20
+ required: true,
21
+ description: 'A user or Page access token. Generate one in the <a href="https://developers.facebook.com/tools/explorer" target="_blank">Graph Explorer</a>, or see the <a href="https://developers.facebook.com/docs/facebook-login/guides/access-tokens" target="_blank">access tokens guide</a>',
22
+ },
23
+ ];
24
+ this.authenticate = {
25
+ type: 'generic',
26
+ properties: {
27
+ qs: {
28
+ access_token: '={{$credentials.accessToken}}',
29
+ },
30
+ },
31
+ };
32
+ this.test = {
33
+ request: {
34
+ baseURL: 'https://graph.facebook.com',
35
+ url: '/me',
36
+ method: 'GET',
37
+ },
38
+ };
39
+ }
40
+ }
41
+ exports.Ch14FacebookAccessTokenApi = Ch14FacebookAccessTokenApi;
42
+ //# sourceMappingURL=Ch14FacebookAccessTokenApi.credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Ch14FacebookAccessTokenApi.credentials.js","sourceRoot":"","sources":["../../credentials/Ch14FacebookAccessTokenApi.credentials.ts"],"names":[],"mappings":";;;AAQA,MAAa,0BAA0B;IAAvC;QACE,SAAI,GAAG,4BAA4B,CAAC;QAEpC,gBAAW,GAAG,mCAAmC,CAAC;QAElD,SAAI,GAAS;YACX,KAAK,EAAE,mCAAmC;YAC1C,IAAI,EAAE,wCAAwC;SAC/C,CAAC;QAEF,qBAAgB,GAAG,sEAAsE,CAAC;QAE1F,eAAU,GAAsB;YAC9B;gBACE,WAAW,EAAE,cAAc;gBAC3B,IAAI,EAAE,aAAa;gBACnB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,WAAW,EACT,qRAAqR;aACxR;SACF,CAAC;QAEF,iBAAY,GAAyB;YACnC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACV,EAAE,EAAE;oBACF,YAAY,EAAE,+BAA+B;iBAC9C;aACF;SACF,CAAC;QAEF,SAAI,GAA2B;YAC7B,OAAO,EAAE;gBAEP,OAAO,EAAE,4BAA4B;gBACrC,GAAG,EAAE,KAAK;gBACV,MAAM,EAAE,KAAK;aACd;SACF,CAAC;IACJ,CAAC;CAAA;AA1CD,gEA0CC"}
@@ -0,0 +1,9 @@
1
+ import type { ICredentialType, Icon, INodeProperties } from 'n8n-workflow';
2
+ export declare class Ch14FacebookOAuth2Api implements ICredentialType {
3
+ name: string;
4
+ extends: string[];
5
+ icon: Icon;
6
+ displayName: string;
7
+ documentationUrl: string;
8
+ properties: INodeProperties[];
9
+ }
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Ch14FacebookOAuth2Api = void 0;
4
+ class Ch14FacebookOAuth2Api {
5
+ constructor() {
6
+ this.name = 'ch14FacebookOAuth2Api';
7
+ this.extends = ['oAuth2Api'];
8
+ this.icon = {
9
+ light: 'file:../icons/facebookPageApi.svg',
10
+ dark: 'file:../icons/facebookPageApi.dark.svg',
11
+ };
12
+ this.displayName = 'Facebook Account OAuth2 API';
13
+ this.documentationUrl = 'https://gitlab.com/chez14org/n8n-nodes/facebook-page-api#credentials';
14
+ this.properties = [
15
+ {
16
+ displayName: 'Create an app in the <a href="https://developers.facebook.com/apps/" target="_blank">Meta for Developers</a> dashboard, add the "Facebook Login" product, and add the OAuth Redirect URL shown above to its "Valid OAuth Redirect URIs". Then copy the App ID into Client ID and the App Secret into Client Secret. Pages the user manages are reachable with the node\'s "Act as Page" field.',
17
+ name: 'setupNotice',
18
+ type: 'notice',
19
+ default: '',
20
+ },
21
+ {
22
+ displayName: 'Grant Type',
23
+ name: 'grantType',
24
+ type: 'hidden',
25
+ default: 'authorizationCode',
26
+ },
27
+ {
28
+ displayName: 'Authorization URL',
29
+ name: 'authUrl',
30
+ type: 'hidden',
31
+ default: 'https://www.facebook.com/dialog/oauth',
32
+ },
33
+ {
34
+ displayName: 'Access Token URL',
35
+ name: 'accessTokenUrl',
36
+ type: 'hidden',
37
+ default: 'https://graph.facebook.com/oauth/access_token',
38
+ },
39
+ {
40
+ displayName: 'Auth URI Query Parameters',
41
+ name: 'authQueryParameters',
42
+ type: 'hidden',
43
+ default: '',
44
+ },
45
+ {
46
+ displayName: 'Scope',
47
+ name: 'scope',
48
+ type: 'string',
49
+ default: 'pages_show_list pages_read_engagement pages_manage_posts business_management',
50
+ description: 'Space-separated permissions to request. See the <a href="https://developers.facebook.com/docs/permissions" target="_blank">permissions reference</a>. Listing and acting as Pages needs at least <code>pages_show_list</code>, and <code>business_management</code> for Pages managed through a business (Meta Business Suite)',
51
+ },
52
+ {
53
+ displayName: 'Authentication',
54
+ name: 'authentication',
55
+ type: 'hidden',
56
+ default: 'body',
57
+ },
58
+ ];
59
+ }
60
+ }
61
+ exports.Ch14FacebookOAuth2Api = Ch14FacebookOAuth2Api;
62
+ //# sourceMappingURL=Ch14FacebookOAuth2Api.credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Ch14FacebookOAuth2Api.credentials.js","sourceRoot":"","sources":["../../credentials/Ch14FacebookOAuth2Api.credentials.ts"],"names":[],"mappings":";;;AAMA,MAAa,qBAAqB;IAAlC;QACE,SAAI,GAAG,uBAAuB,CAAC;QAE/B,YAAO,GAAG,CAAC,WAAW,CAAC,CAAC;QAExB,SAAI,GAAS;YACX,KAAK,EAAE,mCAAmC;YAC1C,IAAI,EAAE,wCAAwC;SAC/C,CAAC;QAEF,gBAAW,GAAG,6BAA6B,CAAC;QAE5C,qBAAgB,GAAG,sEAAsE,CAAC;QAE1F,eAAU,GAAsB;YAC9B;gBACE,WAAW,EACT,gYAAgY;gBAClY,IAAI,EAAE,aAAa;gBACnB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;aACZ;YACD;gBACE,WAAW,EAAE,YAAY;gBACzB,IAAI,EAAE,WAAW;gBACjB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,mBAAmB;aAC7B;YACD;gBACE,WAAW,EAAE,mBAAmB;gBAChC,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,uCAAuC;aACjD;YACD;gBACE,WAAW,EAAE,kBAAkB;gBAC/B,IAAI,EAAE,gBAAgB;gBACtB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,+CAA+C;aACzD;YACD;gBACE,WAAW,EAAE,2BAA2B;gBACxC,IAAI,EAAE,qBAAqB;gBAC3B,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;aACZ;YACD;gBACE,WAAW,EAAE,OAAO;gBACpB,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,8EAA8E;gBACvF,WAAW,EACT,gUAAgU;aACnU;YACD;gBACE,WAAW,EAAE,gBAAgB;gBAC7B,IAAI,EAAE,gBAAgB;gBACtB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,MAAM;aAChB;SACF,CAAC;IACJ,CAAC;CAAA;AA7DD,sDA6DC"}
@@ -0,0 +1,4 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
2
+ <rect width="24" height="24" rx="5" fill="#4599ff"/>
3
+ <path fill="#fff" d="M13.2 21v-7.6h2.6l.4-3h-3V8.5c0-.9.3-1.4 1.5-1.4h1.6V4.4c-.3 0-1.2-.1-2.3-.1-2.3 0-3.8 1.4-3.8 3.9v2.2H7.6v3h2.6V21z"/>
4
+ </svg>
@@ -0,0 +1,4 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
2
+ <rect width="24" height="24" rx="5" fill="#1877f2"/>
3
+ <path fill="#fff" d="M13.2 21v-7.6h2.6l.4-3h-3V8.5c0-.9.3-1.4 1.5-1.4h1.6V4.4c-.3 0-1.2-.1-2.3-.1-2.3 0-3.8 1.4-3.8 3.9v2.2H7.6v3h2.6V21z"/>
4
+ </svg>
@@ -0,0 +1,10 @@
1
+ import { type IExecuteFunctions, type ILoadOptionsFunctions, type INodeExecutionData, type INodeListSearchResult, type INodeType, type INodeTypeDescription } from 'n8n-workflow';
2
+ export declare class FacebookPageApi implements INodeType {
3
+ description: INodeTypeDescription;
4
+ methods: {
5
+ listSearch: {
6
+ searchPages(this: ILoadOptionsFunctions, filter?: string): Promise<INodeListSearchResult>;
7
+ };
8
+ };
9
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
10
+ }
@@ -0,0 +1,314 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FacebookPageApi = void 0;
4
+ const n8n_workflow_1 = require("n8n-workflow");
5
+ const helpers_1 = require("./helpers");
6
+ const CREDENTIAL_TYPES = {
7
+ oAuth2: 'ch14FacebookOAuth2Api',
8
+ accessToken: 'ch14FacebookAccessTokenApi',
9
+ };
10
+ function toJson(response) {
11
+ if (response !== null && typeof response === 'object' && !Array.isArray(response)) {
12
+ return response;
13
+ }
14
+ return { data: response };
15
+ }
16
+ async function fetchPageToken(ctx, authentication, pageId, itemIndex) {
17
+ let response;
18
+ try {
19
+ response = await ctx.helpers.httpRequestWithAuthentication.call(ctx, CREDENTIAL_TYPES[authentication], (0, helpers_1.buildPageTokenRequest)(pageId));
20
+ }
21
+ catch (error) {
22
+ throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), `Could not access Page "${pageId}" with this credential: ${error.message}. Check that the user manages the Page and granted pages_show_list.`, { itemIndex });
23
+ }
24
+ const pageToken = (0, helpers_1.extractPageToken)(response);
25
+ if (!pageToken) {
26
+ throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), `Facebook returned no access token for Page "${pageId}". Make sure the ID is a Page the user manages and the credential has Page permissions.`, { itemIndex });
27
+ }
28
+ return pageToken;
29
+ }
30
+ class FacebookPageApi {
31
+ constructor() {
32
+ this.description = {
33
+ displayName: 'Facebook Page API',
34
+ name: 'facebookPageApi',
35
+ icon: {
36
+ light: 'file:../../icons/facebookPageApi.svg',
37
+ dark: 'file:../../icons/facebookPageApi.dark.svg',
38
+ },
39
+ group: ['transform'],
40
+ version: 1,
41
+ subtitle: '={{$parameter["method"] + ": " + $parameter["url"]}}',
42
+ description: 'Send requests to the Facebook Graph API, optionally acting as a Page',
43
+ defaults: {
44
+ name: 'Facebook Page API',
45
+ },
46
+ usableAsTool: true,
47
+ inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
48
+ outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
49
+ credentials: [
50
+ {
51
+ name: 'ch14FacebookOAuth2Api',
52
+ required: true,
53
+ displayOptions: { show: { authentication: ['oAuth2'] } },
54
+ },
55
+ {
56
+ name: 'ch14FacebookAccessTokenApi',
57
+ required: true,
58
+ displayOptions: { show: { authentication: ['accessToken'] } },
59
+ },
60
+ ],
61
+ properties: [
62
+ {
63
+ displayName: 'Authentication',
64
+ name: 'authentication',
65
+ type: 'options',
66
+ noDataExpression: true,
67
+ options: [
68
+ { name: 'OAuth2', value: 'oAuth2' },
69
+ { name: 'Access Token', value: 'accessToken' },
70
+ ],
71
+ default: 'oAuth2',
72
+ description: 'How to authenticate. See the <a href="https://developers.facebook.com/docs/facebook-login/guides/access-tokens" target="_blank">access tokens guide</a>.',
73
+ },
74
+ {
75
+ displayName: 'Act as Page',
76
+ name: 'actAsPage',
77
+ type: 'resourceLocator',
78
+ default: { mode: 'list', value: '' },
79
+ description: 'Optional. Swap the credential token for this Page\'s access token, so the request is made as the Page. The list comes from <a href="https://developers.facebook.com/docs/graph-api/reference/user/accounts" target="_blank">/me/accounts</a>, which needs the pages_show_list <a href="https://developers.facebook.com/docs/permissions" target="_blank">permission</a>, plus business_management for Pages you manage through a business (Meta Business Suite). See <a href="https://developers.facebook.com/docs/pages-api/getting-started" target="_blank">Pages API: getting started</a> and <a href="https://developers.facebook.com/docs/facebook-login/guides/access-tokens/get-long-lived#get-a-long-lived-page-access-token" target="_blank">Page access tokens</a>. Leave empty to use the credential token as is.',
80
+ modes: [
81
+ {
82
+ displayName: 'From List',
83
+ name: 'list',
84
+ type: 'list',
85
+ typeOptions: {
86
+ searchListMethod: 'searchPages',
87
+ searchable: true,
88
+ },
89
+ },
90
+ {
91
+ displayName: 'By ID',
92
+ name: 'id',
93
+ type: 'string',
94
+ placeholder: 'e.g. 123456789012345',
95
+ },
96
+ ],
97
+ },
98
+ {
99
+ displayName: 'Method',
100
+ name: 'method',
101
+ type: 'options',
102
+ options: [
103
+ { name: 'DELETE', value: 'DELETE' },
104
+ { name: 'GET', value: 'GET' },
105
+ { name: 'HEAD', value: 'HEAD' },
106
+ { name: 'PATCH', value: 'PATCH' },
107
+ { name: 'POST', value: 'POST' },
108
+ { name: 'PUT', value: 'PUT' },
109
+ ],
110
+ default: 'GET',
111
+ },
112
+ {
113
+ displayName: 'Path',
114
+ name: 'path',
115
+ type: 'string',
116
+ required: true,
117
+ default: '',
118
+ placeholder: '/v25.0/me/feed',
119
+ description: 'The Graph API path. The node adds https://graph.facebook.com. Include the version if you want one; an unversioned path uses the app\'s default version. See <a href="https://developers.facebook.com/docs/graph-api/guides/versioning" target="_blank">versioning</a>.',
120
+ },
121
+ {
122
+ displayName: 'Query Parameters',
123
+ name: 'queryParameters',
124
+ type: 'fixedCollection',
125
+ typeOptions: { multipleValues: true },
126
+ placeholder: 'Add Parameter',
127
+ default: {},
128
+ options: [
129
+ {
130
+ name: 'parameters',
131
+ displayName: 'Parameter',
132
+ values: [
133
+ { displayName: 'Name', name: 'name', type: 'string', default: '' },
134
+ { displayName: 'Value', name: 'value', type: 'string', default: '' },
135
+ ],
136
+ },
137
+ ],
138
+ },
139
+ {
140
+ displayName: 'Send Body',
141
+ name: 'sendBody',
142
+ type: 'boolean',
143
+ default: false,
144
+ displayOptions: { hide: { method: ['GET', 'HEAD'] } },
145
+ },
146
+ {
147
+ displayName: 'Body Content Type',
148
+ name: 'contentType',
149
+ type: 'options',
150
+ options: [
151
+ { name: 'JSON', value: 'json' },
152
+ { name: 'Form-Urlencoded', value: 'form-urlencoded' },
153
+ ],
154
+ default: 'json',
155
+ displayOptions: { show: { sendBody: [true] }, hide: { method: ['GET', 'HEAD'] } },
156
+ },
157
+ {
158
+ displayName: 'Body',
159
+ name: 'jsonBody',
160
+ type: 'json',
161
+ default: '={}',
162
+ displayOptions: {
163
+ show: { sendBody: [true], contentType: ['json'] },
164
+ hide: { method: ['GET', 'HEAD'] },
165
+ },
166
+ },
167
+ {
168
+ displayName: 'Body Fields',
169
+ name: 'bodyParameters',
170
+ type: 'fixedCollection',
171
+ typeOptions: { multipleValues: true },
172
+ placeholder: 'Add Field',
173
+ default: {},
174
+ displayOptions: {
175
+ show: { sendBody: [true], contentType: ['form-urlencoded'] },
176
+ hide: { method: ['GET', 'HEAD'] },
177
+ },
178
+ options: [
179
+ {
180
+ name: 'parameters',
181
+ displayName: 'Field',
182
+ values: [
183
+ { displayName: 'Name', name: 'name', type: 'string', default: '' },
184
+ { displayName: 'Value', name: 'value', type: 'string', default: '' },
185
+ ],
186
+ },
187
+ ],
188
+ },
189
+ {
190
+ displayName: 'Options',
191
+ name: 'options',
192
+ type: 'collection',
193
+ placeholder: 'Add Option',
194
+ default: {},
195
+ options: [
196
+ {
197
+ displayName: 'Full Response',
198
+ name: 'fullResponse',
199
+ type: 'boolean',
200
+ default: false,
201
+ description: 'Whether to return the status code, headers and body instead of just the body',
202
+ },
203
+ {
204
+ displayName: 'Ignore HTTP Errors',
205
+ name: 'ignoreHttpStatusErrors',
206
+ type: 'boolean',
207
+ default: false,
208
+ description: 'Whether to return the response even when the status code is 4xx or 5xx',
209
+ },
210
+ ],
211
+ },
212
+ ],
213
+ };
214
+ this.methods = {
215
+ listSearch: {
216
+ async searchPages(filter) {
217
+ var _a, _b, _c;
218
+ const authentication = this.getNodeParameter('authentication');
219
+ const credentialType = CREDENTIAL_TYPES[authentication];
220
+ const results = [];
221
+ let pagesFound = 0;
222
+ const needle = filter === null || filter === void 0 ? void 0 : filter.trim().toLowerCase();
223
+ let url = `${helpers_1.GRAPH_BASE_URL}/me/accounts`;
224
+ let qs = { fields: 'id,name' };
225
+ while (url) {
226
+ const response = (await this.helpers.httpRequestWithAuthentication.call(this, credentialType, { method: 'GET', url, qs, json: true }));
227
+ if (!((_a = response.data) === null || _a === void 0 ? void 0 : _a.length)) {
228
+ break;
229
+ }
230
+ pagesFound += response.data.length;
231
+ for (const page of response.data) {
232
+ const name = (_b = page.name) !== null && _b !== void 0 ? _b : page.id;
233
+ if (needle && !name.toLowerCase().includes(needle) && !page.id.includes(needle)) {
234
+ continue;
235
+ }
236
+ results.push({ name, value: page.id });
237
+ }
238
+ url = (_c = response.paging) === null || _c === void 0 ? void 0 : _c.next;
239
+ qs = undefined;
240
+ }
241
+ if (pagesFound === 0) {
242
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Facebook returned no Pages for this credential (/me/accounts is empty)', {
243
+ description: 'Check that the token has pages_show_list, that the Pages were selected in the Facebook login dialog, and, for Pages managed through a business (Meta Business Suite), that it also has business_management. The Access Token Debugger (https://developers.facebook.com/tools/debug/accesstoken/) shows the granted scopes. You can also enter the Page ID with "By ID".',
244
+ });
245
+ }
246
+ return { results };
247
+ },
248
+ },
249
+ };
250
+ }
251
+ async execute() {
252
+ var _a, _b;
253
+ const items = this.getInputData();
254
+ const returnData = [];
255
+ const pageTokenCache = new Map();
256
+ for (let i = 0; i < items.length; i++) {
257
+ try {
258
+ const authentication = this.getNodeParameter('authentication', i);
259
+ const method = this.getNodeParameter('method', i);
260
+ const pageId = (0, helpers_1.normalizePageId)(this.getNodeParameter('actAsPage', i, '', { extractValue: true }));
261
+ const queryParameters = this.getNodeParameter('queryParameters', i, {});
262
+ const sendBody = this.getNodeParameter('sendBody', i, false);
263
+ const options = this.getNodeParameter('options', i, {});
264
+ const url = (0, helpers_1.buildGraphUrl)(this.getNodeParameter('path', i), this.getNode(), i);
265
+ const built = (0, helpers_1.buildBody)({
266
+ sendBody,
267
+ method,
268
+ contentType: this.getNodeParameter('contentType', i, 'json'),
269
+ jsonBody: this.getNodeParameter('jsonBody', i, {}),
270
+ pairs: this.getNodeParameter('bodyParameters', i, {}),
271
+ });
272
+ const requestOptions = {
273
+ method,
274
+ url,
275
+ qs: (0, helpers_1.pairsToObject)(queryParameters),
276
+ headers: built.headers,
277
+ json: built.json,
278
+ returnFullResponse: (_a = options.fullResponse) !== null && _a !== void 0 ? _a : false,
279
+ ignoreHttpStatusErrors: (_b = options.ignoreHttpStatusErrors) !== null && _b !== void 0 ? _b : false,
280
+ };
281
+ if (built.body !== undefined) {
282
+ requestOptions.body = built.body;
283
+ }
284
+ let response;
285
+ if (pageId) {
286
+ let pageToken = pageTokenCache.get(pageId);
287
+ if (!pageToken) {
288
+ pageToken = await fetchPageToken(this, authentication, pageId, i);
289
+ pageTokenCache.set(pageId, pageToken);
290
+ }
291
+ requestOptions.qs = (0, helpers_1.withAccessToken)(requestOptions.qs, pageToken);
292
+ response = await this.helpers.httpRequest(requestOptions);
293
+ }
294
+ else {
295
+ response = await this.helpers.httpRequestWithAuthentication.call(this, CREDENTIAL_TYPES[authentication], requestOptions);
296
+ }
297
+ returnData.push({ json: toJson(response), pairedItem: { item: i } });
298
+ }
299
+ catch (error) {
300
+ if (this.continueOnFail()) {
301
+ returnData.push({ json: { error: error.message }, pairedItem: { item: i } });
302
+ continue;
303
+ }
304
+ if (error instanceof n8n_workflow_1.NodeOperationError) {
305
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), error, { itemIndex: i });
306
+ }
307
+ throw new n8n_workflow_1.NodeApiError(this.getNode(), error, { itemIndex: i });
308
+ }
309
+ }
310
+ return [returnData];
311
+ }
312
+ }
313
+ exports.FacebookPageApi = FacebookPageApi;
314
+ //# sourceMappingURL=FacebookPageApi.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file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