n8n-nodes-ampost 0.0.0-stage → 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 +21 -0
- package/README.md +182 -2
- package/dist/credentials/AmpostApi.credentials.d.ts +10 -0
- package/dist/credentials/AmpostApi.credentials.js +47 -0
- package/dist/credentials/AmpostApi.credentials.js.map +1 -0
- package/dist/credentials/ampost.dark.svg +1 -0
- package/dist/credentials/ampost.svg +1 -0
- package/dist/nodes/Ampost/Ampost.node.d.ts +15 -0
- package/dist/nodes/Ampost/Ampost.node.js +91 -0
- package/dist/nodes/Ampost/Ampost.node.js.map +1 -0
- package/dist/nodes/Ampost/Ampost.node.json +18 -0
- package/dist/nodes/Ampost/actions.d.ts +7 -0
- package/dist/nodes/Ampost/actions.js +326 -0
- package/dist/nodes/Ampost/actions.js.map +1 -0
- package/dist/nodes/Ampost/ampost.dark.svg +1 -0
- package/dist/nodes/Ampost/ampost.svg +1 -0
- package/dist/nodes/Ampost/descriptions/OtherDescriptions.d.ts +11 -0
- package/dist/nodes/Ampost/descriptions/OtherDescriptions.js +280 -0
- package/dist/nodes/Ampost/descriptions/OtherDescriptions.js.map +1 -0
- package/dist/nodes/Ampost/descriptions/PostDescription.d.ts +3 -0
- package/dist/nodes/Ampost/descriptions/PostDescription.js +376 -0
- package/dist/nodes/Ampost/descriptions/PostDescription.js.map +1 -0
- package/dist/nodes/Ampost/descriptions/platformOptions.d.ts +3 -0
- package/dist/nodes/Ampost/descriptions/platformOptions.js +387 -0
- package/dist/nodes/Ampost/descriptions/platformOptions.js.map +1 -0
- package/dist/nodes/Ampost/descriptions/shared.d.ts +7 -0
- package/dist/nodes/Ampost/descriptions/shared.js +69 -0
- package/dist/nodes/Ampost/descriptions/shared.js.map +1 -0
- package/dist/nodes/Ampost/loadOptions.d.ts +6 -0
- package/dist/nodes/Ampost/loadOptions.js +59 -0
- package/dist/nodes/Ampost/loadOptions.js.map +1 -0
- package/dist/nodes/Ampost/transport.d.ts +14 -0
- package/dist/nodes/Ampost/transport.js +93 -0
- package/dist/nodes/Ampost/transport.js.map +1 -0
- package/dist/nodes/AmpostTrigger/AmpostTrigger.node.d.ts +12 -0
- package/dist/nodes/AmpostTrigger/AmpostTrigger.node.js +172 -0
- package/dist/nodes/AmpostTrigger/AmpostTrigger.node.js.map +1 -0
- package/dist/nodes/AmpostTrigger/AmpostTrigger.node.json +18 -0
- package/dist/nodes/AmpostTrigger/ampost.dark.svg +1 -0
- package/dist/nodes/AmpostTrigger/ampost.svg +1 -0
- package/dist/nodes/AmpostTrigger/signature.d.ts +8 -0
- package/dist/nodes/AmpostTrigger/signature.js +24 -0
- package/dist/nodes/AmpostTrigger/signature.js.map +1 -0
- package/dist/package.json +67 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +65 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Amlabs Artur Muszyński (Ampost)
|
|
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
CHANGED
|
@@ -1,3 +1,183 @@
|
|
|
1
|
-
#
|
|
1
|
+
# n8n-nodes-ampost
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[n8n](https://n8n.io) nodes for [Ampost](https://ampost.io?ref=github): publish, schedule and track
|
|
4
|
+
social media posts on Instagram, Facebook, Threads, X, YouTube, Pinterest, Bluesky, Telegram and
|
|
5
|
+
Discord from your workflows.
|
|
6
|
+
|
|
7
|
+
- **Ampost** node: create, validate, publish and manage posts, upload media, read accounts, queue
|
|
8
|
+
slots and analytics. It can also be used as a tool by n8n's AI Agent.
|
|
9
|
+
- **Ampost Trigger** node: starts a workflow when a post is published or fails, or when an account
|
|
10
|
+
needs reconnecting. It registers its own webhook and checks each event's signature.
|
|
11
|
+
- [Templates](#templates) for RSS, Google Sheets, AI posts with approval, YouTube and alerts.
|
|
12
|
+
|
|
13
|
+
No runtime dependencies. Built with [@n8n/node-cli](https://www.npmjs.com/package/@n8n/node-cli).
|
|
14
|
+
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
In n8n (self-hosted, 1.x or 2.x): **Settings → Community nodes → Install**, enter
|
|
18
|
+
`n8n-nodes-ampost`, tick the risk box and install. See n8n's
|
|
19
|
+
[community nodes guide](https://docs.n8n.io/integrations/community-nodes/installation/).
|
|
20
|
+
|
|
21
|
+
Manual install, for queue mode or Docker images built ahead of time:
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
cd ~/.n8n/nodes # create it with `npm init -y` if missing
|
|
25
|
+
npm install n8n-nodes-ampost
|
|
26
|
+
# restart n8n
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Credentials
|
|
30
|
+
|
|
31
|
+
1. In Ampost, open [Settings, API keys](https://ampost.io/app/settings/api-keys?ref=github) and
|
|
32
|
+
create a key. Pick the scopes the workflow needs (table below). A key can also be limited to some
|
|
33
|
+
platform sets.
|
|
34
|
+
2. In n8n, add an **Ampost API** credential and paste the key. Leave **Base URL** as
|
|
35
|
+
`https://api.ampost.io`.
|
|
36
|
+
|
|
37
|
+
n8n tests the credential by calling the API with the key; any valid key passes.
|
|
38
|
+
|
|
39
|
+
| Scope | Needed for |
|
|
40
|
+
| --- | --- |
|
|
41
|
+
| `posts:write` | Post: Create, Publish, Retry, Delete, Unpublish, Edit Published |
|
|
42
|
+
| `posts:read` | Post: Validate, Get, Get Many. Queue: Get Slots |
|
|
43
|
+
| `media:write` | Media: Upload |
|
|
44
|
+
| `accounts:read` | Account: Get, Get Many. Platform Set: Get Many. The platform and account lists in the node |
|
|
45
|
+
| `accounts:write` | Account: Disconnect |
|
|
46
|
+
| `analytics:read` | Analytics: Get Post Metrics, Get Overview |
|
|
47
|
+
| `webhooks:write` | Ampost Trigger |
|
|
48
|
+
|
|
49
|
+
The node uses API keys only. Ampost's OAuth tokens are for its [MCP server](https://ampost.io/docs/mcp?ref=github)
|
|
50
|
+
and are not accepted by the REST API.
|
|
51
|
+
|
|
52
|
+
## Ampost node
|
|
53
|
+
|
|
54
|
+
| Resource | Operation | What it does |
|
|
55
|
+
| --- | --- | --- |
|
|
56
|
+
| Post | Create | Publish now, schedule, add to the queue or save a draft |
|
|
57
|
+
| Post | Validate | Check a post against every platform's rules without creating it |
|
|
58
|
+
| Post | Get | A post with the result on each account |
|
|
59
|
+
| Post | Get Many | List posts, with filters for status, platform, platform set and text |
|
|
60
|
+
| Post | Publish | Publish a draft or a scheduled post now |
|
|
61
|
+
| Post | Retry | Publish again to the accounts that failed |
|
|
62
|
+
| Post | Delete | Discard a post that was not published |
|
|
63
|
+
| Post | Unpublish | Delete a published post from the platforms (all accounts, or the ones you pick). Instagram and TikTok have no delete API: those accounts keep it, with `notice` saying so |
|
|
64
|
+
| Post | Edit Published | Replace a published post's text on the platforms (all accounts, or the ones you pick); media and links stay. Instagram, Threads, TikTok, Bluesky and X have no edit API: those accounts keep their text, with `notice` saying so |
|
|
65
|
+
| Account | Get | A connected account with its health (`canPost`, `needsReconnect`, issues) |
|
|
66
|
+
| Account | Disconnect | Revoke Ampost's access and delete the tokens; the account becomes `revoked` and keeps its id for a reconnect. Instagram and Threads have no revoke API (`providerRevoked: false`, `providerAccessSettings` says where to remove Ampost) |
|
|
67
|
+
| Account | Get Many | List connected accounts |
|
|
68
|
+
| Media | Upload | Upload a file from the item's binary data, for use in a post |
|
|
69
|
+
| Platform Set | Get Many | List platform sets (groups of accounts, one per platform) |
|
|
70
|
+
| Queue | Get Slots | The next free times of a platform set's posting queue, one item each |
|
|
71
|
+
| Analytics | Get Post Metrics | Metrics of published posts, one entry per account |
|
|
72
|
+
| Analytics | Get Overview | Totals per account and overall for a date range |
|
|
73
|
+
|
|
74
|
+
**Get Slots** outputs one item per slot. A queue with no slots (none set up, or none free with
|
|
75
|
+
**Only Free Slots**) outputs no items, and n8n then skips every node after it. To keep the workflow
|
|
76
|
+
going, turn on **Always Output Data** in the node's settings and check for an empty item next.
|
|
77
|
+
|
|
78
|
+
**Create and Validate** take either fields or a raw JSON body (`Input Mode`, the body of
|
|
79
|
+
[POST /api/posts](https://ampost.io/docs?ref=github)). With fields:
|
|
80
|
+
|
|
81
|
+
- **Platform Set**: empty means your default set. **Platforms** lists the platforms with an active
|
|
82
|
+
account in that set.
|
|
83
|
+
- **When**: Publish Now, Schedule (a date, in the workflow's time zone unless it has an offset), Add
|
|
84
|
+
to Queue (the set's next free slot) or Save as Draft.
|
|
85
|
+
- **Additional Fields**: first comment, link, media (URLs, or **Media Items (JSON)**, which takes
|
|
86
|
+
the `files` of a Media: Upload result as is), media fit, metadata, more targets in other platform
|
|
87
|
+
sets, and an **Idempotency Key**. Set it to something unique to the post, such as
|
|
88
|
+
`{{ $json.guid }}`, and a re-run or a retried item never posts twice: Ampost answers a repeated
|
|
89
|
+
key with the first post for 24 hours.
|
|
90
|
+
- **Platform Options**: per-platform text and settings, for example the YouTube title and privacy,
|
|
91
|
+
Instagram placement (feed, reel, story), the Pinterest board, TikTok privacy, the Telegram parse
|
|
92
|
+
mode.
|
|
93
|
+
|
|
94
|
+
**Media: Upload** sends the file to Ampost's storage and waits until Ampost has checked it, then
|
|
95
|
+
returns `files[]` with the public URL, type, size and dimensions. Images (JPEG, PNG, WebP) and
|
|
96
|
+
videos (MP4, MOV, WebM) are accepted. Connect it before **Post: Create** and set **Media Items
|
|
97
|
+
(JSON)** to `{{ $json.files }}`.
|
|
98
|
+
|
|
99
|
+
**Get Many** operations return every result with **Return All**, or the first **Limit** results.
|
|
100
|
+
|
|
101
|
+
Errors from the API show their message and code, for example `Missing scope (INSUFFICIENT_SCOPE)`.
|
|
102
|
+
With **Settings → On Error → Continue**, the failed item's output is `{ error: "<message>" }` and
|
|
103
|
+
the workflow goes on.
|
|
104
|
+
|
|
105
|
+
### As an AI Agent tool
|
|
106
|
+
|
|
107
|
+
The Ampost node has `usableAsTool`, so it appears in the AI Agent's tool list as **Ampost Tool**. If
|
|
108
|
+
an older n8n does not list it, set `N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=true`.
|
|
109
|
+
|
|
110
|
+
## Ampost Trigger node
|
|
111
|
+
|
|
112
|
+
Choose the events, then activate the workflow. On activation the node creates an Ampost webhook for
|
|
113
|
+
the workflow's production URL (named `n8n: <workflow name>`). On deactivation it deletes it, and it
|
|
114
|
+
replaces it when the events or the URL change.
|
|
115
|
+
|
|
116
|
+
Events: `post.scheduled`, `post.unscheduled`, `post.discarded`, `post.published`, `post.partial`,
|
|
117
|
+
`post.failed`, `post.platform.published`, `post.platform.failed`, `post.platform.deleted`,
|
|
118
|
+
`post.platform.edited`, `account.connected`, `account.disconnected`, `account.needs_reconnect`,
|
|
119
|
+
`analytics.synced`.
|
|
120
|
+
|
|
121
|
+
Each item is the event as Ampost sends it: `{ id, type, createdAt, data }`, with `data.post`,
|
|
122
|
+
`data.platformPost` (including `error.code` and `error.message` on a failure) or `data.account`. See
|
|
123
|
+
[webhooks](https://ampost.io/docs?ref=github#webhooks).
|
|
124
|
+
|
|
125
|
+
Requirements:
|
|
126
|
+
|
|
127
|
+
- Ampost delivers only to public `https` addresses. n8n Cloud has one. Self-hosted n8n must be
|
|
128
|
+
reachable over https and have `N8N_WEBHOOK_URL` (`WEBHOOK_URL` before n8n 2) set to its public
|
|
129
|
+
address.
|
|
130
|
+
- The key needs `webhooks:write`.
|
|
131
|
+
|
|
132
|
+
Every request is checked against its `Ampost-Signature` (HMAC-SHA256 of the timestamp and the raw
|
|
133
|
+
body, with the webhook's secret, which the node stores when it creates the webhook). Requests
|
|
134
|
+
older than 5 minutes or with a wrong signature get `401` and start nothing.
|
|
135
|
+
|
|
136
|
+
## Templates
|
|
137
|
+
|
|
138
|
+
Import a file from [`templates/`](templates) with **Workflows → Import from File**, then pick your
|
|
139
|
+
Ampost credential in the Ampost nodes. Each workflow has a note with its setup steps.
|
|
140
|
+
|
|
141
|
+
| File | What it does |
|
|
142
|
+
| --- | --- |
|
|
143
|
+
| [`post-to-social-media.json`](templates/post-to-social-media.json) | Post a text and a link to the platforms you list |
|
|
144
|
+
| [`upload-image-and-post.json`](templates/upload-image-and-post.json) | Download an image, upload it to Ampost and post it |
|
|
145
|
+
| [`rss-to-social-media.json`](templates/rss-to-social-media.json) | Share every new item of an RSS feed on all your accounts |
|
|
146
|
+
| [`google-sheets-schedule.json`](templates/google-sheets-schedule.json) | Schedule the rows of a Google Sheet, then write the post ID and status back |
|
|
147
|
+
| [`ai-post-with-approval.json`](templates/ai-post-with-approval.json) | OpenAI writes a weekly post, Slack asks for approval, then Ampost publishes or deletes the draft |
|
|
148
|
+
| [`youtube-cross-post.json`](templates/youtube-cross-post.json) | Announce each new video of a YouTube channel on your other accounts |
|
|
149
|
+
| [`post-failure-alerts.json`](templates/post-failure-alerts.json) | Send a Slack message when a post fails or an account needs reconnecting |
|
|
150
|
+
|
|
151
|
+
Step-by-step guides: [ampost.io/how-to](https://ampost.io/how-to?ref=github).
|
|
152
|
+
|
|
153
|
+
## Development
|
|
154
|
+
|
|
155
|
+
```sh
|
|
156
|
+
npm ci
|
|
157
|
+
npm run lint # n8n's lint rules for community nodes
|
|
158
|
+
npm test # builds, then runs the unit tests and checks the templates against the nodes
|
|
159
|
+
npm run dev # n8n with this package linked, at http://localhost:5678
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Before a release, run n8n's scanner on the packed package, as CI does:
|
|
163
|
+
|
|
164
|
+
```sh
|
|
165
|
+
npm pack --pack-destination /tmp && tar xzf /tmp/n8n-nodes-ampost-*.tgz -C /tmp
|
|
166
|
+
npx @n8n/scan-community-package /tmp/package
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Releases: `npm run release` bumps the version, writes the changelog, then commits, tags and pushes.
|
|
170
|
+
It does not publish. The tag runs
|
|
171
|
+
`.github/workflows/publish.yml`, which publishes to npm with provenance (required for n8n's
|
|
172
|
+
verified community nodes) once the repo variable `NPM_PUBLISH_ENABLED` is `true`.
|
|
173
|
+
|
|
174
|
+
## Links
|
|
175
|
+
|
|
176
|
+
- [API docs](https://ampost.io/docs?ref=github)
|
|
177
|
+
- [n8n how-to](https://ampost.io/how-to/post-to-social-media-from-n8n?ref=github)
|
|
178
|
+
- [Node.js SDK](https://github.com/ampost-io/ampost-node) and [Python SDK](https://github.com/ampost-io/ampost-python)
|
|
179
|
+
- [Pricing](https://ampost.io/pricing?ref=github)
|
|
180
|
+
|
|
181
|
+
## License
|
|
182
|
+
|
|
183
|
+
[MIT](LICENSE)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IAuthenticateGeneric, Icon, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare class AmpostApi 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,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AmpostApi = void 0;
|
|
4
|
+
class AmpostApi {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.name = 'ampostApi';
|
|
7
|
+
this.displayName = 'Ampost API';
|
|
8
|
+
this.icon = { light: 'file:ampost.svg', dark: 'file:ampost.dark.svg' };
|
|
9
|
+
this.documentationUrl = 'https://github.com/ampost-io/n8n-nodes-ampost?tab=readme-ov-file#credentials';
|
|
10
|
+
this.properties = [
|
|
11
|
+
{
|
|
12
|
+
displayName: 'API Key',
|
|
13
|
+
name: 'apiKey',
|
|
14
|
+
type: 'string',
|
|
15
|
+
typeOptions: { password: true },
|
|
16
|
+
required: true,
|
|
17
|
+
default: '',
|
|
18
|
+
placeholder: 'amp_live_...',
|
|
19
|
+
description: 'Create a key in Ampost under Settings, API keys. Give it the scopes the workflow needs; the trigger needs webhooks:write.',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
displayName: 'Base URL',
|
|
23
|
+
name: 'baseUrl',
|
|
24
|
+
type: 'string',
|
|
25
|
+
default: 'https://api.ampost.io',
|
|
26
|
+
description: 'Leave as is unless Ampost support gives you another API address',
|
|
27
|
+
},
|
|
28
|
+
];
|
|
29
|
+
this.authenticate = {
|
|
30
|
+
type: 'generic',
|
|
31
|
+
properties: {
|
|
32
|
+
headers: {
|
|
33
|
+
Authorization: '=Bearer {{$credentials.apiKey}}',
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
this.test = {
|
|
38
|
+
request: {
|
|
39
|
+
baseURL: '={{$credentials.baseUrl.replace(/\\/+$/, "")}}',
|
|
40
|
+
url: '/api/docs/search',
|
|
41
|
+
qs: { query: 'posts', limit: 1 },
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.AmpostApi = AmpostApi;
|
|
47
|
+
//# sourceMappingURL=AmpostApi.credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AmpostApi.credentials.js","sourceRoot":"","sources":["../../credentials/AmpostApi.credentials.ts"],"names":[],"mappings":";;;AAQA,MAAa,SAAS;IAAtB;QACC,SAAI,GAAG,WAAW,CAAC;QAEnB,gBAAW,GAAG,YAAY,CAAC;QAE3B,SAAI,GAAS,EAAE,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,sBAAsB,EAAE,CAAC;QAExE,qBAAgB,GAAG,8EAA8E,CAAC;QAElG,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,QAAQ,EAAE,IAAI;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,cAAc;gBAC3B,WAAW,EACV,2HAA2H;aAC5H;YACD;gBACC,WAAW,EAAE,UAAU;gBACvB,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,uBAAuB;gBAChC,WAAW,EAAE,iEAAiE;aAC9E;SACD,CAAC;QAEF,iBAAY,GAAyB;YACpC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACX,OAAO,EAAE;oBACR,aAAa,EAAE,iCAAiC;iBAChD;aACD;SACD,CAAC;QAGF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,OAAO,EAAE,gDAAgD;gBACzD,GAAG,EAAE,kBAAkB;gBACvB,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE;aAChC;SACD,CAAC;IACH,CAAC;CAAA;AA/CD,8BA+CC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="512" height="512"><defs><linearGradient id="g" x1="0" y1="0" x2="512" y2="512" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#006E3D"/><stop offset="1" stop-color="#15985B"/></linearGradient></defs><rect width="512" height="512" rx="112" fill="url(#g)"/><path fill="#fff" fill-rule="evenodd" d="M30 256a226 226 0 1 0 452 0a226 226 0 1 0 -452 0ZM222.7 128.35L289.3 128.35L412.51 383.65L344.8 383.65L319.27 331.48L192.73 331.48L167.2 383.65L99.49 383.65ZM232.69 221.59Q232.69 211.6 241.33 216.62L292.87 246.54Q301.51 251.56 292.87 256.58L241.33 286.5Q232.69 291.52 232.69 281.53Z"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="512" height="512"><defs><linearGradient id="g" x1="0" y1="0" x2="512" y2="512" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#006E3D"/><stop offset="1" stop-color="#15985B"/></linearGradient></defs><rect width="512" height="512" rx="112" fill="url(#g)"/><path fill="#fff" fill-rule="evenodd" d="M30 256a226 226 0 1 0 452 0a226 226 0 1 0 -452 0ZM222.7 128.35L289.3 128.35L412.51 383.65L344.8 383.65L319.27 331.48L192.73 331.48L167.2 383.65L99.49 383.65ZM232.69 221.59Q232.69 211.6 241.33 216.62L292.87 246.54Q301.51 251.56 292.87 256.58L241.33 286.5Q232.69 291.52 232.69 281.53Z"/></svg>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
+
import { getAccounts, getPlatforms, getPlatformSets, getPlatformSetsOrAll, getPlatformSetsOrDefault } from './loadOptions';
|
|
3
|
+
export declare class Ampost implements INodeType {
|
|
4
|
+
description: INodeTypeDescription;
|
|
5
|
+
methods: {
|
|
6
|
+
loadOptions: {
|
|
7
|
+
getAccounts: typeof getAccounts;
|
|
8
|
+
getPlatforms: typeof getPlatforms;
|
|
9
|
+
getPlatformSets: typeof getPlatformSets;
|
|
10
|
+
getPlatformSetsOrAll: typeof getPlatformSetsOrAll;
|
|
11
|
+
getPlatformSetsOrDefault: typeof getPlatformSetsOrDefault;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Ampost = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const actions_1 = require("./actions");
|
|
6
|
+
const OtherDescriptions_1 = require("./descriptions/OtherDescriptions");
|
|
7
|
+
const PostDescription_1 = require("./descriptions/PostDescription");
|
|
8
|
+
const loadOptions_1 = require("./loadOptions");
|
|
9
|
+
class Ampost {
|
|
10
|
+
constructor() {
|
|
11
|
+
this.description = {
|
|
12
|
+
displayName: 'Ampost',
|
|
13
|
+
name: 'ampost',
|
|
14
|
+
icon: { light: 'file:ampost.svg', dark: 'file:ampost.dark.svg' },
|
|
15
|
+
group: ['output'],
|
|
16
|
+
version: 1,
|
|
17
|
+
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
|
18
|
+
description: 'Publish and schedule posts on Instagram, TikTok, LinkedIn, X, YouTube and more with one API',
|
|
19
|
+
defaults: { name: 'Ampost' },
|
|
20
|
+
usableAsTool: true,
|
|
21
|
+
inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
22
|
+
outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
23
|
+
credentials: [{ name: 'ampostApi', required: true }],
|
|
24
|
+
properties: [
|
|
25
|
+
{
|
|
26
|
+
displayName: 'Resource',
|
|
27
|
+
name: 'resource',
|
|
28
|
+
type: 'options',
|
|
29
|
+
noDataExpression: true,
|
|
30
|
+
options: [
|
|
31
|
+
{ name: 'Account', value: 'account' },
|
|
32
|
+
{ name: 'Analytic', value: 'analytics' },
|
|
33
|
+
{ name: 'Media', value: 'media' },
|
|
34
|
+
{ name: 'Platform Set', value: 'platformSet' },
|
|
35
|
+
{ name: 'Post', value: 'post' },
|
|
36
|
+
{ name: 'Queue', value: 'queue' },
|
|
37
|
+
],
|
|
38
|
+
default: 'post',
|
|
39
|
+
},
|
|
40
|
+
...PostDescription_1.postOperations,
|
|
41
|
+
...PostDescription_1.postFields,
|
|
42
|
+
...OtherDescriptions_1.accountOperations,
|
|
43
|
+
...OtherDescriptions_1.accountFields,
|
|
44
|
+
...OtherDescriptions_1.mediaOperations,
|
|
45
|
+
...OtherDescriptions_1.mediaFields,
|
|
46
|
+
...OtherDescriptions_1.platformSetOperations,
|
|
47
|
+
...OtherDescriptions_1.platformSetFields,
|
|
48
|
+
...OtherDescriptions_1.queueOperations,
|
|
49
|
+
...OtherDescriptions_1.queueFields,
|
|
50
|
+
...OtherDescriptions_1.analyticsOperations,
|
|
51
|
+
...OtherDescriptions_1.analyticsFields,
|
|
52
|
+
],
|
|
53
|
+
};
|
|
54
|
+
this.methods = {
|
|
55
|
+
loadOptions: {
|
|
56
|
+
getAccounts: loadOptions_1.getAccounts,
|
|
57
|
+
getPlatforms: loadOptions_1.getPlatforms,
|
|
58
|
+
getPlatformSets: loadOptions_1.getPlatformSets,
|
|
59
|
+
getPlatformSetsOrAll: loadOptions_1.getPlatformSetsOrAll,
|
|
60
|
+
getPlatformSetsOrDefault: loadOptions_1.getPlatformSetsOrDefault,
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
async execute() {
|
|
65
|
+
const items = this.getInputData();
|
|
66
|
+
const returnData = [];
|
|
67
|
+
for (let i = 0; i < items.length; i++) {
|
|
68
|
+
try {
|
|
69
|
+
const resource = this.getNodeParameter('resource', i);
|
|
70
|
+
const operation = this.getNodeParameter('operation', i);
|
|
71
|
+
const result = await (0, actions_1.runOperation)(this, resource, operation, i);
|
|
72
|
+
const results = Array.isArray(result) ? result : [result];
|
|
73
|
+
for (const json of results) {
|
|
74
|
+
returnData.push({ json, pairedItem: { item: i } });
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
if (this.continueOnFail()) {
|
|
79
|
+
returnData.push({ json: { error: error.message }, pairedItem: { item: i } });
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
if (error instanceof n8n_workflow_1.NodeOperationError)
|
|
83
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), error, { itemIndex: i });
|
|
84
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), error, { itemIndex: i });
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return [returnData];
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
exports.Ampost = Ampost;
|
|
91
|
+
//# sourceMappingURL=Ampost.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Ampost.node.js","sourceRoot":"","sources":["../../../nodes/Ampost/Ampost.node.ts"],"names":[],"mappings":";;;AAOA,+CAAqF;AACrF,uCAAyC;AACzC,wEAW0C;AAC1C,oEAA4E;AAC5E,+CAMuB;AAOvB,MAAa,MAAM;IAAnB;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,QAAQ;YACrB,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,EAAE,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,sBAAsB,EAAE;YAChE,KAAK,EAAE,CAAC,QAAQ,CAAC;YACjB,OAAO,EAAE,CAAC;YACV,QAAQ,EAAE,8DAA8D;YACxE,WAAW,EACV,6FAA6F;YAC9F,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;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;gBACvE,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;AAnFD,wBAmFC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"node": "n8n-nodes-ampost.ampost",
|
|
3
|
+
"nodeVersion": "1.0",
|
|
4
|
+
"codexVersion": "1.0",
|
|
5
|
+
"categories": ["Marketing & Content"],
|
|
6
|
+
"resources": {
|
|
7
|
+
"credentialDocumentation": [
|
|
8
|
+
{
|
|
9
|
+
"url": "https://github.com/ampost-io/n8n-nodes-ampost?tab=readme-ov-file#credentials"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"primaryDocumentation": [
|
|
13
|
+
{
|
|
14
|
+
"url": "https://github.com/ampost-io/n8n-nodes-ampost?tab=readme-ov-file#operations"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { IDataObject, IExecuteFunctions } from 'n8n-workflow';
|
|
2
|
+
export declare const ACCEPTED_MIME_TYPES: string[];
|
|
3
|
+
type Result = IDataObject | IDataObject[];
|
|
4
|
+
export declare function toIsoTime(value: string, zone: string): string | null;
|
|
5
|
+
export declare function buildPostBody(ctx: IExecuteFunctions, itemIndex: number): IDataObject;
|
|
6
|
+
export declare function runOperation(ctx: IExecuteFunctions, resource: string, operation: string, i: number): Promise<Result>;
|
|
7
|
+
export {};
|