runline 0.2.1 → 0.2.2
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/dist/plugins/actionNetwork/src/index.js +118 -25
- package/dist/plugins/activeCampaign/src/index.js +184 -38
- package/dist/plugins/adalo/src/index.js +40 -8
- package/dist/plugins/affinity/src/index.js +100 -20
- package/dist/plugins/agileCrm/src/index.js +115 -27
- package/dist/plugins/airtable/src/index.js +94 -19
- package/dist/plugins/airtop/src/index.js +266 -62
- package/dist/plugins/apiTemplateIo/src/index.js +25 -5
- package/dist/plugins/asana/src/index.js +195 -41
- package/dist/plugins/autopilot/src/index.js +39 -8
- package/dist/plugins/bambooHr/src/index.js +109 -22
- package/dist/plugins/bannerbear/src/index.js +36 -8
- package/dist/plugins/baserow/src/index.js +35 -7
- package/dist/plugins/beeminder/src/index.js +198 -40
- package/dist/plugins/bitly/src/index.js +46 -10
- package/dist/plugins/bitwarden/src/index.js +167 -36
- package/dist/plugins/box/src/index.js +172 -37
- package/dist/plugins/brandfetch/src/index.js +5 -1
- package/dist/plugins/brevo/src/index.js +136 -29
- package/dist/plugins/bubble/src/index.js +76 -17
- package/dist/plugins/chargebee/src/index.js +35 -7
- package/dist/plugins/circleci/src/index.js +50 -10
- package/dist/plugins/ciscoWebex/src/index.js +131 -27
- package/dist/plugins/clearbit/src/index.js +76 -17
- package/dist/plugins/clickup/src/index.js +500 -107
- package/dist/plugins/clockify/src/index.js +229 -47
- package/dist/plugins/cloudflare/src/index.js +28 -6
- package/dist/plugins/cockpit/src/index.js +54 -12
- package/dist/plugins/coda/src/index.js +81 -19
- package/dist/plugins/coingecko/src/index.js +157 -33
- package/dist/plugins/contentful/src/index.js +85 -17
- package/dist/plugins/convertkit/src/index.js +74 -18
- package/dist/plugins/copper/src/index.js +59 -11
- package/dist/plugins/cortex/src/index.js +55 -13
- package/dist/plugins/currents/src/index.js +310 -71
- package/dist/plugins/customerIo/src/index.js +112 -23
- package/dist/plugins/databricks/src/index.js +549 -115
- package/dist/plugins/deepl/src/index.js +26 -6
- package/dist/plugins/demio/src/index.js +56 -11
- package/dist/plugins/dhl/src/index.js +16 -3
- package/dist/plugins/discord/src/index.js +141 -31
- package/dist/plugins/discourse/src/index.js +136 -31
- package/dist/plugins/disqus/src/index.js +96 -20
- package/dist/plugins/docker/src/index.js +20 -4
- package/dist/plugins/drift/src/index.js +19 -5
- package/dist/plugins/dropbox/src/index.js +139 -30
- package/dist/plugins/dropcontact/src/index.js +21 -4
- package/dist/plugins/egoi/src/index.js +61 -15
- package/dist/plugins/elasticsearch/src/index.js +59 -13
- package/dist/plugins/emelia/src/index.js +95 -19
- package/dist/plugins/erpnext/src/index.js +74 -15
- package/dist/plugins/facebookGraph/src/index.js +52 -11
- package/dist/plugins/freshdesk/src/index.js +220 -48
- package/dist/plugins/freshservice/src/index.js +39 -9
- package/dist/plugins/freshworksCrm/src/index.js +58 -12
- package/dist/plugins/getresponse/src/index.js +87 -18
- package/dist/plugins/ghost/src/index.js +114 -26
- package/dist/plugins/github/src/index.js +483 -109
- package/dist/plugins/gitlab/src/index.js +193 -45
- package/dist/plugins/gong/src/index.js +68 -14
- package/dist/plugins/gotify/src/index.js +43 -9
- package/dist/plugins/gotowebinar/src/index.js +233 -47
- package/dist/plugins/grafana/src/index.js +92 -21
- package/dist/plugins/graphql/src/index.js +38 -8
- package/dist/plugins/grist/src/index.js +52 -10
- package/dist/plugins/hackernews/src/index.js +32 -6
- package/dist/plugins/halopsa/src/index.js +131 -26
- package/dist/plugins/harvest/src/index.js +182 -42
- package/dist/plugins/helpscout/src/index.js +153 -31
- package/dist/plugins/highlevel/src/index.js +291 -58
- package/dist/plugins/homeAssistant/src/index.js +124 -26
- package/dist/plugins/hubspot/src/index.js +163 -29
- package/dist/plugins/humanticAi/src/index.js +54 -5
- package/dist/plugins/hunter/src/index.js +21 -4
- package/dist/plugins/intercom/src/index.js +95 -20
- package/dist/plugins/iterable/src/index.js +96 -20
- package/dist/plugins/jenkins/src/index.js +75 -17
- package/dist/plugins/jira/src/index.js +193 -43
- package/dist/plugins/keap/src/index.js +222 -56
- package/dist/plugins/kobotoolbox/src/index.js +113 -25
- package/dist/plugins/lemlist/src/index.js +79 -18
- package/dist/plugins/linear/src/index.js +86 -19
- package/dist/plugins/lingvanex/src/index.js +38 -8
- package/dist/plugins/linkedin/src/index.js +37 -8
- package/dist/plugins/lonescale/src/index.js +41 -9
- package/dist/plugins/magento/src/index.js +98 -27
- package/dist/plugins/mailcheck/src/index.js +11 -2
- package/dist/plugins/mailchimp/src/index.js +193 -42
- package/dist/plugins/mailerlite/src/index.js +61 -12
- package/dist/plugins/mailgun/src/index.js +39 -7
- package/dist/plugins/mailjet/src/index.js +141 -30
- package/dist/plugins/mandrill/src/index.js +67 -14
- package/dist/plugins/marketstack/src/index.js +56 -10
- package/dist/plugins/matrix/src/index.js +97 -20
- package/dist/plugins/mattermost/src/index.js +124 -26
- package/dist/plugins/mautic/src/index.js +129 -26
- package/dist/plugins/medium/src/index.js +64 -13
- package/dist/plugins/messagebird/src/index.js +80 -15
- package/dist/plugins/metabase/src/index.js +57 -12
- package/dist/plugins/misp/src/index.js +135 -33
- package/dist/plugins/mocean/src/index.js +33 -7
- package/dist/plugins/monday/src/index.js +97 -23
- package/dist/plugins/monicaCrm/src/index.js +112 -23
- package/dist/plugins/msg91/src/index.js +11 -2
- package/dist/plugins/nasa/src/index.js +108 -21
- package/dist/plugins/netlify/src/index.js +28 -6
- package/dist/plugins/netscalerAdc/src/index.js +144 -29
- package/dist/plugins/nextcloud/src/index.js +103 -20
- package/dist/plugins/nocodb/src/index.js +57 -11
- package/dist/plugins/notion/src/index.js +148 -37
- package/dist/plugins/npm/src/index.js +59 -12
- package/dist/plugins/odoo/src/index.js +102 -20
- package/dist/plugins/okta/src/index.js +50 -10
- package/dist/plugins/oneSimpleApi/src/index.js +84 -17
- package/dist/plugins/onfleet/src/index.js +139 -32
- package/dist/plugins/openThesaurus/src/index.js +46 -9
- package/dist/plugins/openweathermap/src/index.js +31 -6
- package/dist/plugins/oura/src/index.js +36 -7
- package/dist/plugins/paddle/src/index.js +80 -17
- package/dist/plugins/pagerduty/src/index.js +53 -12
- package/dist/plugins/paypal/src/index.js +51 -11
- package/dist/plugins/peekalink/src/index.js +12 -3
- package/dist/plugins/phantombuster/src/index.js +39 -8
- package/dist/plugins/philipsHue/src/index.js +64 -13
- package/dist/plugins/pipedrive/src/index.js +167 -45
- package/dist/plugins/plivo/src/index.js +43 -8
- package/dist/plugins/postbin/src/index.js +9 -2
- package/dist/plugins/posthog/src/index.js +50 -13
- package/dist/plugins/profitwell/src/index.js +24 -5
- package/dist/plugins/pushbullet/src/index.js +45 -9
- package/dist/plugins/pushcut/src/index.js +31 -6
- package/dist/plugins/pushover/src/index.js +51 -10
- package/dist/plugins/quickbase/src/index.js +66 -13
- package/dist/plugins/quickbooks/src/index.js +86 -19
- package/dist/plugins/quickchart/src/index.js +35 -7
- package/dist/plugins/raindrop/src/index.js +54 -13
- package/dist/plugins/reddit/src/index.js +73 -18
- package/dist/plugins/rocketchat/src/index.js +47 -9
- package/dist/plugins/rundeck/src/index.js +26 -5
- package/dist/plugins/salesforce/src/index.js +161 -31
- package/dist/plugins/salesmate/src/index.js +75 -16
- package/dist/plugins/securityScorecard/src/index.js +73 -15
- package/dist/plugins/segment/src/index.js +21 -4
- package/dist/plugins/sendgrid/src/index.js +102 -24
- package/dist/plugins/sendy/src/index.js +54 -11
- package/dist/plugins/sentry/src/index.js +174 -34
- package/dist/plugins/servicenow/src/index.js +120 -27
- package/dist/plugins/shopify/src/index.js +53 -12
- package/dist/plugins/signl4/src/index.js +16 -3
- package/dist/plugins/slack/src/index.js +407 -105
- package/dist/plugins/sms77/src/index.js +26 -5
- package/dist/plugins/splunk/src/index.js +186 -45
- package/dist/plugins/spotify/src/index.js +265 -66
- package/dist/plugins/stackby/src/index.js +18 -6
- package/dist/plugins/storyblok/src/index.js +57 -11
- package/dist/plugins/strapi/src/index.js +63 -12
- package/dist/plugins/strava/src/index.js +58 -13
- package/dist/plugins/stripe/src/index.js +143 -30
- package/dist/plugins/supabase/src/index.js +49 -10
- package/dist/plugins/syncromsp/src/index.js +245 -67
- package/dist/plugins/tapfiliate/src/index.js +57 -14
- package/dist/plugins/telegram/src/index.js +202 -39
- package/dist/plugins/thehive/src/index.js +271 -66
- package/dist/plugins/thehiveProject/src/index.js +457 -89
- package/dist/plugins/todoist/src/index.js +326 -77
- package/dist/plugins/travisci/src/index.js +35 -8
- package/dist/plugins/trello/src/index.js +204 -46
- package/dist/plugins/twake/src/index.js +10 -2
- package/dist/plugins/twilio/src/index.js +56 -11
- package/dist/plugins/twist/src/index.js +241 -48
- package/dist/plugins/twitter/src/index.js +128 -30
- package/dist/plugins/unleashedSoftware/src/index.js +30 -6
- package/dist/plugins/uplead/src/index.js +9 -2
- package/dist/plugins/uproc/src/index.js +31 -6
- package/dist/plugins/uptimerobot/src/index.js +119 -25
- package/dist/plugins/urlscanio/src/index.js +25 -6
- package/dist/plugins/vero/src/index.js +68 -13
- package/dist/plugins/vonage/src/index.js +32 -6
- package/dist/plugins/wekan/src/index.js +297 -52
- package/dist/plugins/woocommerce/src/index.js +57 -12
- package/dist/plugins/wordpress/src/index.js +94 -18
- package/dist/plugins/xero/src/index.js +79 -13
- package/dist/plugins/yourls/src/index.js +33 -6
- package/dist/plugins/zammad/src/index.js +139 -36
- package/dist/plugins/zendesk/src/index.js +201 -48
- package/dist/plugins/zoho/src/index.js +88 -21
- package/dist/plugins/zoom/src/index.js +41 -7
- package/dist/plugins/zulip/src/index.js +101 -20
- package/package.json +1 -1
|
@@ -7,7 +7,13 @@ async function api(token, method, endpoint, body, qs) {
|
|
|
7
7
|
url.searchParams.set(k, String(v));
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
-
const init = {
|
|
10
|
+
const init = {
|
|
11
|
+
method,
|
|
12
|
+
headers: {
|
|
13
|
+
Authorization: `Bearer ${token}`,
|
|
14
|
+
"Content-Type": "application/json",
|
|
15
|
+
},
|
|
16
|
+
};
|
|
11
17
|
if (body && Object.keys(body).length > 0)
|
|
12
18
|
init.body = JSON.stringify(body);
|
|
13
19
|
const res = await fetch(url.toString(), init);
|
|
@@ -18,73 +24,260 @@ async function api(token, method, endpoint, body, qs) {
|
|
|
18
24
|
export default function twist(rl) {
|
|
19
25
|
rl.setName("twist");
|
|
20
26
|
rl.setVersion("0.1.0");
|
|
21
|
-
rl.setConnectionSchema({
|
|
27
|
+
rl.setConnectionSchema({
|
|
28
|
+
accessToken: {
|
|
29
|
+
type: "string",
|
|
30
|
+
required: true,
|
|
31
|
+
description: "Twist OAuth2 access token",
|
|
32
|
+
env: "TWIST_ACCESS_TOKEN",
|
|
33
|
+
},
|
|
34
|
+
});
|
|
22
35
|
const t = (ctx) => ctx.connection.config.accessToken;
|
|
23
36
|
// ── Channel ─────────────────────────────────────────
|
|
24
|
-
rl.registerAction("channel.create", {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
37
|
+
rl.registerAction("channel.create", {
|
|
38
|
+
description: "Create a channel",
|
|
39
|
+
inputSchema: {
|
|
40
|
+
workspaceId: { type: "number", required: true },
|
|
41
|
+
name: { type: "string", required: true },
|
|
42
|
+
},
|
|
43
|
+
async execute(input, ctx) {
|
|
44
|
+
return api(t(ctx), "POST", "/channels/add", {
|
|
45
|
+
workspace_id: input.workspaceId,
|
|
46
|
+
name: input.name,
|
|
47
|
+
});
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
rl.registerAction("channel.get", {
|
|
51
|
+
description: "Get a channel",
|
|
52
|
+
inputSchema: { id: { type: "number", required: true } },
|
|
53
|
+
async execute(input, ctx) {
|
|
54
|
+
return api(t(ctx), "GET", "/channels/getone", undefined, {
|
|
55
|
+
id: input.id,
|
|
56
|
+
});
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
rl.registerAction("channel.list", {
|
|
60
|
+
description: "List channels in a workspace",
|
|
61
|
+
inputSchema: {
|
|
62
|
+
workspaceId: { type: "number", required: true },
|
|
63
|
+
limit: { type: "number", required: false },
|
|
64
|
+
},
|
|
29
65
|
async execute(input, ctx) {
|
|
30
66
|
const p = input;
|
|
31
|
-
const data = (await api(t(ctx), "GET", "/channels/get", undefined, {
|
|
67
|
+
const data = (await api(t(ctx), "GET", "/channels/get", undefined, {
|
|
68
|
+
workspace_id: p.workspaceId,
|
|
69
|
+
}));
|
|
32
70
|
return p.limit ? data.slice(0, p.limit) : data;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
rl.registerAction("channel.update", {
|
|
74
|
+
description: "Update a channel",
|
|
75
|
+
inputSchema: {
|
|
76
|
+
id: { type: "number", required: true },
|
|
77
|
+
name: { type: "string", required: false },
|
|
78
|
+
description: { type: "string", required: false },
|
|
79
|
+
},
|
|
80
|
+
async execute(input, ctx) {
|
|
81
|
+
return api(t(ctx), "POST", "/channels/update", input);
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
rl.registerAction("channel.delete", {
|
|
85
|
+
description: "Delete a channel",
|
|
86
|
+
inputSchema: { id: { type: "number", required: true } },
|
|
87
|
+
async execute(input, ctx) {
|
|
88
|
+
return api(t(ctx), "POST", "/channels/remove", undefined, {
|
|
89
|
+
id: input.id,
|
|
90
|
+
});
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
rl.registerAction("channel.archive", {
|
|
94
|
+
description: "Archive a channel",
|
|
95
|
+
inputSchema: { id: { type: "number", required: true } },
|
|
96
|
+
async execute(input, ctx) {
|
|
97
|
+
return api(t(ctx), "POST", "/channels/archive", undefined, {
|
|
98
|
+
id: input.id,
|
|
99
|
+
});
|
|
100
|
+
},
|
|
101
|
+
});
|
|
102
|
+
rl.registerAction("channel.unarchive", {
|
|
103
|
+
description: "Unarchive a channel",
|
|
104
|
+
inputSchema: { id: { type: "number", required: true } },
|
|
105
|
+
async execute(input, ctx) {
|
|
106
|
+
return api(t(ctx), "POST", "/channels/unarchive", undefined, {
|
|
107
|
+
id: input.id,
|
|
108
|
+
});
|
|
109
|
+
},
|
|
110
|
+
});
|
|
42
111
|
// ── Thread ──────────────────────────────────────────
|
|
43
|
-
rl.registerAction("thread.create", {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
112
|
+
rl.registerAction("thread.create", {
|
|
113
|
+
description: "Create a thread",
|
|
114
|
+
inputSchema: {
|
|
115
|
+
channelId: { type: "number", required: true },
|
|
116
|
+
title: { type: "string", required: true },
|
|
117
|
+
content: { type: "string", required: true },
|
|
118
|
+
},
|
|
119
|
+
async execute(input, ctx) {
|
|
120
|
+
const p = input;
|
|
121
|
+
return api(t(ctx), "POST", "/threads/add", {
|
|
122
|
+
channel_id: p.channelId,
|
|
123
|
+
title: p.title,
|
|
124
|
+
content: p.content,
|
|
125
|
+
});
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
rl.registerAction("thread.get", {
|
|
129
|
+
description: "Get a thread",
|
|
130
|
+
inputSchema: { id: { type: "number", required: true } },
|
|
131
|
+
async execute(input, ctx) {
|
|
132
|
+
return api(t(ctx), "GET", "/threads/getone", undefined, {
|
|
133
|
+
id: input.id,
|
|
134
|
+
});
|
|
135
|
+
},
|
|
136
|
+
});
|
|
137
|
+
rl.registerAction("thread.list", {
|
|
138
|
+
description: "List threads in a channel",
|
|
139
|
+
inputSchema: {
|
|
140
|
+
channelId: { type: "number", required: true },
|
|
141
|
+
limit: { type: "number", required: false },
|
|
142
|
+
},
|
|
48
143
|
async execute(input, ctx) {
|
|
49
144
|
const p = input;
|
|
50
145
|
const qs = { channel_id: p.channelId };
|
|
51
146
|
if (p.limit)
|
|
52
147
|
qs.limit = p.limit;
|
|
53
148
|
return api(t(ctx), "GET", "/threads/get", undefined, qs);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
149
|
+
},
|
|
150
|
+
});
|
|
151
|
+
rl.registerAction("thread.update", {
|
|
152
|
+
description: "Update a thread",
|
|
153
|
+
inputSchema: {
|
|
154
|
+
id: { type: "number", required: true },
|
|
155
|
+
title: { type: "string", required: false },
|
|
156
|
+
content: { type: "string", required: false },
|
|
157
|
+
},
|
|
158
|
+
async execute(input, ctx) {
|
|
159
|
+
return api(t(ctx), "POST", "/threads/update", input);
|
|
160
|
+
},
|
|
161
|
+
});
|
|
162
|
+
rl.registerAction("thread.delete", {
|
|
163
|
+
description: "Delete a thread",
|
|
164
|
+
inputSchema: { id: { type: "number", required: true } },
|
|
165
|
+
async execute(input, ctx) {
|
|
166
|
+
return api(t(ctx), "POST", "/threads/remove", undefined, {
|
|
167
|
+
id: input.id,
|
|
168
|
+
});
|
|
169
|
+
},
|
|
170
|
+
});
|
|
59
171
|
// ── Comment ─────────────────────────────────────────
|
|
60
|
-
rl.registerAction("comment.create", {
|
|
61
|
-
|
|
62
|
-
|
|
172
|
+
rl.registerAction("comment.create", {
|
|
173
|
+
description: "Add a comment to a thread",
|
|
174
|
+
inputSchema: {
|
|
175
|
+
threadId: { type: "number", required: true },
|
|
176
|
+
content: { type: "string", required: true },
|
|
177
|
+
},
|
|
63
178
|
async execute(input, ctx) {
|
|
64
|
-
const
|
|
179
|
+
const p = input;
|
|
180
|
+
return api(t(ctx), "POST", "/comments/add", {
|
|
181
|
+
thread_id: p.threadId,
|
|
182
|
+
content: p.content,
|
|
183
|
+
});
|
|
184
|
+
},
|
|
185
|
+
});
|
|
186
|
+
rl.registerAction("comment.get", {
|
|
187
|
+
description: "Get a comment",
|
|
188
|
+
inputSchema: { id: { type: "number", required: true } },
|
|
189
|
+
async execute(input, ctx) {
|
|
190
|
+
const data = (await api(t(ctx), "GET", "/comments/getone", undefined, {
|
|
191
|
+
id: input.id,
|
|
192
|
+
}));
|
|
65
193
|
return data.comment ?? data;
|
|
66
|
-
}
|
|
67
|
-
|
|
194
|
+
},
|
|
195
|
+
});
|
|
196
|
+
rl.registerAction("comment.list", {
|
|
197
|
+
description: "List comments in a thread",
|
|
198
|
+
inputSchema: {
|
|
199
|
+
threadId: { type: "number", required: true },
|
|
200
|
+
limit: { type: "number", required: false },
|
|
201
|
+
},
|
|
68
202
|
async execute(input, ctx) {
|
|
69
203
|
const p = input;
|
|
70
204
|
const qs = { thread_id: p.threadId };
|
|
71
205
|
if (p.limit)
|
|
72
206
|
qs.limit = p.limit;
|
|
73
207
|
return api(t(ctx), "GET", "/comments/get", undefined, qs);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
208
|
+
},
|
|
209
|
+
});
|
|
210
|
+
rl.registerAction("comment.update", {
|
|
211
|
+
description: "Update a comment",
|
|
212
|
+
inputSchema: {
|
|
213
|
+
id: { type: "number", required: true },
|
|
214
|
+
content: { type: "string", required: false },
|
|
215
|
+
},
|
|
216
|
+
async execute(input, ctx) {
|
|
217
|
+
return api(t(ctx), "POST", "/comments/update", input);
|
|
218
|
+
},
|
|
219
|
+
});
|
|
220
|
+
rl.registerAction("comment.delete", {
|
|
221
|
+
description: "Delete a comment",
|
|
222
|
+
inputSchema: { id: { type: "number", required: true } },
|
|
223
|
+
async execute(input, ctx) {
|
|
224
|
+
return api(t(ctx), "POST", "/comments/remove", undefined, {
|
|
225
|
+
id: input.id,
|
|
226
|
+
});
|
|
227
|
+
},
|
|
228
|
+
});
|
|
79
229
|
// ── Message Conversation ────────────────────────────
|
|
80
|
-
rl.registerAction("messageConversation.create", {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
async execute(input, ctx) {
|
|
88
|
-
|
|
89
|
-
|
|
230
|
+
rl.registerAction("messageConversation.create", {
|
|
231
|
+
description: "Send a message in a conversation",
|
|
232
|
+
inputSchema: {
|
|
233
|
+
workspaceId: { type: "number", required: true },
|
|
234
|
+
conversationId: { type: "number", required: true },
|
|
235
|
+
content: { type: "string", required: true },
|
|
236
|
+
},
|
|
237
|
+
async execute(input, ctx) {
|
|
238
|
+
const p = input;
|
|
239
|
+
return api(t(ctx), "POST", "/conversation_messages/add", {
|
|
240
|
+
workspace_id: p.workspaceId,
|
|
241
|
+
conversation_id: p.conversationId,
|
|
242
|
+
content: p.content,
|
|
243
|
+
});
|
|
244
|
+
},
|
|
245
|
+
});
|
|
246
|
+
rl.registerAction("messageConversation.get", {
|
|
247
|
+
description: "Get a conversation message",
|
|
248
|
+
inputSchema: { id: { type: "number", required: true } },
|
|
249
|
+
async execute(input, ctx) {
|
|
250
|
+
return api(t(ctx), "GET", "/conversation_messages/getone", undefined, {
|
|
251
|
+
id: input.id,
|
|
252
|
+
});
|
|
253
|
+
},
|
|
254
|
+
});
|
|
255
|
+
rl.registerAction("messageConversation.list", {
|
|
256
|
+
description: "List messages in a conversation",
|
|
257
|
+
inputSchema: { conversationId: { type: "number", required: true } },
|
|
258
|
+
async execute(input, ctx) {
|
|
259
|
+
return api(t(ctx), "GET", "/conversation_messages/get", undefined, {
|
|
260
|
+
conversation_id: input.conversationId,
|
|
261
|
+
});
|
|
262
|
+
},
|
|
263
|
+
});
|
|
264
|
+
rl.registerAction("messageConversation.update", {
|
|
265
|
+
description: "Update a conversation message",
|
|
266
|
+
inputSchema: {
|
|
267
|
+
id: { type: "number", required: true },
|
|
268
|
+
content: { type: "string", required: false },
|
|
269
|
+
},
|
|
270
|
+
async execute(input, ctx) {
|
|
271
|
+
return api(t(ctx), "POST", "/conversation_messages/update", input);
|
|
272
|
+
},
|
|
273
|
+
});
|
|
274
|
+
rl.registerAction("messageConversation.delete", {
|
|
275
|
+
description: "Delete a conversation message",
|
|
276
|
+
inputSchema: { id: { type: "number", required: true } },
|
|
277
|
+
async execute(input, ctx) {
|
|
278
|
+
return api(t(ctx), "POST", "/conversation_messages/remove", undefined, {
|
|
279
|
+
id: input.id,
|
|
280
|
+
});
|
|
281
|
+
},
|
|
282
|
+
});
|
|
90
283
|
}
|
|
@@ -7,13 +7,19 @@ async function api(token, method, endpoint, body, qs, fullOutput = false) {
|
|
|
7
7
|
url.searchParams.set(k, String(v));
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
-
const init = {
|
|
10
|
+
const init = {
|
|
11
|
+
method,
|
|
12
|
+
headers: {
|
|
13
|
+
Authorization: `Bearer ${token}`,
|
|
14
|
+
"Content-Type": "application/json",
|
|
15
|
+
},
|
|
16
|
+
};
|
|
11
17
|
if (body && Object.keys(body).length > 0)
|
|
12
18
|
init.body = JSON.stringify(body);
|
|
13
19
|
const res = await fetch(url.toString(), init);
|
|
14
20
|
if (!res.ok)
|
|
15
21
|
throw new Error(`Twitter error ${res.status}: ${await res.text()}`);
|
|
16
|
-
const json = await res.json();
|
|
22
|
+
const json = (await res.json());
|
|
17
23
|
return fullOutput ? json : json.data;
|
|
18
24
|
}
|
|
19
25
|
async function paginate(token, endpoint, qs = {}, limit) {
|
|
@@ -23,7 +29,7 @@ async function paginate(token, endpoint, qs = {}, limit) {
|
|
|
23
29
|
do {
|
|
24
30
|
if (nextToken)
|
|
25
31
|
qs.next_token = nextToken;
|
|
26
|
-
const res = await api(token, "GET", endpoint, undefined, { ...qs }, true);
|
|
32
|
+
const res = (await api(token, "GET", endpoint, undefined, { ...qs }, true));
|
|
27
33
|
const data = res.data;
|
|
28
34
|
if (data)
|
|
29
35
|
results.push(...data);
|
|
@@ -37,11 +43,33 @@ async function paginate(token, endpoint, qs = {}, limit) {
|
|
|
37
43
|
export default function twitter(rl) {
|
|
38
44
|
rl.setName("twitter");
|
|
39
45
|
rl.setVersion("0.1.0");
|
|
40
|
-
rl.setConnectionSchema({
|
|
46
|
+
rl.setConnectionSchema({
|
|
47
|
+
bearerToken: {
|
|
48
|
+
type: "string",
|
|
49
|
+
required: true,
|
|
50
|
+
description: "OAuth2 Bearer token for Twitter/X API v2",
|
|
51
|
+
env: "TWITTER_BEARER_TOKEN",
|
|
52
|
+
},
|
|
53
|
+
});
|
|
41
54
|
const t = (ctx) => ctx.connection.config.bearerToken;
|
|
42
55
|
// ── Tweet ───────────────────────────────────────────
|
|
43
|
-
rl.registerAction("tweet.create", {
|
|
44
|
-
|
|
56
|
+
rl.registerAction("tweet.create", {
|
|
57
|
+
description: "Create a tweet (post, quote, or reply)",
|
|
58
|
+
inputSchema: {
|
|
59
|
+
text: { type: "string", required: true },
|
|
60
|
+
quoteTweetId: {
|
|
61
|
+
type: "string",
|
|
62
|
+
required: false,
|
|
63
|
+
description: "Tweet ID to quote",
|
|
64
|
+
},
|
|
65
|
+
replyToTweetId: {
|
|
66
|
+
type: "string",
|
|
67
|
+
required: false,
|
|
68
|
+
description: "Tweet ID to reply to",
|
|
69
|
+
},
|
|
70
|
+
mediaId: { type: "string", required: false },
|
|
71
|
+
placeId: { type: "string", required: false },
|
|
72
|
+
},
|
|
45
73
|
async execute(input, ctx) {
|
|
46
74
|
const p = input;
|
|
47
75
|
const body = { text: p.text };
|
|
@@ -54,23 +82,61 @@ export default function twitter(rl) {
|
|
|
54
82
|
if (p.placeId)
|
|
55
83
|
body.geo = { place_id: p.placeId };
|
|
56
84
|
return api(t(ctx), "POST", "/tweets", body);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
rl.registerAction("tweet.delete", {
|
|
88
|
+
description: "Delete a tweet",
|
|
89
|
+
inputSchema: { id: { type: "string", required: true } },
|
|
90
|
+
async execute(input, ctx) {
|
|
91
|
+
return api(t(ctx), "DELETE", `/tweets/${input.id}`);
|
|
92
|
+
},
|
|
93
|
+
});
|
|
94
|
+
rl.registerAction("tweet.like", {
|
|
95
|
+
description: "Like a tweet (requires user context)",
|
|
61
96
|
inputSchema: { tweetId: { type: "string", required: true } },
|
|
62
97
|
async execute(input, ctx) {
|
|
63
|
-
const user = await api(t(ctx), "GET", "/users/me");
|
|
64
|
-
return api(t(ctx), "POST", `/users/${user.id}/likes`, {
|
|
65
|
-
|
|
66
|
-
|
|
98
|
+
const user = (await api(t(ctx), "GET", "/users/me"));
|
|
99
|
+
return api(t(ctx), "POST", `/users/${user.id}/likes`, {
|
|
100
|
+
tweet_id: input.tweetId,
|
|
101
|
+
});
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
rl.registerAction("tweet.retweet", {
|
|
105
|
+
description: "Retweet a tweet (requires user context)",
|
|
67
106
|
inputSchema: { tweetId: { type: "string", required: true } },
|
|
68
107
|
async execute(input, ctx) {
|
|
69
|
-
const user = await api(t(ctx), "GET", "/users/me");
|
|
70
|
-
return api(t(ctx), "POST", `/users/${user.id}/retweets`, {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
108
|
+
const user = (await api(t(ctx), "GET", "/users/me"));
|
|
109
|
+
return api(t(ctx), "POST", `/users/${user.id}/retweets`, {
|
|
110
|
+
tweet_id: input.tweetId,
|
|
111
|
+
});
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
rl.registerAction("tweet.search", {
|
|
115
|
+
description: "Search recent tweets (last 7 days)",
|
|
116
|
+
inputSchema: {
|
|
117
|
+
query: { type: "string", required: true },
|
|
118
|
+
limit: {
|
|
119
|
+
type: "number",
|
|
120
|
+
required: false,
|
|
121
|
+
description: "Max results (default all)",
|
|
122
|
+
},
|
|
123
|
+
sortOrder: {
|
|
124
|
+
type: "string",
|
|
125
|
+
required: false,
|
|
126
|
+
description: "recency or relevancy",
|
|
127
|
+
},
|
|
128
|
+
startTime: {
|
|
129
|
+
type: "string",
|
|
130
|
+
required: false,
|
|
131
|
+
description: "ISO datetime",
|
|
132
|
+
},
|
|
133
|
+
endTime: { type: "string", required: false, description: "ISO datetime" },
|
|
134
|
+
tweetFields: {
|
|
135
|
+
type: "string",
|
|
136
|
+
required: false,
|
|
137
|
+
description: "Comma-separated fields like author_id,created_at,public_metrics",
|
|
138
|
+
},
|
|
139
|
+
},
|
|
74
140
|
async execute(input, ctx) {
|
|
75
141
|
const p = input;
|
|
76
142
|
const qs = { query: p.query };
|
|
@@ -87,10 +153,24 @@ export default function twitter(rl) {
|
|
|
87
153
|
return paginate(t(ctx), "/tweets/search/recent", qs, limit);
|
|
88
154
|
}
|
|
89
155
|
return paginate(t(ctx), "/tweets/search/recent", qs);
|
|
90
|
-
}
|
|
156
|
+
},
|
|
157
|
+
});
|
|
91
158
|
// ── User ────────────────────────────────────────────
|
|
92
|
-
rl.registerAction("user.get", {
|
|
93
|
-
|
|
159
|
+
rl.registerAction("user.get", {
|
|
160
|
+
description: "Get a user by username or ID",
|
|
161
|
+
inputSchema: {
|
|
162
|
+
username: {
|
|
163
|
+
type: "string",
|
|
164
|
+
required: false,
|
|
165
|
+
description: "Username (without @)",
|
|
166
|
+
},
|
|
167
|
+
id: { type: "string", required: false, description: "User ID" },
|
|
168
|
+
me: {
|
|
169
|
+
type: "boolean",
|
|
170
|
+
required: false,
|
|
171
|
+
description: "Get the authenticated user",
|
|
172
|
+
},
|
|
173
|
+
},
|
|
94
174
|
async execute(input, ctx) {
|
|
95
175
|
const p = input;
|
|
96
176
|
if (p.me)
|
|
@@ -102,22 +182,40 @@ export default function twitter(rl) {
|
|
|
102
182
|
if (p.id)
|
|
103
183
|
return api(t(ctx), "GET", `/users/${p.id}`);
|
|
104
184
|
throw new Error("Provide username, id, or set me=true");
|
|
105
|
-
}
|
|
185
|
+
},
|
|
186
|
+
});
|
|
106
187
|
// ── List ────────────────────────────────────────────
|
|
107
|
-
rl.registerAction("list.addMember", {
|
|
108
|
-
|
|
188
|
+
rl.registerAction("list.addMember", {
|
|
189
|
+
description: "Add a user to a list",
|
|
190
|
+
inputSchema: {
|
|
191
|
+
listId: { type: "string", required: true },
|
|
192
|
+
userId: { type: "string", required: true, description: "User ID to add" },
|
|
193
|
+
},
|
|
109
194
|
async execute(input, ctx) {
|
|
110
195
|
const p = input;
|
|
111
|
-
return api(t(ctx), "POST", `/lists/${p.listId}/members`, {
|
|
112
|
-
|
|
196
|
+
return api(t(ctx), "POST", `/lists/${p.listId}/members`, {
|
|
197
|
+
user_id: p.userId,
|
|
198
|
+
});
|
|
199
|
+
},
|
|
200
|
+
});
|
|
113
201
|
// ── Direct Message ──────────────────────────────────
|
|
114
|
-
rl.registerAction("dm.create", {
|
|
115
|
-
|
|
202
|
+
rl.registerAction("dm.create", {
|
|
203
|
+
description: "Send a direct message to a user",
|
|
204
|
+
inputSchema: {
|
|
205
|
+
userId: {
|
|
206
|
+
type: "string",
|
|
207
|
+
required: true,
|
|
208
|
+
description: "Recipient user ID",
|
|
209
|
+
},
|
|
210
|
+
text: { type: "string", required: true },
|
|
211
|
+
mediaId: { type: "string", required: false },
|
|
212
|
+
},
|
|
116
213
|
async execute(input, ctx) {
|
|
117
214
|
const p = input;
|
|
118
215
|
const body = { text: p.text };
|
|
119
216
|
if (p.mediaId)
|
|
120
217
|
body.attachments = [{ media_id: p.mediaId }];
|
|
121
218
|
return api(t(ctx), "POST", `/dm_conversations/with/${p.userId}/messages`, body);
|
|
122
|
-
}
|
|
219
|
+
},
|
|
220
|
+
});
|
|
123
221
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { createHmac } from "node:crypto";
|
|
2
2
|
const BASE = "https://api.unleashedsoftware.com";
|
|
3
3
|
function getConn(ctx) {
|
|
4
|
-
return {
|
|
4
|
+
return {
|
|
5
|
+
apiId: ctx.connection.config.apiId,
|
|
6
|
+
apiKey: ctx.connection.config.apiKey,
|
|
7
|
+
};
|
|
5
8
|
}
|
|
6
9
|
function buildQs(params) {
|
|
7
10
|
const parts = [];
|
|
@@ -14,11 +17,18 @@ function buildQs(params) {
|
|
|
14
17
|
async function apiRequest(conn, method, endpoint, qs, page) {
|
|
15
18
|
const path = page ? `${endpoint}/${page}` : endpoint;
|
|
16
19
|
const qsString = qs ? buildQs(qs) : "";
|
|
17
|
-
const signature = createHmac("sha256", conn.apiKey)
|
|
20
|
+
const signature = createHmac("sha256", conn.apiKey)
|
|
21
|
+
.update(qsString)
|
|
22
|
+
.digest("base64");
|
|
18
23
|
const url = qsString ? `${BASE}${path}?${qsString}` : `${BASE}${path}`;
|
|
19
24
|
const res = await fetch(url, {
|
|
20
25
|
method,
|
|
21
|
-
headers: {
|
|
26
|
+
headers: {
|
|
27
|
+
Accept: "application/json",
|
|
28
|
+
"Content-Type": "application/json",
|
|
29
|
+
"api-auth-id": conn.apiId,
|
|
30
|
+
"api-auth-signature": signature,
|
|
31
|
+
},
|
|
22
32
|
});
|
|
23
33
|
if (!res.ok)
|
|
24
34
|
throw new Error(`Unleashed error ${res.status}: ${await res.text()}`);
|
|
@@ -28,8 +38,18 @@ export default function unleashedSoftware(rl) {
|
|
|
28
38
|
rl.setName("unleashedSoftware");
|
|
29
39
|
rl.setVersion("0.1.0");
|
|
30
40
|
rl.setConnectionSchema({
|
|
31
|
-
apiId: {
|
|
32
|
-
|
|
41
|
+
apiId: {
|
|
42
|
+
type: "string",
|
|
43
|
+
required: true,
|
|
44
|
+
description: "Unleashed API ID",
|
|
45
|
+
env: "UNLEASHED_API_ID",
|
|
46
|
+
},
|
|
47
|
+
apiKey: {
|
|
48
|
+
type: "string",
|
|
49
|
+
required: true,
|
|
50
|
+
description: "Unleashed API Key",
|
|
51
|
+
env: "UNLEASHED_API_KEY",
|
|
52
|
+
},
|
|
33
53
|
});
|
|
34
54
|
rl.registerAction("salesOrder.list", {
|
|
35
55
|
description: "List sales orders",
|
|
@@ -37,7 +57,11 @@ export default function unleashedSoftware(rl) {
|
|
|
37
57
|
limit: { type: "number", required: false },
|
|
38
58
|
startDate: { type: "string", required: false, description: "YYYY-MM-DD" },
|
|
39
59
|
endDate: { type: "string", required: false, description: "YYYY-MM-DD" },
|
|
40
|
-
orderStatus: {
|
|
60
|
+
orderStatus: {
|
|
61
|
+
type: "string",
|
|
62
|
+
required: false,
|
|
63
|
+
description: "Comma-separated statuses",
|
|
64
|
+
},
|
|
41
65
|
},
|
|
42
66
|
async execute(input, ctx) {
|
|
43
67
|
const p = (input ?? {});
|
|
@@ -5,7 +5,9 @@ async function apiRequest(apiKey, endpoint, qs) {
|
|
|
5
5
|
if (v !== undefined && v !== null)
|
|
6
6
|
url.searchParams.set(k, String(v));
|
|
7
7
|
}
|
|
8
|
-
const res = await fetch(url.toString(), {
|
|
8
|
+
const res = await fetch(url.toString(), {
|
|
9
|
+
headers: { Authorization: apiKey },
|
|
10
|
+
});
|
|
9
11
|
if (!res.ok)
|
|
10
12
|
throw new Error(`Uplead error ${res.status}: ${await res.text()}`);
|
|
11
13
|
const data = (await res.json());
|
|
@@ -15,7 +17,12 @@ export default function uplead(rl) {
|
|
|
15
17
|
rl.setName("uplead");
|
|
16
18
|
rl.setVersion("0.1.0");
|
|
17
19
|
rl.setConnectionSchema({
|
|
18
|
-
apiKey: {
|
|
20
|
+
apiKey: {
|
|
21
|
+
type: "string",
|
|
22
|
+
required: true,
|
|
23
|
+
description: "Uplead API key",
|
|
24
|
+
env: "UPLEAD_API_KEY",
|
|
25
|
+
},
|
|
19
26
|
});
|
|
20
27
|
const key = (ctx) => ctx.connection.config.apiKey;
|
|
21
28
|
rl.registerAction("person.enrich", {
|