n8n-nodes-so-me 1.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/README.md +104 -0
- package/dist/credentials/SoMeApi.credentials.d.ts +9 -0
- package/dist/credentials/SoMeApi.credentials.js +42 -0
- package/dist/credentials/SoMeApi.credentials.js.map +1 -0
- package/dist/nodes/SoMe/SoMe.node.d.ts +5 -0
- package/dist/nodes/SoMe/SoMe.node.js +165 -0
- package/dist/nodes/SoMe/SoMe.node.js.map +1 -0
- package/dist/nodes/SoMe/SoMeTrigger.node.d.ts +12 -0
- package/dist/nodes/SoMe/SoMeTrigger.node.js +132 -0
- package/dist/nodes/SoMe/SoMeTrigger.node.js.map +1 -0
- package/dist/nodes/SoMe/resources/account.d.ts +4 -0
- package/dist/nodes/SoMe/resources/account.js +94 -0
- package/dist/nodes/SoMe/resources/account.js.map +1 -0
- package/dist/nodes/SoMe/resources/ai.d.ts +4 -0
- package/dist/nodes/SoMe/resources/ai.js +358 -0
- package/dist/nodes/SoMe/resources/ai.js.map +1 -0
- package/dist/nodes/SoMe/resources/analytics.d.ts +4 -0
- package/dist/nodes/SoMe/resources/analytics.js +136 -0
- package/dist/nodes/SoMe/resources/analytics.js.map +1 -0
- package/dist/nodes/SoMe/resources/approval.d.ts +4 -0
- package/dist/nodes/SoMe/resources/approval.js +119 -0
- package/dist/nodes/SoMe/resources/approval.js.map +1 -0
- package/dist/nodes/SoMe/resources/biolink.d.ts +4 -0
- package/dist/nodes/SoMe/resources/biolink.js +619 -0
- package/dist/nodes/SoMe/resources/biolink.js.map +1 -0
- package/dist/nodes/SoMe/resources/draft.d.ts +4 -0
- package/dist/nodes/SoMe/resources/draft.js +223 -0
- package/dist/nodes/SoMe/resources/draft.js.map +1 -0
- package/dist/nodes/SoMe/resources/inbox.d.ts +4 -0
- package/dist/nodes/SoMe/resources/inbox.js +237 -0
- package/dist/nodes/SoMe/resources/inbox.js.map +1 -0
- package/dist/nodes/SoMe/resources/media.d.ts +4 -0
- package/dist/nodes/SoMe/resources/media.js +356 -0
- package/dist/nodes/SoMe/resources/media.js.map +1 -0
- package/dist/nodes/SoMe/resources/post.d.ts +4 -0
- package/dist/nodes/SoMe/resources/post.js +382 -0
- package/dist/nodes/SoMe/resources/post.js.map +1 -0
- package/dist/nodes/SoMe/resources/postComment.d.ts +4 -0
- package/dist/nodes/SoMe/resources/postComment.js +159 -0
- package/dist/nodes/SoMe/resources/postComment.js.map +1 -0
- package/dist/nodes/SoMe/resources/savedReply.d.ts +4 -0
- package/dist/nodes/SoMe/resources/savedReply.js +143 -0
- package/dist/nodes/SoMe/resources/savedReply.js.map +1 -0
- package/dist/nodes/SoMe/resources/settings.d.ts +4 -0
- package/dist/nodes/SoMe/resources/settings.js +53 -0
- package/dist/nodes/SoMe/resources/settings.js.map +1 -0
- package/dist/nodes/SoMe/resources/support.d.ts +4 -0
- package/dist/nodes/SoMe/resources/support.js +141 -0
- package/dist/nodes/SoMe/resources/support.js.map +1 -0
- package/dist/nodes/SoMe/resources/team.d.ts +4 -0
- package/dist/nodes/SoMe/resources/team.js +143 -0
- package/dist/nodes/SoMe/resources/team.js.map +1 -0
- package/dist/nodes/SoMe/resources/template.d.ts +4 -0
- package/dist/nodes/SoMe/resources/template.js +85 -0
- package/dist/nodes/SoMe/resources/template.js.map +1 -0
- package/dist/nodes/SoMe/resources/webhook.d.ts +4 -0
- package/dist/nodes/SoMe/resources/webhook.js +290 -0
- package/dist/nodes/SoMe/resources/webhook.js.map +1 -0
- package/package.json +50 -0
package/README.md
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# n8n-nodes-so-me
|
|
2
|
+
|
|
3
|
+
This is an [n8n](https://n8n.io/) community node for [SoMe](https://so-me.studio) — a social media scheduling platform. It lets you automate your social media workflows by connecting SoMe to hundreds of other services.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
### SoMe Node (Regular)
|
|
8
|
+
|
|
9
|
+
Perform operations on all SoMe resources:
|
|
10
|
+
|
|
11
|
+
| Resource | Operations |
|
|
12
|
+
|---|---|
|
|
13
|
+
| **Post** | Create, List, Get, Update, Delete, Bulk Delete, Schedule, Unschedule, Retry, Resubmit, Get Calendar |
|
|
14
|
+
| **Post Comment** | List, Add, Update, Delete |
|
|
15
|
+
| **Approval** | List Pending, Approve, Reject |
|
|
16
|
+
| **Draft** | Create, List, Get, Update, Delete, Convert to Post |
|
|
17
|
+
| **Inbox** | List Conversations, Get Messages, Reply, Update, Delete, Subscribe, Unsubscribe |
|
|
18
|
+
| **Saved Reply** | List, Get, Create, Update, Delete |
|
|
19
|
+
| **Account** | List, Get, Disconnect |
|
|
20
|
+
| **Analytics** | Summary, Platform, Post, Facebook, Instagram, LinkedIn, YouTube, X, WhatsApp |
|
|
21
|
+
| **AI** | Generate Caption, Generate Image, Generate & Schedule, Video, Avatars, Sounds, Hooks, History |
|
|
22
|
+
| **Team** | List Members, Invite, Remove, Update Role, Invitations |
|
|
23
|
+
| **Media** | List, Get, Search, Delete, Bulk Delete, Upload, Folders, Move, Rename |
|
|
24
|
+
| **Biolink** | Full CRUD, Buttons, Posts, Themes, Analytics |
|
|
25
|
+
| **Template** | List, Render |
|
|
26
|
+
| **Support** | List Tickets, Get, Create, Send Message |
|
|
27
|
+
| **Settings** | Profile, Organization, Billing, Usage |
|
|
28
|
+
| **Webhook** | Subscriptions CRUD, Test, Deliveries, Retry, Events |
|
|
29
|
+
|
|
30
|
+
### SoMe Trigger Node
|
|
31
|
+
|
|
32
|
+
Receive real-time webhook notifications when events happen in your SoMe workspace:
|
|
33
|
+
|
|
34
|
+
- **Post Events** — post created, published, failed, approved, rejected, and more
|
|
35
|
+
- **Inbox Events** — new messages, conversations, comments
|
|
36
|
+
- **Account Events** — social account connected or disconnected
|
|
37
|
+
- **Subscription Events** — plan changes, payment failures
|
|
38
|
+
- **AI Events** — image or video generation completed
|
|
39
|
+
- **Team Events** — member joined or removed
|
|
40
|
+
- **Support Events** — ticket replies
|
|
41
|
+
|
|
42
|
+
## Prerequisites
|
|
43
|
+
|
|
44
|
+
- An active [SoMe](https://so-me.studio) account (Solo, Team, or Scale plan)
|
|
45
|
+
- An API key from **Settings > API** in your SoMe dashboard
|
|
46
|
+
|
|
47
|
+
## Installation
|
|
48
|
+
|
|
49
|
+
### In n8n Desktop or Self-Hosted
|
|
50
|
+
|
|
51
|
+
1. Go to **Settings > Community Nodes**
|
|
52
|
+
2. Select **Install a community node**
|
|
53
|
+
3. Enter `n8n-nodes-so-me`
|
|
54
|
+
4. Click **Install**
|
|
55
|
+
|
|
56
|
+
### In n8n Cloud
|
|
57
|
+
|
|
58
|
+
Community nodes are available on n8n Cloud. Search for "SoMe" when adding a new node.
|
|
59
|
+
|
|
60
|
+
## Credentials Setup
|
|
61
|
+
|
|
62
|
+
1. In n8n, go to **Credentials > New Credential**
|
|
63
|
+
2. Search for **SoMe API**
|
|
64
|
+
3. Enter your **API Key** (from SoMe Settings > API)
|
|
65
|
+
4. Optionally change the **Base URL** if you're using a self-hosted instance
|
|
66
|
+
5. Click **Save**
|
|
67
|
+
|
|
68
|
+
The credential will be tested automatically by calling your accounts endpoint.
|
|
69
|
+
|
|
70
|
+
## Usage Examples
|
|
71
|
+
|
|
72
|
+
### Schedule a post when a new row is added to Google Sheets
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
Google Sheets Trigger → SoMe (Create Post) → Slack (Send Notification)
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Auto-reply to inbox messages
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
SoMe Trigger (Inbox Events) → OpenAI (Generate Reply) → SoMe (Reply to Conversation)
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Daily analytics report to Slack
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
Schedule Trigger → SoMe (Get Analytics Summary) → Slack (Post Message)
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Auto-approve posts during business hours
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
SoMe Trigger (Post Events) → IF (business hours) → SoMe (Approve Post)
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Resources
|
|
97
|
+
|
|
98
|
+
- [SoMe Website](https://so-me.studio)
|
|
99
|
+
- [SoMe API Documentation](https://so-me.studio/docs/api)
|
|
100
|
+
- [n8n Community Nodes Documentation](https://docs.n8n.io/integrations/community-nodes/)
|
|
101
|
+
|
|
102
|
+
## License
|
|
103
|
+
|
|
104
|
+
MIT
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare class SoMeApi implements ICredentialType {
|
|
3
|
+
name: string;
|
|
4
|
+
displayName: string;
|
|
5
|
+
documentationUrl: string;
|
|
6
|
+
properties: INodeProperties[];
|
|
7
|
+
authenticate: IAuthenticateGeneric;
|
|
8
|
+
test: ICredentialTestRequest;
|
|
9
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SoMeApi = void 0;
|
|
4
|
+
class SoMeApi {
|
|
5
|
+
name = 'soMeApi';
|
|
6
|
+
displayName = 'SoMe API';
|
|
7
|
+
documentationUrl = 'https://so-me.studio/docs/api';
|
|
8
|
+
properties = [
|
|
9
|
+
{
|
|
10
|
+
displayName: 'API Key',
|
|
11
|
+
name: 'apiKey',
|
|
12
|
+
type: 'string',
|
|
13
|
+
typeOptions: { password: true },
|
|
14
|
+
default: '',
|
|
15
|
+
required: true,
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
displayName: 'Base URL',
|
|
19
|
+
name: 'baseUrl',
|
|
20
|
+
type: 'string',
|
|
21
|
+
default: 'https://so-me.studio',
|
|
22
|
+
description: 'The base URL of your SoMe instance. Change this for self-hosted installations.',
|
|
23
|
+
},
|
|
24
|
+
];
|
|
25
|
+
authenticate = {
|
|
26
|
+
type: 'generic',
|
|
27
|
+
properties: {
|
|
28
|
+
headers: {
|
|
29
|
+
'X-API-Key': '={{$credentials.apiKey}}',
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
test = {
|
|
34
|
+
request: {
|
|
35
|
+
baseURL: '={{$credentials.baseUrl}}',
|
|
36
|
+
url: '/v1/accounts',
|
|
37
|
+
method: 'GET',
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
exports.SoMeApi = SoMeApi;
|
|
42
|
+
//# sourceMappingURL=SoMeApi.credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SoMeApi.credentials.js","sourceRoot":"","sources":["../../credentials/SoMeApi.credentials.ts"],"names":[],"mappings":";;;AAOA,MAAa,OAAO;IAClB,IAAI,GAAG,SAAS,CAAC;IACjB,WAAW,GAAG,UAAU,CAAC;IACzB,gBAAgB,GAAG,+BAA+B,CAAC;IAEnD,UAAU,GAAsB;QAC9B;YACE,WAAW,EAAE,SAAS;YACtB,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;YAC/B,OAAO,EAAE,EAAE;YACX,QAAQ,EAAE,IAAI;SACf;QACD;YACE,WAAW,EAAE,UAAU;YACvB,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,sBAAsB;YAC/B,WAAW,EAAE,gFAAgF;SAC9F;KACF,CAAC;IAEF,YAAY,GAAyB;QACnC,IAAI,EAAE,SAAS;QACf,UAAU,EAAE;YACV,OAAO,EAAE;gBACP,WAAW,EAAE,0BAA0B;aACxC;SACF;KACF,CAAC;IAEF,IAAI,GAA2B;QAC7B,OAAO,EAAE;YACP,OAAO,EAAE,2BAA2B;YACpC,GAAG,EAAE,cAAc;YACnB,MAAM,EAAE,KAAK;SACd;KACF,CAAC;CACH;AAvCD,0BAuCC"}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.SoMe = void 0;
|
|
37
|
+
const post_1 = require("./resources/post");
|
|
38
|
+
const postComment_1 = require("./resources/postComment");
|
|
39
|
+
const approval_1 = require("./resources/approval");
|
|
40
|
+
const draft_1 = require("./resources/draft");
|
|
41
|
+
const inbox_1 = require("./resources/inbox");
|
|
42
|
+
const savedReply_1 = require("./resources/savedReply");
|
|
43
|
+
const account_1 = require("./resources/account");
|
|
44
|
+
const analytics_1 = require("./resources/analytics");
|
|
45
|
+
const ai_1 = require("./resources/ai");
|
|
46
|
+
const team_1 = require("./resources/team");
|
|
47
|
+
const media_1 = require("./resources/media");
|
|
48
|
+
const biolink_1 = require("./resources/biolink");
|
|
49
|
+
const template_1 = require("./resources/template");
|
|
50
|
+
const support_1 = require("./resources/support");
|
|
51
|
+
const settings_1 = require("./resources/settings");
|
|
52
|
+
const webhook_1 = require("./resources/webhook");
|
|
53
|
+
class SoMe {
|
|
54
|
+
description = {
|
|
55
|
+
displayName: 'SoMe',
|
|
56
|
+
name: 'soMe',
|
|
57
|
+
icon: 'file:so-me.svg',
|
|
58
|
+
group: ['transform'],
|
|
59
|
+
version: 1,
|
|
60
|
+
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
|
61
|
+
description: 'Interact with the SoMe social media scheduling platform',
|
|
62
|
+
defaults: {
|
|
63
|
+
name: 'SoMe',
|
|
64
|
+
},
|
|
65
|
+
inputs: ['main'],
|
|
66
|
+
outputs: ['main'],
|
|
67
|
+
credentials: [
|
|
68
|
+
{
|
|
69
|
+
name: 'soMeApi',
|
|
70
|
+
required: true,
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
properties: [
|
|
74
|
+
{
|
|
75
|
+
displayName: 'Resource',
|
|
76
|
+
name: 'resource',
|
|
77
|
+
type: 'options',
|
|
78
|
+
noDataExpression: true,
|
|
79
|
+
options: [
|
|
80
|
+
{ name: 'Account', value: 'account' },
|
|
81
|
+
{ name: 'AI', value: 'ai' },
|
|
82
|
+
{ name: 'Analytics', value: 'analytics' },
|
|
83
|
+
{ name: 'Approval', value: 'approval' },
|
|
84
|
+
{ name: 'Biolink', value: 'biolink' },
|
|
85
|
+
{ name: 'Draft', value: 'draft' },
|
|
86
|
+
{ name: 'Inbox', value: 'inbox' },
|
|
87
|
+
{ name: 'Media', value: 'media' },
|
|
88
|
+
{ name: 'Post', value: 'post' },
|
|
89
|
+
{ name: 'Post Comment', value: 'postComment' },
|
|
90
|
+
{ name: 'Saved Reply', value: 'savedReply' },
|
|
91
|
+
{ name: 'Settings', value: 'settings' },
|
|
92
|
+
{ name: 'Support', value: 'support' },
|
|
93
|
+
{ name: 'Team', value: 'team' },
|
|
94
|
+
{ name: 'Template', value: 'template' },
|
|
95
|
+
{ name: 'Webhook', value: 'webhook' },
|
|
96
|
+
],
|
|
97
|
+
default: 'post',
|
|
98
|
+
},
|
|
99
|
+
...post_1.postOperations,
|
|
100
|
+
...post_1.postFields,
|
|
101
|
+
...postComment_1.postCommentOperations,
|
|
102
|
+
...postComment_1.postCommentFields,
|
|
103
|
+
...approval_1.approvalOperations,
|
|
104
|
+
...approval_1.approvalFields,
|
|
105
|
+
...draft_1.draftOperations,
|
|
106
|
+
...draft_1.draftFields,
|
|
107
|
+
...inbox_1.inboxOperations,
|
|
108
|
+
...inbox_1.inboxFields,
|
|
109
|
+
...savedReply_1.savedReplyOperations,
|
|
110
|
+
...savedReply_1.savedReplyFields,
|
|
111
|
+
...account_1.accountOperations,
|
|
112
|
+
...account_1.accountFields,
|
|
113
|
+
...analytics_1.analyticsOperations,
|
|
114
|
+
...analytics_1.analyticsFields,
|
|
115
|
+
...ai_1.aiOperations,
|
|
116
|
+
...ai_1.aiFields,
|
|
117
|
+
...team_1.teamOperations,
|
|
118
|
+
...team_1.teamFields,
|
|
119
|
+
...media_1.mediaOperations,
|
|
120
|
+
...media_1.mediaFields,
|
|
121
|
+
...biolink_1.biolinkOperations,
|
|
122
|
+
...biolink_1.biolinkFields,
|
|
123
|
+
...template_1.templateOperations,
|
|
124
|
+
...template_1.templateFields,
|
|
125
|
+
...support_1.supportOperations,
|
|
126
|
+
...support_1.supportFields,
|
|
127
|
+
...settings_1.settingsOperations,
|
|
128
|
+
...settings_1.settingsFields,
|
|
129
|
+
...webhook_1.webhookOperations,
|
|
130
|
+
...webhook_1.webhookFields,
|
|
131
|
+
],
|
|
132
|
+
};
|
|
133
|
+
async execute() {
|
|
134
|
+
const items = this.getInputData();
|
|
135
|
+
const returnData = [];
|
|
136
|
+
const resource = this.getNodeParameter('resource', 0);
|
|
137
|
+
const operation = this.getNodeParameter('operation', 0);
|
|
138
|
+
const credentials = await this.getCredentials('soMeApi');
|
|
139
|
+
const baseUrl = credentials.baseUrl.replace(/\/+$/, '');
|
|
140
|
+
for (let i = 0; i < items.length; i++) {
|
|
141
|
+
try {
|
|
142
|
+
let responseData;
|
|
143
|
+
// Resource routing will be added when resource files are created
|
|
144
|
+
// Each resource file exports an execute function
|
|
145
|
+
const { executeResource } = await Promise.resolve(`${`./resources/${resource}`}`).then(s => __importStar(require(s)));
|
|
146
|
+
responseData = await executeResource.call(this, operation, i, baseUrl);
|
|
147
|
+
const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
|
|
148
|
+
returnData.push(...executionData);
|
|
149
|
+
}
|
|
150
|
+
catch (error) {
|
|
151
|
+
if (this.continueOnFail()) {
|
|
152
|
+
returnData.push({
|
|
153
|
+
json: { error: error.message },
|
|
154
|
+
pairedItem: { item: i },
|
|
155
|
+
});
|
|
156
|
+
continue;
|
|
157
|
+
}
|
|
158
|
+
throw error;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return [returnData];
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
exports.SoMe = SoMe;
|
|
165
|
+
//# sourceMappingURL=SoMe.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SoMe.node.js","sourceRoot":"","sources":["../../../nodes/SoMe/SoMe.node.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;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AAe,CAAC,OAAO,EAAE;wBACzC,UAAU,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;qBACxB,CAAC,CAAC;oBACH,SAAS;gBACX,CAAC;gBACD,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC;QAED,OAAO,CAAC,UAAU,CAAC,CAAC;IACtB,CAAC;CACF;AArHD,oBAqHC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { IHookFunctions, IWebhookFunctions, INodeType, INodeTypeDescription, IWebhookResponseData } from 'n8n-workflow';
|
|
2
|
+
export declare class SoMeTrigger implements INodeType {
|
|
3
|
+
description: INodeTypeDescription;
|
|
4
|
+
webhookMethods: {
|
|
5
|
+
default: {
|
|
6
|
+
checkExists(this: IHookFunctions): Promise<boolean>;
|
|
7
|
+
create(this: IHookFunctions): Promise<boolean>;
|
|
8
|
+
delete(this: IHookFunctions): Promise<boolean>;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
webhook(this: IWebhookFunctions): Promise<IWebhookResponseData>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SoMeTrigger = void 0;
|
|
4
|
+
class SoMeTrigger {
|
|
5
|
+
description = {
|
|
6
|
+
displayName: 'SoMe Trigger',
|
|
7
|
+
name: 'soMeTrigger',
|
|
8
|
+
icon: 'file:so-me.svg',
|
|
9
|
+
group: ['trigger'],
|
|
10
|
+
version: 1,
|
|
11
|
+
subtitle: '={{$parameter["events"].join(", ")}}',
|
|
12
|
+
description: 'Starts the workflow when SoMe events occur',
|
|
13
|
+
defaults: {
|
|
14
|
+
name: 'SoMe Trigger',
|
|
15
|
+
},
|
|
16
|
+
inputs: [],
|
|
17
|
+
outputs: ['main'],
|
|
18
|
+
credentials: [
|
|
19
|
+
{
|
|
20
|
+
name: 'soMeApi',
|
|
21
|
+
required: true,
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
webhooks: [
|
|
25
|
+
{
|
|
26
|
+
name: 'default',
|
|
27
|
+
httpMethod: 'POST',
|
|
28
|
+
responseMode: 'onReceived',
|
|
29
|
+
path: 'webhook',
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
properties: [
|
|
33
|
+
{
|
|
34
|
+
displayName: 'Events',
|
|
35
|
+
name: 'events',
|
|
36
|
+
type: 'multiOptions',
|
|
37
|
+
required: true,
|
|
38
|
+
default: [],
|
|
39
|
+
options: [
|
|
40
|
+
// Post Events
|
|
41
|
+
{ name: 'Post Created', value: 'post.created' },
|
|
42
|
+
{ name: 'Post Published', value: 'post.published' },
|
|
43
|
+
{ name: 'Post Failed', value: 'post.failed' },
|
|
44
|
+
{ name: 'Post Deleted', value: 'post.deleted' },
|
|
45
|
+
{ name: 'Post Updated', value: 'post.updated' },
|
|
46
|
+
{ name: 'Post Approved', value: 'post.approved' },
|
|
47
|
+
{ name: 'Post Rejected', value: 'post.rejected' },
|
|
48
|
+
{ name: 'Post Resubmitted', value: 'post.resubmitted' },
|
|
49
|
+
{ name: 'Post Retried', value: 'post.retried' },
|
|
50
|
+
// Inbox Events
|
|
51
|
+
{ name: 'Inbox Message Received', value: 'inbox.message_received' },
|
|
52
|
+
{ name: 'Inbox Conversation Created', value: 'inbox.conversation_created' },
|
|
53
|
+
{ name: 'Inbox Comment Received', value: 'inbox.comment_received' },
|
|
54
|
+
{ name: 'Inbox Comment Hidden', value: 'inbox.comment_hidden' },
|
|
55
|
+
// Account Events
|
|
56
|
+
{ name: 'Account Connected', value: 'account.connected' },
|
|
57
|
+
{ name: 'Account Disconnected', value: 'account.disconnected' },
|
|
58
|
+
// Subscription Events
|
|
59
|
+
{ name: 'Subscription Created', value: 'subscription.created' },
|
|
60
|
+
{ name: 'Subscription Canceled', value: 'subscription.canceled' },
|
|
61
|
+
{ name: 'Subscription Plan Changed', value: 'subscription.plan_changed' },
|
|
62
|
+
{ name: 'Subscription Payment Failed', value: 'subscription.payment_failed' },
|
|
63
|
+
{ name: 'Subscription Expired', value: 'subscription.expired' },
|
|
64
|
+
// AI Events
|
|
65
|
+
{ name: 'AI Image Generated', value: 'ai.image_generated' },
|
|
66
|
+
{ name: 'AI Video Generated', value: 'ai.video_generated' },
|
|
67
|
+
// Team Events
|
|
68
|
+
{ name: 'Team Member Joined', value: 'team.member_joined' },
|
|
69
|
+
{ name: 'Team Member Removed', value: 'team.member_removed' },
|
|
70
|
+
// Support Events
|
|
71
|
+
{ name: 'Support Ticket Reply', value: 'support.ticket_reply' },
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
};
|
|
76
|
+
webhookMethods = {
|
|
77
|
+
default: {
|
|
78
|
+
async checkExists() {
|
|
79
|
+
const webhookData = this.getWorkflowStaticData('node');
|
|
80
|
+
return !!webhookData.subscriptionId;
|
|
81
|
+
},
|
|
82
|
+
async create() {
|
|
83
|
+
const webhookUrl = this.getNodeWebhookUrl('default');
|
|
84
|
+
const events = this.getNodeParameter('events');
|
|
85
|
+
const credentials = await this.getCredentials('soMeApi');
|
|
86
|
+
const baseUrl = credentials.baseUrl.replace(/\/+$/, '');
|
|
87
|
+
const categories = [...new Set(events.map((e) => e.split('.')[0]))];
|
|
88
|
+
const response = await this.helpers.httpRequest({
|
|
89
|
+
method: 'POST',
|
|
90
|
+
url: `${baseUrl}/v1/webhooks/subscriptions`,
|
|
91
|
+
headers: { 'X-API-Key': credentials.apiKey },
|
|
92
|
+
body: {
|
|
93
|
+
url: webhookUrl,
|
|
94
|
+
categories,
|
|
95
|
+
description: `n8n workflow trigger`,
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
const webhookData = this.getWorkflowStaticData('node');
|
|
99
|
+
webhookData.subscriptionId = response.id;
|
|
100
|
+
return true;
|
|
101
|
+
},
|
|
102
|
+
async delete() {
|
|
103
|
+
const webhookData = this.getWorkflowStaticData('node');
|
|
104
|
+
const subscriptionId = webhookData.subscriptionId;
|
|
105
|
+
if (!subscriptionId)
|
|
106
|
+
return true;
|
|
107
|
+
const credentials = await this.getCredentials('soMeApi');
|
|
108
|
+
const baseUrl = credentials.baseUrl.replace(/\/+$/, '');
|
|
109
|
+
try {
|
|
110
|
+
await this.helpers.httpRequest({
|
|
111
|
+
method: 'DELETE',
|
|
112
|
+
url: `${baseUrl}/v1/webhooks/subscriptions/${subscriptionId}`,
|
|
113
|
+
headers: { 'X-API-Key': credentials.apiKey },
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
// Subscription may already be deleted
|
|
118
|
+
}
|
|
119
|
+
delete webhookData.subscriptionId;
|
|
120
|
+
return true;
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
async webhook() {
|
|
125
|
+
const bodyData = this.getBodyData();
|
|
126
|
+
return {
|
|
127
|
+
workflowData: [this.helpers.returnJsonArray(bodyData)],
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
exports.SoMeTrigger = SoMeTrigger;
|
|
132
|
+
//# sourceMappingURL=SoMeTrigger.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SoMeTrigger.node.js","sourceRoot":"","sources":["../../../nodes/SoMe/SoMeTrigger.node.ts"],"names":[],"mappings":";;;AAQA,MAAa,WAAW;IACtB,WAAW,GAAyB;QAClC,WAAW,EAAE,cAAc;QAC3B,IAAI,EAAE,aAAa;QACnB,IAAI,EAAE,gBAAgB;QACtB,KAAK,EAAE,CAAC,SAAS,CAAC;QAClB,OAAO,EAAE,CAAC;QACV,QAAQ,EAAE,sCAAsC;QAChD,WAAW,EAAE,4CAA4C;QACzD,QAAQ,EAAE;YACR,IAAI,EAAE,cAAc;SACrB;QACD,MAAM,EAAE,EAAE;QACV,OAAO,EAAE,CAAC,MAAM,CAAC;QACjB,WAAW,EAAE;YACX;gBACE,IAAI,EAAE,SAAS;gBACf,QAAQ,EAAE,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AE,QAAQ;wBAChB,GAAG,EAAE,GAAG,OAAO,8BAA8B,cAAc,EAAE;wBAC7D,OAAO,EAAE,EAAE,WAAW,EAAE,WAAW,CAAC,MAAgB,EAAE;qBACvD,CAAC,CAAC;gBACL,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,sCAAsC;gBACxC,CAAC;gBAED,OAAO,WAAW,CAAC,cAAc,CAAC;gBAClC,OAAO,IAAI,CAAC;YACd,CAAC;SACF;KACF,CAAC;IAEF,KAAK,CAAC,OAAO;QACX,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QACpC,OAAO;YACL,YAAY,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;SACvD,CAAC;IACJ,CAAC;CACF;AApID,kCAoIC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { IExecuteFunctions, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare const accountOperations: INodeProperties[];
|
|
3
|
+
export declare const accountFields: INodeProperties[];
|
|
4
|
+
export declare function executeResource(this: IExecuteFunctions, operation: string, itemIndex: number, baseUrl: string): Promise<any>;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.accountFields = exports.accountOperations = void 0;
|
|
4
|
+
exports.executeResource = executeResource;
|
|
5
|
+
exports.accountOperations = [
|
|
6
|
+
{
|
|
7
|
+
displayName: 'Operation',
|
|
8
|
+
name: 'operation',
|
|
9
|
+
type: 'options',
|
|
10
|
+
noDataExpression: true,
|
|
11
|
+
displayOptions: { show: { resource: ['account'] } },
|
|
12
|
+
options: [
|
|
13
|
+
{ name: 'List', value: 'list', action: 'List accounts' },
|
|
14
|
+
{ name: 'Get', value: 'get', action: 'Get an account' },
|
|
15
|
+
{ name: 'Disconnect', value: 'disconnect', action: 'Disconnect an account' },
|
|
16
|
+
],
|
|
17
|
+
default: 'list',
|
|
18
|
+
},
|
|
19
|
+
];
|
|
20
|
+
exports.accountFields = [
|
|
21
|
+
// ── List ──
|
|
22
|
+
{
|
|
23
|
+
displayName: 'Platform',
|
|
24
|
+
name: 'platform',
|
|
25
|
+
type: 'options',
|
|
26
|
+
default: '',
|
|
27
|
+
description: 'Filter accounts by platform (optional)',
|
|
28
|
+
options: [
|
|
29
|
+
{ name: 'All', value: '' },
|
|
30
|
+
{ name: 'Twitter/X', value: 'twitter' },
|
|
31
|
+
{ name: 'Instagram', value: 'instagram' },
|
|
32
|
+
{ name: 'LinkedIn', value: 'linkedin' },
|
|
33
|
+
{ name: 'LinkedIn Page', value: 'linkedin-page' },
|
|
34
|
+
{ name: 'Facebook', value: 'facebook' },
|
|
35
|
+
{ name: 'TikTok', value: 'tiktok' },
|
|
36
|
+
{ name: 'YouTube', value: 'youtube' },
|
|
37
|
+
{ name: 'Threads', value: 'threads' },
|
|
38
|
+
{ name: 'WhatsApp', value: 'whatsapp' },
|
|
39
|
+
],
|
|
40
|
+
displayOptions: { show: { resource: ['account'], operation: ['list'] } },
|
|
41
|
+
},
|
|
42
|
+
// ── Get ──
|
|
43
|
+
{
|
|
44
|
+
displayName: 'Account ID',
|
|
45
|
+
name: 'id',
|
|
46
|
+
type: 'string',
|
|
47
|
+
required: true,
|
|
48
|
+
default: '',
|
|
49
|
+
description: 'The ID of the account',
|
|
50
|
+
displayOptions: { show: { resource: ['account'], operation: ['get'] } },
|
|
51
|
+
},
|
|
52
|
+
// ── Disconnect ──
|
|
53
|
+
{
|
|
54
|
+
displayName: 'Account ID',
|
|
55
|
+
name: 'id',
|
|
56
|
+
type: 'string',
|
|
57
|
+
required: true,
|
|
58
|
+
default: '',
|
|
59
|
+
description: 'The ID of the account to disconnect',
|
|
60
|
+
displayOptions: { show: { resource: ['account'], operation: ['disconnect'] } },
|
|
61
|
+
},
|
|
62
|
+
];
|
|
63
|
+
async function executeResource(operation, itemIndex, baseUrl) {
|
|
64
|
+
if (operation === 'list') {
|
|
65
|
+
const platform = this.getNodeParameter('platform', itemIndex, '');
|
|
66
|
+
const qs = {};
|
|
67
|
+
if (platform)
|
|
68
|
+
qs.platform = platform;
|
|
69
|
+
return this.helpers.httpRequestWithAuthentication.call(this, 'soMeApi', {
|
|
70
|
+
method: 'GET',
|
|
71
|
+
url: `${baseUrl}/v1/accounts`,
|
|
72
|
+
qs,
|
|
73
|
+
json: true,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
if (operation === 'get') {
|
|
77
|
+
const id = this.getNodeParameter('id', itemIndex);
|
|
78
|
+
return this.helpers.httpRequestWithAuthentication.call(this, 'soMeApi', {
|
|
79
|
+
method: 'GET',
|
|
80
|
+
url: `${baseUrl}/v1/accounts/${id}`,
|
|
81
|
+
json: true,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
if (operation === 'disconnect') {
|
|
85
|
+
const id = this.getNodeParameter('id', itemIndex);
|
|
86
|
+
return this.helpers.httpRequestWithAuthentication.call(this, 'soMeApi', {
|
|
87
|
+
method: 'DELETE',
|
|
88
|
+
url: `${baseUrl}/v1/accounts/${id}`,
|
|
89
|
+
json: true,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
throw new Error(`Unsupported account operation: ${operation}`);
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=account.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account.js","sourceRoot":"","sources":["../../../../nodes/SoMe/resources/account.ts"],"names":[],"mappings":";;;AAgEA,0CAqCC;AAnGY,QAAA,iBAAiB,GAAsB;IAClD;QACE,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,IAAI;QACtB,cAAc,EAAE,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,SAAS,CAAC,EAAE,EAAE;QACnD,OAAO,EAAE;YACP,EAAE,IAAI,EAAE,MAA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AC,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE;YACtE,MAAM,EAAE,KAAK;YACb,GAAG,EAAE,GAAG,OAAO,gBAAgB,EAAE,EAAE;YACnC,IAAI,EAAE,IAAI;SACX,CAAC,CAAC;IACL,CAAC;IAED,IAAI,SAAS,KAAK,YAAY,EAAE,CAAC;QAC/B,MAAM,EAAE,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,SAAS,CAAW,CAAC;QAC5D,OAAO,IAAI,CAAC,OAAO,CAAC,6BAA6B,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE;YACtE,MAAM,EAAE,QAAQ;YAChB,GAAG,EAAE,GAAG,OAAO,gBAAgB,EAAE,EAAE;YACnC,IAAI,EAAE,IAAI;SACX,CAAC,CAAC;IACL,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,kCAAkC,SAAS,EAAE,CAAC,CAAC;AACjE,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { IExecuteFunctions, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare const aiOperations: INodeProperties[];
|
|
3
|
+
export declare const aiFields: INodeProperties[];
|
|
4
|
+
export declare function executeResource(this: IExecuteFunctions, operation: string, itemIndex: number, baseUrl: string): Promise<any>;
|