@kgma/linkdevi-tools 0.0.0-stage → 0.2.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 +125 -2
- package/dist/campaign.d.ts +101 -0
- package/dist/campaign.js +162 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +139 -0
- package/dist/index.d.ts +83 -0
- package/dist/index.js +73 -0
- package/dist/utm.d.ts +24 -0
- package/dist/utm.js +101 -0
- package/examples/campaign.json +12 -0
- package/examples/github-actions/utm-lint.yml +25 -0
- package/examples/links.csv +2 -0
- package/examples/sdk-example.ts +13 -0
- package/examples/utm-links.csv +3 -0
- package/package.json +59 -4
- package/workflows/01-google-sheets-to-links.json +211 -0
- package/workflows/02-campaign-to-csv.json +164 -0
- package/workflows/03-rss-to-share-kit.json +242 -0
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "LinkDevi — Campaign brief to saved links and CSV",
|
|
3
|
+
"nodes": [
|
|
4
|
+
{
|
|
5
|
+
"id": "run-manually",
|
|
6
|
+
"name": "Run manually",
|
|
7
|
+
"type": "n8n-nodes-base.manualTrigger",
|
|
8
|
+
"typeVersion": 1,
|
|
9
|
+
"position": [
|
|
10
|
+
0,
|
|
11
|
+
0
|
|
12
|
+
],
|
|
13
|
+
"parameters": {}
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"id": "campaign-brief",
|
|
17
|
+
"name": "Campaign brief",
|
|
18
|
+
"type": "n8n-nodes-base.code",
|
|
19
|
+
"typeVersion": 2,
|
|
20
|
+
"position": [
|
|
21
|
+
250,
|
|
22
|
+
0
|
|
23
|
+
],
|
|
24
|
+
"parameters": {
|
|
25
|
+
"mode": "runOnceForAllItems",
|
|
26
|
+
"jsCode": "return [{json:{campaign:{requestId:'a43c37c0-350a-44ef-9d40-a5900c246891',name:'December launch',url:'https://example.com/sale',utmCampaign:'december-launch',domain:'linkdevi.com',channels:['facebook','line','print']}}}];"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"id": "create-saved-campaign",
|
|
31
|
+
"name": "Create saved campaign",
|
|
32
|
+
"type": "n8n-nodes-base.httpRequest",
|
|
33
|
+
"typeVersion": 4.3,
|
|
34
|
+
"position": [
|
|
35
|
+
500,
|
|
36
|
+
0
|
|
37
|
+
],
|
|
38
|
+
"parameters": {
|
|
39
|
+
"method": "POST",
|
|
40
|
+
"url": "https://linkdevi.com/api/v1/agent",
|
|
41
|
+
"authentication": "genericCredentialType",
|
|
42
|
+
"genericAuthType": "httpHeaderAuth",
|
|
43
|
+
"sendBody": true,
|
|
44
|
+
"specifyBody": "json",
|
|
45
|
+
"jsonBody": "={{ { action: 'create_campaign', campaign: $json.campaign } }}",
|
|
46
|
+
"options": {
|
|
47
|
+
"timeout": 25000,
|
|
48
|
+
"redirect": {
|
|
49
|
+
"redirect": {
|
|
50
|
+
"followRedirects": false
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"batching": {
|
|
54
|
+
"batch": {
|
|
55
|
+
"batchSize": 1,
|
|
56
|
+
"batchInterval": 2500
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"retryOnFail": false,
|
|
62
|
+
"onError": "stopWorkflow"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"id": "csv-rows",
|
|
66
|
+
"name": "CSV rows",
|
|
67
|
+
"type": "n8n-nodes-base.code",
|
|
68
|
+
"typeVersion": 2,
|
|
69
|
+
"position": [
|
|
70
|
+
750,
|
|
71
|
+
0
|
|
72
|
+
],
|
|
73
|
+
"parameters": {
|
|
74
|
+
"mode": "runOnceForAllItems",
|
|
75
|
+
"jsCode": "const safe = value => { const s=String(value ?? ''); return /^[\\s\\u0000-\\u001f]*[=+@-]/.test(s) ? \"'\"+s : s; };\nreturn $input.all().flatMap((item,index)=>{\n const c=item.json.campaign;\n if(!c || !Array.isArray(c.channels)) throw new Error('Missing saved campaign response');\n return c.channels.map(row=>({json:{campaign:safe(c.name),channel:row.key,short_url:row.link?.shortUrl ?? '',destination_url:row.link?.url ?? '',status:row.link?'saved':'unavailable'},pairedItem:{item:index}}));\n});"
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"id": "download-csv",
|
|
80
|
+
"name": "Download CSV",
|
|
81
|
+
"type": "n8n-nodes-base.convertToFile",
|
|
82
|
+
"typeVersion": 1.1,
|
|
83
|
+
"position": [
|
|
84
|
+
1000,
|
|
85
|
+
0
|
|
86
|
+
],
|
|
87
|
+
"parameters": {
|
|
88
|
+
"operation": "csv",
|
|
89
|
+
"binaryPropertyName": "data",
|
|
90
|
+
"options": {
|
|
91
|
+
"fileName": "linkdevi-campaign-links.csv",
|
|
92
|
+
"headerRow": true
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"id": "read-before-running",
|
|
98
|
+
"name": "Read before running",
|
|
99
|
+
"type": "n8n-nodes-base.stickyNote",
|
|
100
|
+
"typeVersion": 1,
|
|
101
|
+
"position": [
|
|
102
|
+
0,
|
|
103
|
+
-430
|
|
104
|
+
],
|
|
105
|
+
"parameters": {
|
|
106
|
+
"content": "## Setup\n1. Create a LinkDevi account, then a scoped key with links:read and links:write. Hosted plan limits apply.\n2. In Create saved campaign, select a Header Auth credential: header name Authorization, value Bearer YOUR_SCOPED_KEY. Keep the key only in n8n Credentials.\n3. Keep retries disabled. Redirects are disabled so credentials stay on the configured origin.\n4. Preview your data before running. Each selected channel uses one stored-link slot. A timeout may have committed: preserve requestId and the exact campaign payload on retry.\n5. These workflows do not call an LLM, send email, post to social media or enable a schedule. Activate only after reviewing your own setup.\nGuide: https://linkdevi.com/features/ai\n\n## Campaign brief\nReplace the example destination and names with your own. Use a NEW UUID for each NEW campaign. Keep the same UUID and unchanged fields after a timeout. This workflow creates one campaign when manually executed; it is not an offline preview. Download the binary data from Download CSV. Existing UTM values are replaced by the campaign service.",
|
|
107
|
+
"width": 700,
|
|
108
|
+
"height": 360
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
],
|
|
112
|
+
"connections": {
|
|
113
|
+
"Run manually": {
|
|
114
|
+
"main": [
|
|
115
|
+
[
|
|
116
|
+
{
|
|
117
|
+
"node": "Campaign brief",
|
|
118
|
+
"type": "main",
|
|
119
|
+
"index": 0
|
|
120
|
+
}
|
|
121
|
+
]
|
|
122
|
+
]
|
|
123
|
+
},
|
|
124
|
+
"Campaign brief": {
|
|
125
|
+
"main": [
|
|
126
|
+
[
|
|
127
|
+
{
|
|
128
|
+
"node": "Create saved campaign",
|
|
129
|
+
"type": "main",
|
|
130
|
+
"index": 0
|
|
131
|
+
}
|
|
132
|
+
]
|
|
133
|
+
]
|
|
134
|
+
},
|
|
135
|
+
"Create saved campaign": {
|
|
136
|
+
"main": [
|
|
137
|
+
[
|
|
138
|
+
{
|
|
139
|
+
"node": "CSV rows",
|
|
140
|
+
"type": "main",
|
|
141
|
+
"index": 0
|
|
142
|
+
}
|
|
143
|
+
]
|
|
144
|
+
]
|
|
145
|
+
},
|
|
146
|
+
"CSV rows": {
|
|
147
|
+
"main": [
|
|
148
|
+
[
|
|
149
|
+
{
|
|
150
|
+
"node": "Download CSV",
|
|
151
|
+
"type": "main",
|
|
152
|
+
"index": 0
|
|
153
|
+
}
|
|
154
|
+
]
|
|
155
|
+
]
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
"active": false,
|
|
159
|
+
"settings": {
|
|
160
|
+
"executionOrder": "v1"
|
|
161
|
+
},
|
|
162
|
+
"pinData": {},
|
|
163
|
+
"tags": []
|
|
164
|
+
}
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "LinkDevi — RSS articles to saved campaign share kits",
|
|
3
|
+
"nodes": [
|
|
4
|
+
{
|
|
5
|
+
"id": "run-manually",
|
|
6
|
+
"name": "Run manually",
|
|
7
|
+
"type": "n8n-nodes-base.manualTrigger",
|
|
8
|
+
"typeVersion": 1,
|
|
9
|
+
"position": [
|
|
10
|
+
0,
|
|
11
|
+
0
|
|
12
|
+
],
|
|
13
|
+
"parameters": {}
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"id": "read-rss",
|
|
17
|
+
"name": "Read RSS",
|
|
18
|
+
"type": "n8n-nodes-base.rssFeedRead",
|
|
19
|
+
"typeVersion": 1.1,
|
|
20
|
+
"position": [
|
|
21
|
+
250,
|
|
22
|
+
0
|
|
23
|
+
],
|
|
24
|
+
"parameters": {
|
|
25
|
+
"url": "https://example.com/feed.xml",
|
|
26
|
+
"options": {}
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"id": "prepare-article-identities",
|
|
31
|
+
"name": "Prepare article identities",
|
|
32
|
+
"type": "n8n-nodes-base.code",
|
|
33
|
+
"typeVersion": 2,
|
|
34
|
+
"position": [
|
|
35
|
+
500,
|
|
36
|
+
0
|
|
37
|
+
],
|
|
38
|
+
"parameters": {
|
|
39
|
+
"mode": "runOnceForAllItems",
|
|
40
|
+
"jsCode": "return $input.all().slice(0,5).map((item,index)=>{\n const r=item.json; const url=String(r.link??'');\n if(!/^https?:\\/\\//i.test(url) || /^https?:\\/\\/[^/]*@/i.test(url)) throw new Error('RSS item needs an http(s) URL without credentials');\n const guid=String(r.guid??r.id??url); if(!guid.trim()) throw new Error('Missing article identity');\n // Include the feed namespace to avoid unrelated feeds sharing a GUID.\n const feedNamespace='REPLACE_WITH_YOUR_FEED_NAMESPACE';\n const name=('Post: '+String(r.title??'Article')).replace(/[\\u0000-\\u001f\\u007f]/g,' ').slice(0,100);\n return {json:{identity:feedNamespace+'\\n'+guid,name,url},pairedItem:{item:index}};\n});"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"id": "hash-article-identity",
|
|
45
|
+
"name": "Hash article identity",
|
|
46
|
+
"type": "n8n-nodes-base.crypto",
|
|
47
|
+
"typeVersion": 1,
|
|
48
|
+
"position": [
|
|
49
|
+
750,
|
|
50
|
+
0
|
|
51
|
+
],
|
|
52
|
+
"parameters": {
|
|
53
|
+
"action": "hash",
|
|
54
|
+
"type": "SHA256",
|
|
55
|
+
"value": "={{ $json.identity }}",
|
|
56
|
+
"dataPropertyName": "digest",
|
|
57
|
+
"encoding": "hex"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"id": "prepare-article-campaigns",
|
|
62
|
+
"name": "Prepare article campaigns",
|
|
63
|
+
"type": "n8n-nodes-base.code",
|
|
64
|
+
"typeVersion": 2,
|
|
65
|
+
"position": [
|
|
66
|
+
1000,
|
|
67
|
+
0
|
|
68
|
+
],
|
|
69
|
+
"parameters": {
|
|
70
|
+
"mode": "runOnceForAllItems",
|
|
71
|
+
"jsCode": "return $input.all().map((item,index)=>{\n const h=String(item.json.digest); if(!/^[a-f0-9]{64}$/i.test(h)) throw new Error('Expected SHA256 article identity');\n const requestId=h.slice(0,8)+'-'+h.slice(8,12)+'-4'+h.slice(13,16)+'-8'+h.slice(17,20)+'-'+h.slice(20,32);\n return {json:{campaign:{requestId,name:item.json.name,url:item.json.url,utmCampaign:'article-share',domain:'linkdevi.com',channels:['facebook','line','email']}},pairedItem:{item:index}};\n});"
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"id": "create-saved-campaign",
|
|
76
|
+
"name": "Create saved campaign",
|
|
77
|
+
"type": "n8n-nodes-base.httpRequest",
|
|
78
|
+
"typeVersion": 4.3,
|
|
79
|
+
"position": [
|
|
80
|
+
1250,
|
|
81
|
+
0
|
|
82
|
+
],
|
|
83
|
+
"parameters": {
|
|
84
|
+
"method": "POST",
|
|
85
|
+
"url": "https://linkdevi.com/api/v1/agent",
|
|
86
|
+
"authentication": "genericCredentialType",
|
|
87
|
+
"genericAuthType": "httpHeaderAuth",
|
|
88
|
+
"sendBody": true,
|
|
89
|
+
"specifyBody": "json",
|
|
90
|
+
"jsonBody": "={{ { action: 'create_campaign', campaign: $json.campaign } }}",
|
|
91
|
+
"options": {
|
|
92
|
+
"timeout": 25000,
|
|
93
|
+
"redirect": {
|
|
94
|
+
"redirect": {
|
|
95
|
+
"followRedirects": false
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
"batching": {
|
|
99
|
+
"batch": {
|
|
100
|
+
"batchSize": 1,
|
|
101
|
+
"batchInterval": 2500
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
"retryOnFail": false,
|
|
107
|
+
"onError": "stopWorkflow"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"id": "csv-rows",
|
|
111
|
+
"name": "CSV rows",
|
|
112
|
+
"type": "n8n-nodes-base.code",
|
|
113
|
+
"typeVersion": 2,
|
|
114
|
+
"position": [
|
|
115
|
+
1500,
|
|
116
|
+
0
|
|
117
|
+
],
|
|
118
|
+
"parameters": {
|
|
119
|
+
"mode": "runOnceForAllItems",
|
|
120
|
+
"jsCode": "const safe = value => { const s=String(value ?? ''); return /^[\\s\\u0000-\\u001f]*[=+@-]/.test(s) ? \"'\"+s : s; };\nreturn $input.all().flatMap((item,index)=>{\n const c=item.json.campaign;\n if(!c || !Array.isArray(c.channels)) throw new Error('Missing saved campaign response');\n return c.channels.map(row=>({json:{campaign:safe(c.name),channel:row.key,short_url:row.link?.shortUrl ?? '',destination_url:row.link?.url ?? '',status:row.link?'saved':'unavailable'},pairedItem:{item:index}}));\n});"
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"id": "download-csv",
|
|
125
|
+
"name": "Download CSV",
|
|
126
|
+
"type": "n8n-nodes-base.convertToFile",
|
|
127
|
+
"typeVersion": 1.1,
|
|
128
|
+
"position": [
|
|
129
|
+
1750,
|
|
130
|
+
0
|
|
131
|
+
],
|
|
132
|
+
"parameters": {
|
|
133
|
+
"operation": "csv",
|
|
134
|
+
"binaryPropertyName": "data",
|
|
135
|
+
"options": {
|
|
136
|
+
"fileName": "linkdevi-campaign-links.csv",
|
|
137
|
+
"headerRow": true
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"id": "read-before-running",
|
|
143
|
+
"name": "Read before running",
|
|
144
|
+
"type": "n8n-nodes-base.stickyNote",
|
|
145
|
+
"typeVersion": 1,
|
|
146
|
+
"position": [
|
|
147
|
+
0,
|
|
148
|
+
-430
|
|
149
|
+
],
|
|
150
|
+
"parameters": {
|
|
151
|
+
"content": "## Setup\n1. Create a LinkDevi account, then a scoped key with links:read and links:write. Hosted plan limits apply.\n2. In Create saved campaign, select a Header Auth credential: header name Authorization, value Bearer YOUR_SCOPED_KEY. Keep the key only in n8n Credentials.\n3. Keep retries disabled. Redirects are disabled so credentials stay on the configured origin.\n4. Preview your data before running. Each selected channel uses one stored-link slot. A timeout may have committed: preserve requestId and the exact campaign payload on retry.\n5. These workflows do not call an LLM, send email, post to social media or enable a schedule. Activate only after reviewing your own setup.\nGuide: https://linkdevi.com/features/ai\n\n## RSS setup\nSet your actual feed URL and replace feedNamespace in Prepare article identities with a stable unique value for that feed. Process at most five entries per manual run. IDs are deterministically derived using the built-in Crypto node, so unchanged articles replay safely. Keep the namespace, title, destination and campaign settings stable across retries. An edited title/destination with the same identity conflicts: review it before intentionally starting a new intent. Repeat runs still use API requests even when no extra links are created. No social post is sent.",
|
|
152
|
+
"width": 700,
|
|
153
|
+
"height": 360
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
],
|
|
157
|
+
"connections": {
|
|
158
|
+
"Run manually": {
|
|
159
|
+
"main": [
|
|
160
|
+
[
|
|
161
|
+
{
|
|
162
|
+
"node": "Read RSS",
|
|
163
|
+
"type": "main",
|
|
164
|
+
"index": 0
|
|
165
|
+
}
|
|
166
|
+
]
|
|
167
|
+
]
|
|
168
|
+
},
|
|
169
|
+
"Read RSS": {
|
|
170
|
+
"main": [
|
|
171
|
+
[
|
|
172
|
+
{
|
|
173
|
+
"node": "Prepare article identities",
|
|
174
|
+
"type": "main",
|
|
175
|
+
"index": 0
|
|
176
|
+
}
|
|
177
|
+
]
|
|
178
|
+
]
|
|
179
|
+
},
|
|
180
|
+
"Prepare article identities": {
|
|
181
|
+
"main": [
|
|
182
|
+
[
|
|
183
|
+
{
|
|
184
|
+
"node": "Hash article identity",
|
|
185
|
+
"type": "main",
|
|
186
|
+
"index": 0
|
|
187
|
+
}
|
|
188
|
+
]
|
|
189
|
+
]
|
|
190
|
+
},
|
|
191
|
+
"Hash article identity": {
|
|
192
|
+
"main": [
|
|
193
|
+
[
|
|
194
|
+
{
|
|
195
|
+
"node": "Prepare article campaigns",
|
|
196
|
+
"type": "main",
|
|
197
|
+
"index": 0
|
|
198
|
+
}
|
|
199
|
+
]
|
|
200
|
+
]
|
|
201
|
+
},
|
|
202
|
+
"Prepare article campaigns": {
|
|
203
|
+
"main": [
|
|
204
|
+
[
|
|
205
|
+
{
|
|
206
|
+
"node": "Create saved campaign",
|
|
207
|
+
"type": "main",
|
|
208
|
+
"index": 0
|
|
209
|
+
}
|
|
210
|
+
]
|
|
211
|
+
]
|
|
212
|
+
},
|
|
213
|
+
"Create saved campaign": {
|
|
214
|
+
"main": [
|
|
215
|
+
[
|
|
216
|
+
{
|
|
217
|
+
"node": "CSV rows",
|
|
218
|
+
"type": "main",
|
|
219
|
+
"index": 0
|
|
220
|
+
}
|
|
221
|
+
]
|
|
222
|
+
]
|
|
223
|
+
},
|
|
224
|
+
"CSV rows": {
|
|
225
|
+
"main": [
|
|
226
|
+
[
|
|
227
|
+
{
|
|
228
|
+
"node": "Download CSV",
|
|
229
|
+
"type": "main",
|
|
230
|
+
"index": 0
|
|
231
|
+
}
|
|
232
|
+
]
|
|
233
|
+
]
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
"active": false,
|
|
237
|
+
"settings": {
|
|
238
|
+
"executionOrder": "v1"
|
|
239
|
+
},
|
|
240
|
+
"pinData": {},
|
|
241
|
+
"tags": []
|
|
242
|
+
}
|