runline 0.2.0 → 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/README.md +1 -1
- 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
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
function getConn(ctx) {
|
|
2
2
|
const c = ctx.connection.config;
|
|
3
|
-
return {
|
|
3
|
+
return {
|
|
4
|
+
subdomain: c.subdomain,
|
|
5
|
+
email: c.email,
|
|
6
|
+
apiToken: c.apiToken,
|
|
7
|
+
};
|
|
4
8
|
}
|
|
5
9
|
async function api(conn, method, endpoint, body, qs) {
|
|
6
10
|
const url = new URL(`https://${conn.subdomain}.zendesk.com/api/v2${endpoint}.json`);
|
|
@@ -10,7 +14,13 @@ async function api(conn, method, endpoint, body, qs) {
|
|
|
10
14
|
url.searchParams.set(k, String(v));
|
|
11
15
|
}
|
|
12
16
|
}
|
|
13
|
-
const init = {
|
|
17
|
+
const init = {
|
|
18
|
+
method,
|
|
19
|
+
headers: {
|
|
20
|
+
Authorization: `Basic ${btoa(`${conn.email}/token:${conn.apiToken}`)}`,
|
|
21
|
+
"Content-Type": "application/json",
|
|
22
|
+
},
|
|
23
|
+
};
|
|
14
24
|
if (body && Object.keys(body).length > 0)
|
|
15
25
|
init.body = JSON.stringify(body);
|
|
16
26
|
const res = await fetch(url.toString(), init);
|
|
@@ -24,15 +34,42 @@ export default function zendesk(rl) {
|
|
|
24
34
|
rl.setName("zendesk");
|
|
25
35
|
rl.setVersion("0.1.0");
|
|
26
36
|
rl.setConnectionSchema({
|
|
27
|
-
subdomain: {
|
|
28
|
-
|
|
29
|
-
|
|
37
|
+
subdomain: {
|
|
38
|
+
type: "string",
|
|
39
|
+
required: true,
|
|
40
|
+
description: "Zendesk subdomain",
|
|
41
|
+
env: "ZENDESK_SUBDOMAIN",
|
|
42
|
+
},
|
|
43
|
+
email: {
|
|
44
|
+
type: "string",
|
|
45
|
+
required: true,
|
|
46
|
+
description: "Agent email",
|
|
47
|
+
env: "ZENDESK_EMAIL",
|
|
48
|
+
},
|
|
49
|
+
apiToken: {
|
|
50
|
+
type: "string",
|
|
51
|
+
required: true,
|
|
52
|
+
description: "Zendesk API token",
|
|
53
|
+
env: "ZENDESK_API_TOKEN",
|
|
54
|
+
},
|
|
30
55
|
});
|
|
31
56
|
// ── Ticket ──────────────────────────────────────────
|
|
32
|
-
rl.registerAction("ticket.create", {
|
|
57
|
+
rl.registerAction("ticket.create", {
|
|
58
|
+
description: "Create a ticket",
|
|
59
|
+
inputSchema: {
|
|
60
|
+
description: { type: "string", required: true },
|
|
61
|
+
subject: { type: "string", required: false },
|
|
62
|
+
type: { type: "string", required: false },
|
|
63
|
+
status: { type: "string", required: false },
|
|
64
|
+
priority: { type: "string", required: false },
|
|
65
|
+
tags: { type: "object", required: false },
|
|
66
|
+
customFields: { type: "object", required: false },
|
|
67
|
+
},
|
|
33
68
|
async execute(input, ctx) {
|
|
34
69
|
const p = input;
|
|
35
|
-
const ticket = {
|
|
70
|
+
const ticket = {
|
|
71
|
+
comment: { body: p.description },
|
|
72
|
+
};
|
|
36
73
|
if (p.subject)
|
|
37
74
|
ticket.subject = p.subject;
|
|
38
75
|
if (p.type)
|
|
@@ -45,12 +82,31 @@ export default function zendesk(rl) {
|
|
|
45
82
|
ticket.tags = p.tags;
|
|
46
83
|
if (p.customFields)
|
|
47
84
|
ticket.custom_fields = p.customFields;
|
|
48
|
-
const data = (await api(getConn(ctx), "POST", "/tickets", {
|
|
85
|
+
const data = (await api(getConn(ctx), "POST", "/tickets", {
|
|
86
|
+
ticket,
|
|
87
|
+
}));
|
|
49
88
|
return data.ticket;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
rl.registerAction("ticket.get", {
|
|
92
|
+
description: "Get a ticket",
|
|
93
|
+
inputSchema: { id: { type: "string", required: true } },
|
|
94
|
+
async execute(input, ctx) {
|
|
95
|
+
const data = (await api(getConn(ctx), "GET", `/tickets/${input.id}`));
|
|
96
|
+
return data.ticket;
|
|
97
|
+
},
|
|
98
|
+
});
|
|
99
|
+
rl.registerAction("ticket.list", {
|
|
100
|
+
description: "Search tickets",
|
|
101
|
+
inputSchema: {
|
|
102
|
+
query: {
|
|
103
|
+
type: "string",
|
|
104
|
+
required: false,
|
|
105
|
+
description: "Zendesk search query",
|
|
106
|
+
},
|
|
107
|
+
limit: { type: "number", required: false },
|
|
108
|
+
status: { type: "string", required: false },
|
|
109
|
+
},
|
|
54
110
|
async execute(input, ctx) {
|
|
55
111
|
const p = (input ?? {});
|
|
56
112
|
let q = "type:ticket";
|
|
@@ -63,40 +119,96 @@ export default function zendesk(rl) {
|
|
|
63
119
|
qs.per_page = p.limit;
|
|
64
120
|
const data = (await api(getConn(ctx), "GET", "/search", undefined, qs));
|
|
65
121
|
return data.results;
|
|
66
|
-
}
|
|
67
|
-
|
|
122
|
+
},
|
|
123
|
+
});
|
|
124
|
+
rl.registerAction("ticket.update", {
|
|
125
|
+
description: "Update a ticket",
|
|
126
|
+
inputSchema: {
|
|
127
|
+
id: { type: "string", required: true },
|
|
128
|
+
data: {
|
|
129
|
+
type: "object",
|
|
130
|
+
required: true,
|
|
131
|
+
description: "Ticket fields to update",
|
|
132
|
+
},
|
|
133
|
+
},
|
|
68
134
|
async execute(input, ctx) {
|
|
69
135
|
const p = input;
|
|
70
|
-
const data = (await api(getConn(ctx), "PUT", `/tickets/${p.id}`, {
|
|
136
|
+
const data = (await api(getConn(ctx), "PUT", `/tickets/${p.id}`, {
|
|
137
|
+
ticket: p.data,
|
|
138
|
+
}));
|
|
71
139
|
return data.ticket;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
140
|
+
},
|
|
141
|
+
});
|
|
142
|
+
rl.registerAction("ticket.delete", {
|
|
143
|
+
description: "Delete a ticket",
|
|
144
|
+
inputSchema: { id: { type: "string", required: true } },
|
|
145
|
+
async execute(input, ctx) {
|
|
146
|
+
await api(getConn(ctx), "DELETE", `/tickets/${input.id}`);
|
|
147
|
+
return { success: true };
|
|
148
|
+
},
|
|
149
|
+
});
|
|
75
150
|
// ── User ────────────────────────────────────────────
|
|
76
|
-
rl.registerAction("user.create", {
|
|
151
|
+
rl.registerAction("user.create", {
|
|
152
|
+
description: "Create a user",
|
|
153
|
+
inputSchema: {
|
|
154
|
+
name: { type: "string", required: true },
|
|
155
|
+
email: { type: "string", required: false },
|
|
156
|
+
role: { type: "string", required: false },
|
|
157
|
+
},
|
|
77
158
|
async execute(input, ctx) {
|
|
78
|
-
const data = (await api(getConn(ctx), "POST", "/users", {
|
|
159
|
+
const data = (await api(getConn(ctx), "POST", "/users", {
|
|
160
|
+
user: input,
|
|
161
|
+
}));
|
|
79
162
|
return data.user;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
163
|
+
},
|
|
164
|
+
});
|
|
165
|
+
rl.registerAction("user.get", {
|
|
166
|
+
description: "Get a user",
|
|
167
|
+
inputSchema: { id: { type: "string", required: true } },
|
|
168
|
+
async execute(input, ctx) {
|
|
169
|
+
const data = (await api(getConn(ctx), "GET", `/users/${input.id}`));
|
|
170
|
+
return data.user;
|
|
171
|
+
},
|
|
172
|
+
});
|
|
173
|
+
rl.registerAction("user.list", {
|
|
174
|
+
description: "List users",
|
|
175
|
+
inputSchema: { limit: { type: "number", required: false } },
|
|
84
176
|
async execute(input, ctx) {
|
|
85
177
|
const qs = {};
|
|
86
178
|
if (input?.limit)
|
|
87
179
|
qs.per_page = input.limit;
|
|
88
180
|
const data = (await api(getConn(ctx), "GET", "/users", undefined, qs));
|
|
89
181
|
return data.users;
|
|
90
|
-
}
|
|
91
|
-
|
|
182
|
+
},
|
|
183
|
+
});
|
|
184
|
+
rl.registerAction("user.update", {
|
|
185
|
+
description: "Update a user",
|
|
186
|
+
inputSchema: {
|
|
187
|
+
id: { type: "string", required: true },
|
|
188
|
+
data: { type: "object", required: true },
|
|
189
|
+
},
|
|
92
190
|
async execute(input, ctx) {
|
|
93
191
|
const p = input;
|
|
94
|
-
const data = (await api(getConn(ctx), "PUT", `/users/${p.id}`, {
|
|
192
|
+
const data = (await api(getConn(ctx), "PUT", `/users/${p.id}`, {
|
|
193
|
+
user: p.data,
|
|
194
|
+
}));
|
|
95
195
|
return data.user;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
196
|
+
},
|
|
197
|
+
});
|
|
198
|
+
rl.registerAction("user.delete", {
|
|
199
|
+
description: "Delete a user",
|
|
200
|
+
inputSchema: { id: { type: "string", required: true } },
|
|
201
|
+
async execute(input, ctx) {
|
|
202
|
+
const data = (await api(getConn(ctx), "DELETE", `/users/${input.id}`));
|
|
203
|
+
return data.user;
|
|
204
|
+
},
|
|
205
|
+
});
|
|
206
|
+
rl.registerAction("user.search", {
|
|
207
|
+
description: "Search users",
|
|
208
|
+
inputSchema: {
|
|
209
|
+
query: { type: "string", required: true },
|
|
210
|
+
limit: { type: "number", required: false },
|
|
211
|
+
},
|
|
100
212
|
async execute(input, ctx) {
|
|
101
213
|
const p = input;
|
|
102
214
|
const qs = { query: p.query };
|
|
@@ -104,34 +216,75 @@ export default function zendesk(rl) {
|
|
|
104
216
|
qs.per_page = p.limit;
|
|
105
217
|
const data = (await api(getConn(ctx), "GET", "/users/search", undefined, qs));
|
|
106
218
|
return data.users;
|
|
107
|
-
}
|
|
219
|
+
},
|
|
220
|
+
});
|
|
108
221
|
// ── Organization ────────────────────────────────────
|
|
109
|
-
rl.registerAction("organization.create", {
|
|
222
|
+
rl.registerAction("organization.create", {
|
|
223
|
+
description: "Create an organization",
|
|
224
|
+
inputSchema: { name: { type: "string", required: true } },
|
|
110
225
|
async execute(input, ctx) {
|
|
111
|
-
const data = (await api(getConn(ctx), "POST", "/organizations", {
|
|
226
|
+
const data = (await api(getConn(ctx), "POST", "/organizations", {
|
|
227
|
+
organization: input,
|
|
228
|
+
}));
|
|
112
229
|
return data.organization;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
230
|
+
},
|
|
231
|
+
});
|
|
232
|
+
rl.registerAction("organization.get", {
|
|
233
|
+
description: "Get an organization",
|
|
234
|
+
inputSchema: { id: { type: "string", required: true } },
|
|
235
|
+
async execute(input, ctx) {
|
|
236
|
+
const data = (await api(getConn(ctx), "GET", `/organizations/${input.id}`));
|
|
237
|
+
return data.organization;
|
|
238
|
+
},
|
|
239
|
+
});
|
|
240
|
+
rl.registerAction("organization.list", {
|
|
241
|
+
description: "List organizations",
|
|
242
|
+
inputSchema: { limit: { type: "number", required: false } },
|
|
117
243
|
async execute(input, ctx) {
|
|
118
244
|
const qs = {};
|
|
119
245
|
if (input?.limit)
|
|
120
246
|
qs.per_page = input.limit;
|
|
121
247
|
const data = (await api(getConn(ctx), "GET", "/organizations", undefined, qs));
|
|
122
248
|
return data.organizations;
|
|
123
|
-
}
|
|
124
|
-
|
|
249
|
+
},
|
|
250
|
+
});
|
|
251
|
+
rl.registerAction("organization.update", {
|
|
252
|
+
description: "Update an organization",
|
|
253
|
+
inputSchema: {
|
|
254
|
+
id: { type: "string", required: true },
|
|
255
|
+
data: { type: "object", required: true },
|
|
256
|
+
},
|
|
125
257
|
async execute(input, ctx) {
|
|
126
258
|
const p = input;
|
|
127
|
-
const data = (await api(getConn(ctx), "PUT", `/organizations/${p.id}`, {
|
|
259
|
+
const data = (await api(getConn(ctx), "PUT", `/organizations/${p.id}`, {
|
|
260
|
+
organization: p.data,
|
|
261
|
+
}));
|
|
128
262
|
return data.organization;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
|
|
263
|
+
},
|
|
264
|
+
});
|
|
265
|
+
rl.registerAction("organization.delete", {
|
|
266
|
+
description: "Delete an organization",
|
|
267
|
+
inputSchema: { id: { type: "string", required: true } },
|
|
268
|
+
async execute(input, ctx) {
|
|
269
|
+
await api(getConn(ctx), "DELETE", `/organizations/${input.id}`);
|
|
270
|
+
return { success: true };
|
|
271
|
+
},
|
|
272
|
+
});
|
|
132
273
|
// ── Ticket Field ────────────────────────────────────
|
|
133
|
-
rl.registerAction("ticketField.get", {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
async execute(
|
|
274
|
+
rl.registerAction("ticketField.get", {
|
|
275
|
+
description: "Get a ticket field",
|
|
276
|
+
inputSchema: { id: { type: "string", required: true } },
|
|
277
|
+
async execute(input, ctx) {
|
|
278
|
+
const data = (await api(getConn(ctx), "GET", `/ticket_fields/${input.id}`));
|
|
279
|
+
return data.ticket_field;
|
|
280
|
+
},
|
|
281
|
+
});
|
|
282
|
+
rl.registerAction("ticketField.list", {
|
|
283
|
+
description: "List ticket fields",
|
|
284
|
+
inputSchema: {},
|
|
285
|
+
async execute(_input, ctx) {
|
|
286
|
+
const data = (await api(getConn(ctx), "GET", "/ticket_fields"));
|
|
287
|
+
return data.ticket_fields;
|
|
288
|
+
},
|
|
289
|
+
});
|
|
137
290
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
function getConn(ctx) {
|
|
2
2
|
const c = ctx.connection.config;
|
|
3
|
-
return {
|
|
3
|
+
return {
|
|
4
|
+
accessToken: c.accessToken,
|
|
5
|
+
apiDomain: (c.apiDomain || "https://www.zohoapis.com").replace(/\/$/, ""),
|
|
6
|
+
};
|
|
4
7
|
}
|
|
5
8
|
async function api(conn, method, endpoint, body, qs) {
|
|
6
9
|
const url = new URL(`${conn.apiDomain}/crm/v2${endpoint}`);
|
|
@@ -10,7 +13,13 @@ async function api(conn, method, endpoint, body, qs) {
|
|
|
10
13
|
url.searchParams.set(k, String(v));
|
|
11
14
|
}
|
|
12
15
|
}
|
|
13
|
-
const init = {
|
|
16
|
+
const init = {
|
|
17
|
+
method,
|
|
18
|
+
headers: {
|
|
19
|
+
Authorization: `Zoho-oauthtoken ${conn.accessToken}`,
|
|
20
|
+
"Content-Type": "application/json",
|
|
21
|
+
},
|
|
22
|
+
};
|
|
14
23
|
if (body && Object.keys(body).length > 0)
|
|
15
24
|
init.body = JSON.stringify({ data: [body] });
|
|
16
25
|
const res = await fetch(url.toString(), init);
|
|
@@ -21,23 +30,47 @@ async function api(conn, method, endpoint, body, qs) {
|
|
|
21
30
|
return res.json();
|
|
22
31
|
}
|
|
23
32
|
const MODULES = {
|
|
24
|
-
account: "Accounts",
|
|
25
|
-
|
|
26
|
-
|
|
33
|
+
account: "Accounts",
|
|
34
|
+
contact: "Contacts",
|
|
35
|
+
deal: "Deals",
|
|
36
|
+
invoice: "Invoices",
|
|
37
|
+
lead: "Leads",
|
|
38
|
+
product: "Products",
|
|
39
|
+
purchaseOrder: "Purchase_Orders",
|
|
40
|
+
salesOrder: "Sales_Orders",
|
|
41
|
+
vendor: "Vendors",
|
|
42
|
+
quote: "Quotes",
|
|
27
43
|
};
|
|
28
44
|
function registerCrmResource(rl, resource, conn) {
|
|
29
45
|
const mod = MODULES[resource];
|
|
30
|
-
rl.registerAction(`${resource}.create`, {
|
|
46
|
+
rl.registerAction(`${resource}.create`, {
|
|
47
|
+
description: `Create a ${resource}`,
|
|
48
|
+
inputSchema: {
|
|
49
|
+
data: { type: "object", required: true, description: "Record fields" },
|
|
50
|
+
},
|
|
31
51
|
async execute(input, ctx) {
|
|
32
52
|
const data = (await api(conn(ctx), "POST", `/${mod}`, input.data));
|
|
33
53
|
return data.data;
|
|
34
|
-
}
|
|
35
|
-
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
rl.registerAction(`${resource}.get`, {
|
|
57
|
+
description: `Get a ${resource} by ID`,
|
|
58
|
+
inputSchema: { id: { type: "string", required: true } },
|
|
36
59
|
async execute(input, ctx) {
|
|
37
60
|
const data = (await api(conn(ctx), "GET", `/${mod}/${input.id}`));
|
|
38
61
|
return data.data;
|
|
39
|
-
}
|
|
40
|
-
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
rl.registerAction(`${resource}.list`, {
|
|
65
|
+
description: `List ${mod}`,
|
|
66
|
+
inputSchema: {
|
|
67
|
+
limit: { type: "number", required: false },
|
|
68
|
+
fields: {
|
|
69
|
+
type: "string",
|
|
70
|
+
required: false,
|
|
71
|
+
description: "Comma-separated field names",
|
|
72
|
+
},
|
|
73
|
+
},
|
|
41
74
|
async execute(input, ctx) {
|
|
42
75
|
const p = (input ?? {});
|
|
43
76
|
const qs = {};
|
|
@@ -47,37 +80,71 @@ function registerCrmResource(rl, resource, conn) {
|
|
|
47
80
|
qs.fields = p.fields;
|
|
48
81
|
const data = (await api(conn(ctx), "GET", `/${mod}`, undefined, qs));
|
|
49
82
|
return data.data ?? [];
|
|
50
|
-
}
|
|
51
|
-
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
rl.registerAction(`${resource}.update`, {
|
|
86
|
+
description: `Update a ${resource}`,
|
|
87
|
+
inputSchema: {
|
|
88
|
+
id: { type: "string", required: true },
|
|
89
|
+
data: { type: "object", required: true },
|
|
90
|
+
},
|
|
52
91
|
async execute(input, ctx) {
|
|
53
92
|
const p = input;
|
|
54
93
|
const body = { ...p.data, id: p.id };
|
|
55
94
|
const data = (await api(conn(ctx), "PUT", `/${mod}`, body));
|
|
56
95
|
return data.data;
|
|
57
|
-
}
|
|
58
|
-
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
rl.registerAction(`${resource}.delete`, {
|
|
99
|
+
description: `Delete a ${resource}`,
|
|
100
|
+
inputSchema: { id: { type: "string", required: true } },
|
|
59
101
|
async execute(input, ctx) {
|
|
60
|
-
const data = (await api(conn(ctx), "DELETE", `/${mod}`, undefined, {
|
|
102
|
+
const data = (await api(conn(ctx), "DELETE", `/${mod}`, undefined, {
|
|
103
|
+
ids: input.id,
|
|
104
|
+
}));
|
|
61
105
|
return data.data;
|
|
62
|
-
}
|
|
63
|
-
|
|
106
|
+
},
|
|
107
|
+
});
|
|
108
|
+
rl.registerAction(`${resource}.upsert`, {
|
|
109
|
+
description: `Upsert a ${resource}`,
|
|
110
|
+
inputSchema: {
|
|
111
|
+
data: { type: "object", required: true },
|
|
112
|
+
duplicateCheckFields: {
|
|
113
|
+
type: "string",
|
|
114
|
+
required: false,
|
|
115
|
+
description: "Comma-separated field names for duplicate check",
|
|
116
|
+
},
|
|
117
|
+
},
|
|
64
118
|
async execute(input, ctx) {
|
|
65
119
|
const p = input;
|
|
66
120
|
const body = p.data;
|
|
67
121
|
const qs = {};
|
|
68
122
|
if (p.duplicateCheckFields) {
|
|
69
|
-
body.duplicate_check_fields = p.duplicateCheckFields
|
|
123
|
+
body.duplicate_check_fields = p.duplicateCheckFields
|
|
124
|
+
.split(",")
|
|
125
|
+
.map((f) => f.trim());
|
|
70
126
|
}
|
|
71
127
|
const data = (await api(conn(ctx), "POST", `/${mod}/upsert`, body));
|
|
72
128
|
return data.data;
|
|
73
|
-
}
|
|
129
|
+
},
|
|
130
|
+
});
|
|
74
131
|
}
|
|
75
132
|
export default function zoho(rl) {
|
|
76
133
|
rl.setName("zoho");
|
|
77
134
|
rl.setVersion("0.1.0");
|
|
78
135
|
rl.setConnectionSchema({
|
|
79
|
-
accessToken: {
|
|
80
|
-
|
|
136
|
+
accessToken: {
|
|
137
|
+
type: "string",
|
|
138
|
+
required: true,
|
|
139
|
+
description: "Zoho OAuth2 access token",
|
|
140
|
+
env: "ZOHO_ACCESS_TOKEN",
|
|
141
|
+
},
|
|
142
|
+
apiDomain: {
|
|
143
|
+
type: "string",
|
|
144
|
+
required: false,
|
|
145
|
+
description: "API domain (default: https://www.zohoapis.com)",
|
|
146
|
+
env: "ZOHO_API_DOMAIN",
|
|
147
|
+
},
|
|
81
148
|
});
|
|
82
149
|
for (const resource of Object.keys(MODULES)) {
|
|
83
150
|
registerCrmResource(rl, resource, getConn);
|
|
@@ -7,7 +7,13 @@ async function apiRequest(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);
|
|
@@ -22,20 +28,41 @@ export default function zoom(rl) {
|
|
|
22
28
|
rl.setName("zoom");
|
|
23
29
|
rl.setVersion("0.1.0");
|
|
24
30
|
rl.setConnectionSchema({
|
|
25
|
-
accessToken: {
|
|
31
|
+
accessToken: {
|
|
32
|
+
type: "string",
|
|
33
|
+
required: true,
|
|
34
|
+
description: "Zoom access token (JWT or OAuth2)",
|
|
35
|
+
env: "ZOOM_ACCESS_TOKEN",
|
|
36
|
+
},
|
|
26
37
|
});
|
|
27
38
|
const key = (ctx) => ctx.connection.config.accessToken;
|
|
28
39
|
rl.registerAction("meeting.create", {
|
|
29
40
|
description: "Create a Zoom meeting",
|
|
30
41
|
inputSchema: {
|
|
31
42
|
topic: { type: "string", required: true },
|
|
32
|
-
type: {
|
|
33
|
-
|
|
34
|
-
|
|
43
|
+
type: {
|
|
44
|
+
type: "number",
|
|
45
|
+
required: false,
|
|
46
|
+
description: "1=Instant, 2=Scheduled, 3=Recurring no fixed, 8=Recurring fixed",
|
|
47
|
+
},
|
|
48
|
+
startTime: {
|
|
49
|
+
type: "string",
|
|
50
|
+
required: false,
|
|
51
|
+
description: "ISO 8601 datetime",
|
|
52
|
+
},
|
|
53
|
+
duration: {
|
|
54
|
+
type: "number",
|
|
55
|
+
required: false,
|
|
56
|
+
description: "Duration in minutes",
|
|
57
|
+
},
|
|
35
58
|
timezone: { type: "string", required: false },
|
|
36
59
|
password: { type: "string", required: false },
|
|
37
60
|
agenda: { type: "string", required: false },
|
|
38
|
-
settings: {
|
|
61
|
+
settings: {
|
|
62
|
+
type: "object",
|
|
63
|
+
required: false,
|
|
64
|
+
description: "Meeting settings object",
|
|
65
|
+
},
|
|
39
66
|
},
|
|
40
67
|
async execute(input, ctx) {
|
|
41
68
|
const p = input;
|
|
@@ -66,7 +93,14 @@ export default function zoom(rl) {
|
|
|
66
93
|
});
|
|
67
94
|
rl.registerAction("meeting.list", {
|
|
68
95
|
description: "List meetings for the authenticated user",
|
|
69
|
-
inputSchema: {
|
|
96
|
+
inputSchema: {
|
|
97
|
+
limit: { type: "number", required: false },
|
|
98
|
+
type: {
|
|
99
|
+
type: "string",
|
|
100
|
+
required: false,
|
|
101
|
+
description: "scheduled, live, upcoming",
|
|
102
|
+
},
|
|
103
|
+
},
|
|
70
104
|
async execute(input, ctx) {
|
|
71
105
|
const p = (input ?? {});
|
|
72
106
|
const qs = {};
|