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
|
@@ -13,13 +13,16 @@ async function api(token, method, endpoint, body, qs, version = "v2") {
|
|
|
13
13
|
url.searchParams.set(k, String(v));
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
const init = {
|
|
16
|
+
const init = {
|
|
17
|
+
method,
|
|
18
|
+
headers: { Accept: "application/json", "Content-Type": "application/json" },
|
|
19
|
+
};
|
|
17
20
|
if (body && Object.keys(body).length > 0)
|
|
18
21
|
init.body = JSON.stringify(body);
|
|
19
22
|
const res = await fetch(url.toString(), init);
|
|
20
23
|
if (!res.ok)
|
|
21
24
|
throw new Error(`Pipedrive error ${res.status}: ${await res.text()}`);
|
|
22
|
-
const json = await res.json();
|
|
25
|
+
const json = (await res.json());
|
|
23
26
|
if (json.success === false)
|
|
24
27
|
throw new Error(`Pipedrive: ${JSON.stringify(json)}`);
|
|
25
28
|
return json.data ?? json;
|
|
@@ -37,14 +40,17 @@ async function paginate(token, endpoint, qs = {}) {
|
|
|
37
40
|
if (v !== undefined && v !== null)
|
|
38
41
|
url.searchParams.set(k, String(v));
|
|
39
42
|
}
|
|
40
|
-
const res = await fetch(url.toString(), {
|
|
43
|
+
const res = await fetch(url.toString(), {
|
|
44
|
+
headers: { Accept: "application/json" },
|
|
45
|
+
});
|
|
41
46
|
if (!res.ok)
|
|
42
47
|
throw new Error(`Pipedrive error ${res.status}: ${await res.text()}`);
|
|
43
|
-
const json = await res.json();
|
|
48
|
+
const json = (await res.json());
|
|
44
49
|
const data = json.data;
|
|
45
50
|
if (Array.isArray(data))
|
|
46
51
|
results.push(...data);
|
|
47
|
-
cursor = json.additional_data
|
|
52
|
+
cursor = json.additional_data
|
|
53
|
+
?.next_cursor;
|
|
48
54
|
if (!cursor)
|
|
49
55
|
break;
|
|
50
56
|
} while (true);
|
|
@@ -53,13 +59,35 @@ async function paginate(token, endpoint, qs = {}) {
|
|
|
53
59
|
function registerCrud(rl, resource, endpoint, opts) {
|
|
54
60
|
const cap = resource.charAt(0).toUpperCase() + resource.slice(1);
|
|
55
61
|
const updateMethod = opts?.updateMethod ?? "PATCH";
|
|
56
|
-
rl.registerAction(`${resource}.create`, {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
62
|
+
rl.registerAction(`${resource}.create`, {
|
|
63
|
+
description: `Create a ${resource}`,
|
|
64
|
+
inputSchema: {
|
|
65
|
+
data: {
|
|
66
|
+
type: "object",
|
|
67
|
+
required: true,
|
|
68
|
+
description: `Fields for the new ${resource}`,
|
|
69
|
+
},
|
|
70
|
+
...(opts?.extraCreate ?? {}),
|
|
71
|
+
},
|
|
72
|
+
async execute(input, ctx) {
|
|
73
|
+
const t = getConn(ctx);
|
|
74
|
+
return api(t, "POST", endpoint, input.data);
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
rl.registerAction(`${resource}.get`, {
|
|
78
|
+
description: `Get a ${resource}`,
|
|
79
|
+
inputSchema: { id: { type: "number", required: true } },
|
|
80
|
+
async execute(input, ctx) {
|
|
81
|
+
const t = getConn(ctx);
|
|
82
|
+
return api(t, "GET", `${endpoint}/${input.id}`);
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
rl.registerAction(`${resource}.list`, {
|
|
86
|
+
description: `List ${resource}s`,
|
|
87
|
+
inputSchema: {
|
|
88
|
+
limit: { type: "number", required: false },
|
|
89
|
+
filterId: { type: "number", required: false },
|
|
90
|
+
},
|
|
63
91
|
async execute(input, ctx) {
|
|
64
92
|
const t = getConn(ctx);
|
|
65
93
|
const p = (input ?? {});
|
|
@@ -71,15 +99,43 @@ function registerCrud(rl, resource, endpoint, opts) {
|
|
|
71
99
|
return api(t, "GET", endpoint, undefined, qs);
|
|
72
100
|
}
|
|
73
101
|
return paginate(t, endpoint, qs);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
rl.registerAction(`${resource}.update`, {
|
|
105
|
+
description: `Update a ${resource}`,
|
|
106
|
+
inputSchema: {
|
|
107
|
+
id: { type: "number", required: true },
|
|
108
|
+
data: { type: "object", required: true, description: `Fields to update` },
|
|
109
|
+
...(opts?.extraUpdate ?? {}),
|
|
110
|
+
},
|
|
111
|
+
async execute(input, ctx) {
|
|
112
|
+
const t = getConn(ctx);
|
|
113
|
+
const p = input;
|
|
114
|
+
return api(t, updateMethod, `${endpoint}/${p.id}`, p.data);
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
rl.registerAction(`${resource}.delete`, {
|
|
118
|
+
description: `Delete a ${resource}`,
|
|
119
|
+
inputSchema: { id: { type: "number", required: true } },
|
|
120
|
+
async execute(input, ctx) {
|
|
121
|
+
const t = getConn(ctx);
|
|
122
|
+
await api(t, "DELETE", `${endpoint}/${input.id}`);
|
|
123
|
+
return { success: true };
|
|
124
|
+
},
|
|
125
|
+
});
|
|
80
126
|
if (opts?.hasSearch) {
|
|
81
|
-
rl.registerAction(`${resource}.search`, {
|
|
82
|
-
|
|
127
|
+
rl.registerAction(`${resource}.search`, {
|
|
128
|
+
description: `Search ${resource}s`,
|
|
129
|
+
inputSchema: {
|
|
130
|
+
term: { type: "string", required: true },
|
|
131
|
+
exactMatch: { type: "boolean", required: false },
|
|
132
|
+
limit: { type: "number", required: false },
|
|
133
|
+
fields: {
|
|
134
|
+
type: "string",
|
|
135
|
+
required: false,
|
|
136
|
+
description: "Comma-separated fields to search",
|
|
137
|
+
},
|
|
138
|
+
},
|
|
83
139
|
async execute(input, ctx) {
|
|
84
140
|
const t = getConn(ctx);
|
|
85
141
|
const p = input;
|
|
@@ -91,37 +147,74 @@ function registerCrud(rl, resource, endpoint, opts) {
|
|
|
91
147
|
if (p.fields)
|
|
92
148
|
qs.fields = p.fields;
|
|
93
149
|
// Search uses v1 API
|
|
94
|
-
const res = await api(t, "GET", `${endpoint}/search`, undefined, qs, "v1");
|
|
150
|
+
const res = (await api(t, "GET", `${endpoint}/search`, undefined, qs, "v1"));
|
|
95
151
|
if (Array.isArray(res))
|
|
96
152
|
return res.map((r) => r.item ?? r);
|
|
97
153
|
return res;
|
|
98
|
-
}
|
|
154
|
+
},
|
|
155
|
+
});
|
|
99
156
|
}
|
|
100
157
|
if (opts?.hasDuplicate) {
|
|
101
|
-
rl.registerAction(`${resource}.duplicate`, {
|
|
102
|
-
|
|
158
|
+
rl.registerAction(`${resource}.duplicate`, {
|
|
159
|
+
description: `Duplicate a ${resource}`,
|
|
160
|
+
inputSchema: { id: { type: "number", required: true } },
|
|
161
|
+
async execute(input, ctx) {
|
|
162
|
+
const t = getConn(ctx);
|
|
163
|
+
return api(t, "POST", `${endpoint}/${input.id}/duplicate`);
|
|
164
|
+
},
|
|
165
|
+
});
|
|
103
166
|
}
|
|
104
167
|
}
|
|
105
168
|
export default function pipedrive(rl) {
|
|
106
169
|
rl.setName("pipedrive");
|
|
107
170
|
rl.setVersion("0.1.0");
|
|
108
171
|
rl.setConnectionSchema({
|
|
109
|
-
apiToken: {
|
|
172
|
+
apiToken: {
|
|
173
|
+
type: "string",
|
|
174
|
+
required: true,
|
|
175
|
+
description: "Pipedrive API token",
|
|
176
|
+
env: "PIPEDRIVE_API_TOKEN",
|
|
177
|
+
},
|
|
110
178
|
});
|
|
111
179
|
// ── Activity ────────────────────────────────────────
|
|
112
180
|
registerCrud(rl, "activity", "/activities");
|
|
113
181
|
// ── Deal ────────────────────────────────────────────
|
|
114
182
|
registerCrud(rl, "deal", "/deals", { hasSearch: true, hasDuplicate: true });
|
|
115
183
|
// ── Deal Product ────────────────────────────────────
|
|
116
|
-
rl.registerAction("dealProduct.add", {
|
|
117
|
-
|
|
184
|
+
rl.registerAction("dealProduct.add", {
|
|
185
|
+
description: "Add a product to a deal",
|
|
186
|
+
inputSchema: {
|
|
187
|
+
dealId: { type: "number", required: true },
|
|
188
|
+
productId: { type: "number", required: true },
|
|
189
|
+
itemPrice: { type: "number", required: true },
|
|
190
|
+
quantity: { type: "number", required: true },
|
|
191
|
+
discount: { type: "number", required: false },
|
|
192
|
+
discountType: {
|
|
193
|
+
type: "string",
|
|
194
|
+
required: false,
|
|
195
|
+
description: "percentage or amount",
|
|
196
|
+
},
|
|
197
|
+
comments: { type: "string", required: false },
|
|
198
|
+
},
|
|
118
199
|
async execute(input, ctx) {
|
|
119
200
|
const t = getConn(ctx);
|
|
120
201
|
const { dealId, ...body } = input;
|
|
121
|
-
return api(t, "POST", `/deals/${dealId}/products`, {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
202
|
+
return api(t, "POST", `/deals/${dealId}/products`, {
|
|
203
|
+
product_id: body.productId,
|
|
204
|
+
item_price: body.itemPrice,
|
|
205
|
+
quantity: body.quantity,
|
|
206
|
+
...(body.discount !== undefined ? { discount: body.discount } : {}),
|
|
207
|
+
...(body.discountType ? { discount_type: body.discountType } : {}),
|
|
208
|
+
...(body.comments ? { comments: body.comments } : {}),
|
|
209
|
+
});
|
|
210
|
+
},
|
|
211
|
+
});
|
|
212
|
+
rl.registerAction("dealProduct.list", {
|
|
213
|
+
description: "List products of a deal",
|
|
214
|
+
inputSchema: {
|
|
215
|
+
dealId: { type: "number", required: true },
|
|
216
|
+
limit: { type: "number", required: false },
|
|
217
|
+
},
|
|
125
218
|
async execute(input, ctx) {
|
|
126
219
|
const t = getConn(ctx);
|
|
127
220
|
const p = input;
|
|
@@ -129,33 +222,62 @@ export default function pipedrive(rl) {
|
|
|
129
222
|
if (p.limit)
|
|
130
223
|
qs.limit = p.limit;
|
|
131
224
|
return api(t, "GET", `/deals/${p.dealId}/products`, undefined, qs);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
|
|
225
|
+
},
|
|
226
|
+
});
|
|
227
|
+
rl.registerAction("dealProduct.update", {
|
|
228
|
+
description: "Update a product in a deal",
|
|
229
|
+
inputSchema: {
|
|
230
|
+
dealId: { type: "number", required: true },
|
|
231
|
+
productAttachmentId: { type: "number", required: true },
|
|
232
|
+
data: { type: "object", required: true },
|
|
233
|
+
},
|
|
135
234
|
async execute(input, ctx) {
|
|
136
235
|
const t = getConn(ctx);
|
|
137
236
|
const p = input;
|
|
138
237
|
return api(t, "PATCH", `/deals/${p.dealId}/products/${p.productAttachmentId}`, p.data);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
|
|
238
|
+
},
|
|
239
|
+
});
|
|
240
|
+
rl.registerAction("dealProduct.remove", {
|
|
241
|
+
description: "Remove a product from a deal",
|
|
242
|
+
inputSchema: {
|
|
243
|
+
dealId: { type: "number", required: true },
|
|
244
|
+
productAttachmentId: { type: "number", required: true },
|
|
245
|
+
},
|
|
142
246
|
async execute(input, ctx) {
|
|
143
247
|
const t = getConn(ctx);
|
|
144
248
|
const p = input;
|
|
145
249
|
await api(t, "DELETE", `/deals/${p.dealId}/products/${p.productAttachmentId}`);
|
|
146
250
|
return { success: true };
|
|
147
|
-
}
|
|
251
|
+
},
|
|
252
|
+
});
|
|
148
253
|
// ── File (skip create/download — binary) ────────────
|
|
149
|
-
rl.registerAction("file.get", {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
async execute(input, ctx) {
|
|
153
|
-
|
|
154
|
-
|
|
254
|
+
rl.registerAction("file.get", {
|
|
255
|
+
description: "Get file metadata",
|
|
256
|
+
inputSchema: { id: { type: "number", required: true } },
|
|
257
|
+
async execute(input, ctx) {
|
|
258
|
+
return api(getConn(ctx), "GET", `/files/${input.id}`, undefined, undefined, "v1");
|
|
259
|
+
},
|
|
260
|
+
});
|
|
261
|
+
rl.registerAction("file.delete", {
|
|
262
|
+
description: "Delete a file",
|
|
263
|
+
inputSchema: { id: { type: "number", required: true } },
|
|
264
|
+
async execute(input, ctx) {
|
|
265
|
+
await api(getConn(ctx), "DELETE", `/files/${input.id}`, undefined, undefined, "v1");
|
|
266
|
+
return { success: true };
|
|
267
|
+
},
|
|
268
|
+
});
|
|
269
|
+
rl.registerAction("file.update", {
|
|
270
|
+
description: "Update file metadata",
|
|
271
|
+
inputSchema: {
|
|
272
|
+
id: { type: "number", required: true },
|
|
273
|
+
name: { type: "string", required: false },
|
|
274
|
+
description: { type: "string", required: false },
|
|
275
|
+
},
|
|
155
276
|
async execute(input, ctx) {
|
|
156
277
|
const { id, ...body } = input;
|
|
157
278
|
return api(getConn(ctx), "PUT", `/files/${id}`, body, undefined, "v1");
|
|
158
|
-
}
|
|
279
|
+
},
|
|
280
|
+
});
|
|
159
281
|
// ── Lead ────────────────────────────────────────────
|
|
160
282
|
registerCrud(rl, "lead", "/leads");
|
|
161
283
|
// ── Note ────────────────────────────────────────────
|
|
@@ -20,8 +20,18 @@ export default function plivo(rl) {
|
|
|
20
20
|
rl.setName("plivo");
|
|
21
21
|
rl.setVersion("0.1.0");
|
|
22
22
|
rl.setConnectionSchema({
|
|
23
|
-
authId: {
|
|
24
|
-
|
|
23
|
+
authId: {
|
|
24
|
+
type: "string",
|
|
25
|
+
required: true,
|
|
26
|
+
description: "Plivo Auth ID",
|
|
27
|
+
env: "PLIVO_AUTH_ID",
|
|
28
|
+
},
|
|
29
|
+
authToken: {
|
|
30
|
+
type: "string",
|
|
31
|
+
required: true,
|
|
32
|
+
description: "Plivo Auth Token",
|
|
33
|
+
env: "PLIVO_AUTH_TOKEN",
|
|
34
|
+
},
|
|
25
35
|
});
|
|
26
36
|
rl.registerAction("sms.send", {
|
|
27
37
|
description: "Send an SMS message via Plivo",
|
|
@@ -32,7 +42,11 @@ export default function plivo(rl) {
|
|
|
32
42
|
},
|
|
33
43
|
async execute(input, ctx) {
|
|
34
44
|
const { from, to, message } = input;
|
|
35
|
-
return apiRequest(getConn(ctx), "POST", "/Message", {
|
|
45
|
+
return apiRequest(getConn(ctx), "POST", "/Message", {
|
|
46
|
+
src: from,
|
|
47
|
+
dst: to,
|
|
48
|
+
text: message,
|
|
49
|
+
});
|
|
36
50
|
},
|
|
37
51
|
});
|
|
38
52
|
rl.registerAction("mms.send", {
|
|
@@ -41,11 +55,21 @@ export default function plivo(rl) {
|
|
|
41
55
|
from: { type: "string", required: true, description: "Sender number" },
|
|
42
56
|
to: { type: "string", required: true, description: "Recipient number" },
|
|
43
57
|
message: { type: "string", required: true },
|
|
44
|
-
mediaUrls: {
|
|
58
|
+
mediaUrls: {
|
|
59
|
+
type: "string",
|
|
60
|
+
required: true,
|
|
61
|
+
description: "Comma-separated media URLs",
|
|
62
|
+
},
|
|
45
63
|
},
|
|
46
64
|
async execute(input, ctx) {
|
|
47
65
|
const { from, to, message, mediaUrls } = input;
|
|
48
|
-
return apiRequest(getConn(ctx), "POST", "/Message", {
|
|
66
|
+
return apiRequest(getConn(ctx), "POST", "/Message", {
|
|
67
|
+
src: from,
|
|
68
|
+
dst: to,
|
|
69
|
+
text: message,
|
|
70
|
+
type: "mms",
|
|
71
|
+
media_urls: mediaUrls,
|
|
72
|
+
});
|
|
49
73
|
},
|
|
50
74
|
});
|
|
51
75
|
rl.registerAction("call.make", {
|
|
@@ -53,13 +77,24 @@ export default function plivo(rl) {
|
|
|
53
77
|
inputSchema: {
|
|
54
78
|
from: { type: "string", required: true, description: "Caller number" },
|
|
55
79
|
to: { type: "string", required: true, description: "Destination number" },
|
|
56
|
-
answerUrl: {
|
|
57
|
-
|
|
80
|
+
answerUrl: {
|
|
81
|
+
type: "string",
|
|
82
|
+
required: true,
|
|
83
|
+
description: "URL for call answer XML",
|
|
84
|
+
},
|
|
85
|
+
answerMethod: {
|
|
86
|
+
type: "string",
|
|
87
|
+
required: false,
|
|
88
|
+
description: "HTTP method for answer URL (GET or POST, default POST)",
|
|
89
|
+
},
|
|
58
90
|
},
|
|
59
91
|
async execute(input, ctx) {
|
|
60
92
|
const { from, to, answerUrl, answerMethod } = input;
|
|
61
93
|
return apiRequest(getConn(ctx), "POST", "/Call", {
|
|
62
|
-
from,
|
|
94
|
+
from,
|
|
95
|
+
to,
|
|
96
|
+
answer_url: answerUrl,
|
|
97
|
+
answer_method: answerMethod ?? "POST",
|
|
63
98
|
});
|
|
64
99
|
},
|
|
65
100
|
});
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
const BASE = "https://www.postb.in";
|
|
2
2
|
async function apiRequest(method, path, body) {
|
|
3
|
-
const init = {
|
|
3
|
+
const init = {
|
|
4
|
+
method,
|
|
5
|
+
headers: { "Content-Type": "application/json" },
|
|
6
|
+
};
|
|
4
7
|
if (body !== undefined)
|
|
5
8
|
init.body = body;
|
|
6
9
|
const res = await fetch(`${BASE}${path}`, init);
|
|
@@ -81,7 +84,11 @@ export default function postbin(rl) {
|
|
|
81
84
|
description: "Send a test request to a bin",
|
|
82
85
|
inputSchema: {
|
|
83
86
|
binId: { type: "string", required: true },
|
|
84
|
-
content: {
|
|
87
|
+
content: {
|
|
88
|
+
type: "string",
|
|
89
|
+
required: false,
|
|
90
|
+
description: "Request body content",
|
|
91
|
+
},
|
|
85
92
|
},
|
|
86
93
|
async execute(input) {
|
|
87
94
|
const p = input;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
function getConn(ctx) {
|
|
2
2
|
const c = ctx.connection.config;
|
|
3
|
-
return {
|
|
3
|
+
return {
|
|
4
|
+
url: c.url.replace(/\/$/, ""),
|
|
5
|
+
apiKey: c.apiKey,
|
|
6
|
+
};
|
|
4
7
|
}
|
|
5
8
|
async function apiRequest(conn, endpoint, body) {
|
|
6
9
|
body.api_key = conn.apiKey;
|
|
@@ -17,21 +20,40 @@ export default function posthog(rl) {
|
|
|
17
20
|
rl.setName("posthog");
|
|
18
21
|
rl.setVersion("0.1.0");
|
|
19
22
|
rl.setConnectionSchema({
|
|
20
|
-
url: {
|
|
21
|
-
|
|
23
|
+
url: {
|
|
24
|
+
type: "string",
|
|
25
|
+
required: true,
|
|
26
|
+
description: "PostHog instance URL (e.g. https://app.posthog.com)",
|
|
27
|
+
env: "POSTHOG_URL",
|
|
28
|
+
},
|
|
29
|
+
apiKey: {
|
|
30
|
+
type: "string",
|
|
31
|
+
required: true,
|
|
32
|
+
description: "PostHog project API key",
|
|
33
|
+
env: "POSTHOG_API_KEY",
|
|
34
|
+
},
|
|
22
35
|
});
|
|
23
36
|
rl.registerAction("alias.create", {
|
|
24
37
|
description: "Create an alias for a distinct ID",
|
|
25
38
|
inputSchema: {
|
|
26
39
|
distinctId: { type: "string", required: true },
|
|
27
40
|
alias: { type: "string", required: true },
|
|
28
|
-
context: {
|
|
29
|
-
|
|
41
|
+
context: {
|
|
42
|
+
type: "object",
|
|
43
|
+
required: false,
|
|
44
|
+
description: "Context key-value pairs",
|
|
45
|
+
},
|
|
46
|
+
timestamp: {
|
|
47
|
+
type: "string",
|
|
48
|
+
required: false,
|
|
49
|
+
description: "ISO 8601 timestamp",
|
|
50
|
+
},
|
|
30
51
|
},
|
|
31
52
|
async execute(input, ctx) {
|
|
32
53
|
const p = input;
|
|
33
54
|
const body = {
|
|
34
|
-
type: "alias",
|
|
55
|
+
type: "alias",
|
|
56
|
+
event: "$create_alias",
|
|
35
57
|
context: p.context ?? {},
|
|
36
58
|
properties: { distinct_id: p.distinctId, alias: p.alias },
|
|
37
59
|
};
|
|
@@ -43,7 +65,11 @@ export default function posthog(rl) {
|
|
|
43
65
|
rl.registerAction("event.create", {
|
|
44
66
|
description: "Capture one or more events",
|
|
45
67
|
inputSchema: {
|
|
46
|
-
events: {
|
|
68
|
+
events: {
|
|
69
|
+
type: "object",
|
|
70
|
+
required: true,
|
|
71
|
+
description: "Array of event objects: [{event, distinct_id, properties?, timestamp?}]",
|
|
72
|
+
},
|
|
47
73
|
},
|
|
48
74
|
async execute(input, ctx) {
|
|
49
75
|
const { events } = input;
|
|
@@ -54,13 +80,18 @@ export default function posthog(rl) {
|
|
|
54
80
|
description: "Identify a user (set person properties)",
|
|
55
81
|
inputSchema: {
|
|
56
82
|
distinctId: { type: "string", required: true },
|
|
57
|
-
properties: {
|
|
83
|
+
properties: {
|
|
84
|
+
type: "object",
|
|
85
|
+
required: false,
|
|
86
|
+
description: "Person properties to set",
|
|
87
|
+
},
|
|
58
88
|
timestamp: { type: "string", required: false },
|
|
59
89
|
},
|
|
60
90
|
async execute(input, ctx) {
|
|
61
91
|
const p = input;
|
|
62
92
|
const body = {
|
|
63
|
-
event: "$identify",
|
|
93
|
+
event: "$identify",
|
|
94
|
+
distinct_id: p.distinctId,
|
|
64
95
|
properties: p.properties ?? {},
|
|
65
96
|
};
|
|
66
97
|
if (p.timestamp)
|
|
@@ -80,9 +111,12 @@ export default function posthog(rl) {
|
|
|
80
111
|
async execute(input, ctx) {
|
|
81
112
|
const p = input;
|
|
82
113
|
const body = {
|
|
83
|
-
type: "page",
|
|
114
|
+
type: "page",
|
|
115
|
+
event: "$page",
|
|
116
|
+
name: p.name,
|
|
84
117
|
distinct_id: p.distinctId,
|
|
85
|
-
properties: p.properties ?? {},
|
|
118
|
+
properties: p.properties ?? {},
|
|
119
|
+
context: p.context ?? {},
|
|
86
120
|
};
|
|
87
121
|
if (p.timestamp)
|
|
88
122
|
body.timestamp = p.timestamp;
|
|
@@ -101,9 +135,12 @@ export default function posthog(rl) {
|
|
|
101
135
|
async execute(input, ctx) {
|
|
102
136
|
const p = input;
|
|
103
137
|
const body = {
|
|
104
|
-
type: "screen",
|
|
138
|
+
type: "screen",
|
|
139
|
+
event: "$screen",
|
|
140
|
+
name: p.name,
|
|
105
141
|
distinct_id: p.distinctId,
|
|
106
|
-
properties: p.properties ?? {},
|
|
142
|
+
properties: p.properties ?? {},
|
|
143
|
+
context: p.context ?? {},
|
|
107
144
|
};
|
|
108
145
|
if (p.timestamp)
|
|
109
146
|
body.timestamp = p.timestamp;
|
|
@@ -7,7 +7,9 @@ async function apiRequest(token, endpoint, qs) {
|
|
|
7
7
|
url.searchParams.set(k, String(v));
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
-
const res = await fetch(url.toString(), {
|
|
10
|
+
const res = await fetch(url.toString(), {
|
|
11
|
+
headers: { Authorization: token },
|
|
12
|
+
});
|
|
11
13
|
if (!res.ok)
|
|
12
14
|
throw new Error(`ProfitWell error ${res.status}: ${await res.text()}`);
|
|
13
15
|
return res.json();
|
|
@@ -16,7 +18,12 @@ export default function profitwell(rl) {
|
|
|
16
18
|
rl.setName("profitwell");
|
|
17
19
|
rl.setVersion("0.1.0");
|
|
18
20
|
rl.setConnectionSchema({
|
|
19
|
-
accessToken: {
|
|
21
|
+
accessToken: {
|
|
22
|
+
type: "string",
|
|
23
|
+
required: true,
|
|
24
|
+
description: "ProfitWell API access token",
|
|
25
|
+
env: "PROFITWELL_ACCESS_TOKEN",
|
|
26
|
+
},
|
|
20
27
|
});
|
|
21
28
|
const key = (ctx) => ctx.connection.config.accessToken;
|
|
22
29
|
rl.registerAction("company.getSettings", {
|
|
@@ -30,9 +37,21 @@ export default function profitwell(rl) {
|
|
|
30
37
|
description: "Get financial metrics (daily or monthly)",
|
|
31
38
|
inputSchema: {
|
|
32
39
|
type: { type: "string", required: true, description: "daily or monthly" },
|
|
33
|
-
month: {
|
|
34
|
-
|
|
35
|
-
|
|
40
|
+
month: {
|
|
41
|
+
type: "string",
|
|
42
|
+
required: false,
|
|
43
|
+
description: "Month (YYYY-MM) — required for daily metrics",
|
|
44
|
+
},
|
|
45
|
+
metrics: {
|
|
46
|
+
type: "string",
|
|
47
|
+
required: false,
|
|
48
|
+
description: "Comma-separated metric names to retrieve",
|
|
49
|
+
},
|
|
50
|
+
planId: {
|
|
51
|
+
type: "string",
|
|
52
|
+
required: false,
|
|
53
|
+
description: "Filter by plan ID",
|
|
54
|
+
},
|
|
36
55
|
},
|
|
37
56
|
async execute(input, ctx) {
|
|
38
57
|
const p = (input ?? {});
|