@superagnt/heyreach-outreach 2.0.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/index.js ADDED
@@ -0,0 +1,2068 @@
1
+ /**
2
+ * HeyReach Integration — OpenClaw plugin
3
+ * Auto-generated by @superagnt/clawhub. Do not edit by hand.
4
+ */
5
+
6
+ import { homedir as _homedir } from 'node:os'
7
+ import { join as _join } from 'node:path'
8
+ import { existsSync as _existsSync, readFileSync as _readFileSync } from 'node:fs'
9
+
10
+ const BASE_URL = 'https://api.superagnt.com/v1/connections/heyreach'
11
+
12
+
13
+ // ── Auth Module (inlined) ────────────────────────────────────────────────────
14
+
15
+ function getConfigPath() {
16
+ return _join(_homedir(), '.superagnt', 'config.json')
17
+ }
18
+
19
+ function readAgntConfig() {
20
+ const configFile = getConfigPath()
21
+ if (!_existsSync(configFile)) return null
22
+ try {
23
+ return JSON.parse(_readFileSync(configFile, 'utf-8'))
24
+ } catch {
25
+ return null
26
+ }
27
+ }
28
+
29
+ // ── End Auth Module ──────────────────────────────────────────────────────────
30
+
31
+
32
+ // ── CLI Module (inlined) ─────────────────────────────────────────────────────
33
+
34
+ function maskApiKey(key) {
35
+ if (!key || typeof key !== 'string') return '(none)'
36
+ const k = key.trim()
37
+ if (k.length <= 8) return k.slice(0, 2) + '…'
38
+ return k.slice(0, 6) + '…' + k.slice(-4)
39
+ }
40
+
41
+ function registerAgntCli(api) {
42
+ api.registerCli(
43
+ ({ program }) => {
44
+ const cmd = program
45
+ .command('superagnt')
46
+ .description('superagnt social data API (status, doctor)')
47
+
48
+ cmd
49
+ .command('status')
50
+ .description('Show whether an API key is configured (masked)')
51
+ .action(async () => {
52
+ const cfg = readAgntConfig()
53
+ const key = cfg?.apiKey
54
+
55
+ console.log('\nsuperagnt status\n')
56
+ if (!key) {
57
+ console.log(' API key: not configured')
58
+ console.log(' Workspace: —')
59
+ console.log('\n Get your API key at: https://app.superagnt.com/dashboard\n')
60
+ return
61
+ }
62
+ console.log(' API key: ' + maskApiKey(key) + ' (from ~/.superagnt/config.json)')
63
+ console.log(' Workspace: ' + (cfg?.workspaceId ?? '—'))
64
+ console.log('')
65
+ })
66
+
67
+ cmd
68
+ .command('doctor')
69
+ .description('Check connectivity and validate API key against api.superagnt.dev')
70
+ .action(async () => {
71
+ console.log('\nsuperagnt doctor\n')
72
+
73
+ try {
74
+ const publicRes = await fetch('https://api.superagnt.com/v1/platforms')
75
+ console.log(' Public API: ' + (publicRes.ok ? 'OK (' + publicRes.status + ')' : 'HTTP ' + publicRes.status))
76
+ } catch (err) {
77
+ const msg = err instanceof Error ? err.message : String(err)
78
+ console.log(' Public API: failed — ' + msg)
79
+ }
80
+
81
+ const cfg = readAgntConfig()
82
+ const key = cfg?.apiKey
83
+
84
+ if (!key) {
85
+ console.log('\n Authenticated: skipped (no API key)')
86
+ console.log(' Get your API key at: https://app.superagnt.com/dashboard\n')
87
+ return
88
+ }
89
+
90
+ try {
91
+ const res = await fetch('https://api.superagnt.com/v1/platforms', {
92
+ headers: { Authorization: 'Bearer ' + key },
93
+ })
94
+ const text = await res.text()
95
+ let summary = 'HTTP ' + res.status
96
+ if (res.ok) {
97
+ try {
98
+ const json = JSON.parse(text)
99
+ const n = Array.isArray(json?.data) ? json.data.length : (json?.data ? Object.keys(json.data).length : 'ok')
100
+ summary = 'OK — platforms payload received (' + (typeof n === 'number' ? n + ' entries' : String(n)) + ')'
101
+ } catch {
102
+ summary = 'OK (' + res.status + ')'
103
+ }
104
+ }
105
+ console.log(' Authenticated: ' + summary)
106
+ if (!res.ok) {
107
+ console.log(' If 401, get a new key at: https://app.superagnt.com/dashboard')
108
+ }
109
+ } catch (err) {
110
+ const msg = err instanceof Error ? err.message : String(err)
111
+ console.log(' Authenticated: failed — ' + msg)
112
+ }
113
+ console.log('')
114
+ })
115
+ },
116
+ { commands: ['superagnt'] },
117
+ )
118
+ }
119
+
120
+ // ── End CLI Module ───────────────────────────────────────────────────────────
121
+
122
+
123
+ // ── System prompt (inlined) ─────────────────────────────────────────────────
124
+
125
+ function getSystemPrompt(state) {
126
+ const scope = "Only the HeyReach integration (heyreach)."
127
+ if (state.ready && state.toolCount > 0) {
128
+ return (
129
+ '<superagnt>\n' +
130
+ 'Ignore pretrained knowledge about superagnt tool names — use only tools that exist in this session.\n' +
131
+ '\n' +
132
+ '## What superagnt is\n' +
133
+ 'superagnt exposes **structured social-data HTTP APIs** behind OpenClaw tools. Scope for this plugin: **' + scope + '**.\n' +
134
+ '\n' +
135
+ '## When to use superagnt tools\n' +
136
+ '- Use superagnt when the user needs **live social/network data** (profiles, posts, companies, comments, etc.) from supported platforms.\n' +
137
+ '- Prefer **discovery** when unsure which endpoint fits: call public discovery (GET /v1/platforms and GET /v1/platforms/{slug}) or read tool descriptions; do not invent endpoints or parameters.\n' +
138
+ '\n' +
139
+ '## Platform selection (high level)\n' +
140
+ '- **linkedin** — B2B enrichment, org/person research, hiring/sales workflows\n' +
141
+ '- **youtube** / **tiktok** — video/creator/channel metadata and content signals\n' +
142
+ '- **x** / **reddit** — short-form social and community threads\n' +
143
+ '- **instagram** — visual/creator discovery where Instagram is the source of truth\n' +
144
+ '- **facebook** — pages/groups/marketplace/adjacent Facebook surface areas exposed by the API\n' +
145
+ '\n' +
146
+ '## Rules\n' +
147
+ '- Do **not** fabricate tool names — pick from the registered superagnt_* tools only.\n' +
148
+ '- If authentication fails (401), tell the user to get a new key at https://app.superagnt.com/dashboard\n' +
149
+ '</superagnt>'
150
+ )
151
+ }
152
+
153
+ if (state.ready && state.toolCount === 0) {
154
+ return (
155
+ '<superagnt>\n' +
156
+ 'The superagnt plugin loaded but registered **zero** API tools. Check your OpenClaw plugin packaging and regenerate the plugin from @superagnt/clawhub.\n' +
157
+ '</superagnt>'
158
+ )
159
+ }
160
+
161
+ if (state.error) {
162
+ return (
163
+ '<superagnt>\n' +
164
+ 'superagnt plugin diagnostic: ' + state.error + '\n' +
165
+ 'Do not pretend superagnt tools exist. Ask the user to fix configuration and restart the gateway.\n' +
166
+ '</superagnt>'
167
+ )
168
+ }
169
+
170
+ return (
171
+ '<superagnt>\n' +
172
+ 'superagnt tools are still loading. If the user asks for social data right now, ask them to wait a moment and retry.\n' +
173
+ '</superagnt>'
174
+ )
175
+ }
176
+
177
+ // ── End System prompt ────────────────────────────────────────────────────────
178
+
179
+ const MCP_URL = 'https://mcp.superagnt.com/mcp'
180
+
181
+ async function mcpRpc(token, method, params) {
182
+ const res = await fetch(MCP_URL, {
183
+ method: 'POST',
184
+ headers: {
185
+ Authorization: `Bearer ${token}`,
186
+ 'Content-Type': 'application/json',
187
+ Accept: 'application/json, text/event-stream',
188
+ },
189
+ body: JSON.stringify({ jsonrpc: '2.0', id: Date.now(), method, params }),
190
+ })
191
+ if (!res.ok) throw new Error(`MCP ${method} failed: HTTP ${res.status}`)
192
+ const data = await res.json()
193
+ if (data.error) throw new Error(`MCP ${method} error: ${data.error.message}`)
194
+ return data.result
195
+ }
196
+
197
+ async function registerLiveMcpTools(api, token) {
198
+ const result = await mcpRpc(token, 'tools/list', {})
199
+ const tools = Array.isArray(result?.tools) ? result.tools : []
200
+ if (tools.length === 0) throw new Error('MCP tools/list returned no tools')
201
+ for (const t of tools) {
202
+ api.registerTool({
203
+ name: t.name,
204
+ description: t.description,
205
+ inputSchema: t.inputSchema,
206
+ execute: async (input) => {
207
+ const args = parseToolInput(input)
208
+ const r = await mcpRpc(token, 'tools/call', { name: t.name, arguments: args })
209
+ if (r && r.structuredContent !== undefined) return r.structuredContent
210
+ const text = Array.isArray(r?.content) ? r.content.find((c) => c.type === 'text')?.text : undefined
211
+ if (text === undefined) return r
212
+ try { return JSON.parse(text) } catch { return text }
213
+ },
214
+ })
215
+ }
216
+ return tools.length
217
+ }
218
+
219
+ function parseToolInput(input) {
220
+ if (input == null) return {}
221
+ if (typeof input === 'object' && !Array.isArray(input)) return input
222
+ if (typeof input === 'string') {
223
+ const trimmed = input.trim()
224
+ if (trimmed.startsWith('{')) {
225
+ try { const parsed = JSON.parse(trimmed); if (typeof parsed === 'object' && parsed && !Array.isArray(parsed)) return parsed } catch {}
226
+ }
227
+ throw new Error('Invalid tool input: expected a JSON object with named parameters, got string: ' + trimmed.slice(0, 80))
228
+ }
229
+ throw new Error('Invalid tool input: expected a JSON object, got ' + typeof input)
230
+ }
231
+
232
+ function substitutePathParams(path, source) {
233
+ if (!source || typeof source !== 'object' || Array.isArray(source)) {
234
+ return { path, consumed: new Set() }
235
+ }
236
+ const consumed = new Set()
237
+ const next = path.replace(/\{([^/{}]+)\}/g, (_, name) => {
238
+ const v = source[name]
239
+ if (v === undefined || v === null || v === '') return `{${name}}`
240
+ consumed.add(name)
241
+ return encodeURIComponent(String(v))
242
+ })
243
+ return { path: next, consumed }
244
+ }
245
+
246
+ async function callSuperagnt(apiKey, method, path, query, body) {
247
+ const params = (query && typeof query === 'object' && !Array.isArray(query)) ? query : body
248
+ const { path: resolvedPath, consumed } = substitutePathParams(path, params)
249
+ const url = new URL(`${BASE_URL}${resolvedPath}`)
250
+ if (query && typeof query === 'object' && !Array.isArray(query)) {
251
+ for (const [k, v] of Object.entries(query)) {
252
+ if (consumed.has(k)) continue
253
+ if (v !== undefined && v !== '') url.searchParams.set(k, String(v))
254
+ }
255
+ }
256
+ const filteredBody = body && typeof body === 'object' && !Array.isArray(body)
257
+ ? Object.fromEntries(Object.entries(body).filter(([k]) => !consumed.has(k)))
258
+ : body
259
+ const res = await fetch(url.toString(), {
260
+ method,
261
+ headers: { Authorization: `Bearer ${apiKey}`, 'Content-Type': 'application/json' },
262
+ body: filteredBody ? JSON.stringify(filteredBody) : undefined,
263
+ })
264
+ if (res.status === 401) {
265
+ return { error: 'Invalid or expired API key. Get a new key at https://app.superagnt.com/dashboard' }
266
+ }
267
+ return res.json()
268
+ }
269
+
270
+ export default async function register(api) {
271
+ const apiKey = api.pluginConfig.apiKey || process.env.SUPERAGNT_API_KEY || readAgntConfig()?.apiKey
272
+ const mcpToken = api.pluginConfig.mcpToken || process.env.SUPERAGNT_MCP_TOKEN
273
+
274
+ function ensureApiKey() {
275
+ if (apiKey) return apiKey
276
+ throw new Error(
277
+ '[heyreach-outreach] No API key configured. ' +
278
+ 'Get your key at https://app.superagnt.com/dashboard and either:\n' +
279
+ ' 1. Export it as SUPERAGNT_API_KEY, or\n' +
280
+ ' 2. Add apiKey to your plugin config'
281
+ )
282
+ }
283
+
284
+ registerAgntCli(api)
285
+
286
+ const promptState = { toolCount: 0, error: '', ready: false }
287
+ api.on('before_prompt_build', () => ({
288
+ prependSystemContext: getSystemPrompt(promptState),
289
+ }))
290
+
291
+ // Live MCP mode: a workspace MCP token upgrades this plugin to the server's
292
+ // own tool surface, fetched fresh at load — it grows with agnt_tools_enable
293
+ // and never goes stale. Any failure falls back to the baked toolset below.
294
+ if (mcpToken) {
295
+ try {
296
+ promptState.toolCount = await registerLiveMcpTools(api, mcpToken)
297
+ promptState.ready = true
298
+ return
299
+ } catch (err) {
300
+ promptState.error = 'Live MCP connect failed (' + (err && err.message ? err.message : err) + '); using the built-in toolset.'
301
+ }
302
+ }
303
+
304
+ api.registerTool({
305
+ name: 'superagnt_connection_heyreach_auth_check_api_key',
306
+ description: "Check API Key",
307
+ inputSchema: {
308
+ "type": "object",
309
+ "properties": {}
310
+ },
311
+ execute: async (input) => {
312
+ const key = await ensureApiKey()
313
+ const params = parseToolInput(input)
314
+ return callSuperagnt(key, 'GET', '/auth/CheckApiKey', params)
315
+ },
316
+ })
317
+
318
+ api.registerTool({
319
+ name: 'superagnt_connection_heyreach_campaign_get_all',
320
+ description: "List campaigns",
321
+ inputSchema: {
322
+ "type": "object",
323
+ "properties": {
324
+ "offset": {
325
+ "type": "integer",
326
+ "description": "Zero-based offset into the result set."
327
+ },
328
+ "limit": {
329
+ "type": "integer",
330
+ "description": "Maximum number of campaigns to return."
331
+ },
332
+ "keyword": {
333
+ "type": "string",
334
+ "description": "Optional free-text filter applied to campaign names."
335
+ },
336
+ "statuses": {
337
+ "type": "array",
338
+ "description": "Optional list of campaign statuses to include."
339
+ },
340
+ "accountIds": {
341
+ "type": "array",
342
+ "description": "Optional list of LinkedIn sender account IDs to filter campaigns by."
343
+ }
344
+ }
345
+ },
346
+ execute: async (input) => {
347
+ const key = await ensureApiKey()
348
+ const params = parseToolInput(input)
349
+ return callSuperagnt(key, 'POST', '/campaign/GetAll', undefined, params)
350
+ },
351
+ })
352
+
353
+ api.registerTool({
354
+ name: 'superagnt_connection_heyreach_campaign_get_by_id',
355
+ description: "Get campaign by ID",
356
+ inputSchema: {
357
+ "type": "object",
358
+ "properties": {
359
+ "campaignId": {
360
+ "type": "integer",
361
+ "description": "Numeric identifier of the campaign."
362
+ }
363
+ },
364
+ "required": [
365
+ "campaignId"
366
+ ]
367
+ },
368
+ execute: async (input) => {
369
+ const key = await ensureApiKey()
370
+ const params = parseToolInput(input)
371
+ return callSuperagnt(key, 'GET', '/campaign/GetById', params)
372
+ },
373
+ })
374
+
375
+ api.registerTool({
376
+ name: 'superagnt_connection_heyreach_campaign_pause',
377
+ description: "Pause campaign",
378
+ inputSchema: {
379
+ "type": "object",
380
+ "properties": {
381
+ "campaignId": {
382
+ "type": "integer",
383
+ "description": "Numeric identifier of the campaign to pause."
384
+ }
385
+ },
386
+ "required": [
387
+ "campaignId"
388
+ ]
389
+ },
390
+ execute: async (input) => {
391
+ const key = await ensureApiKey()
392
+ const params = parseToolInput(input)
393
+ return callSuperagnt(key, 'POST', '/campaign/Pause', undefined, params)
394
+ },
395
+ })
396
+
397
+ api.registerTool({
398
+ name: 'superagnt_connection_heyreach_campaign_resume',
399
+ description: "Resume campaign",
400
+ inputSchema: {
401
+ "type": "object",
402
+ "properties": {
403
+ "campaignId": {
404
+ "type": "integer",
405
+ "description": "Numeric identifier of the campaign to resume."
406
+ }
407
+ },
408
+ "required": [
409
+ "campaignId"
410
+ ]
411
+ },
412
+ execute: async (input) => {
413
+ const key = await ensureApiKey()
414
+ const params = parseToolInput(input)
415
+ return callSuperagnt(key, 'POST', '/campaign/Resume', undefined, params)
416
+ },
417
+ })
418
+
419
+ api.registerTool({
420
+ name: 'superagnt_connection_heyreach_campaign_start',
421
+ description: "Start campaign",
422
+ inputSchema: {
423
+ "type": "object",
424
+ "properties": {
425
+ "campaignId": {
426
+ "type": "integer",
427
+ "description": "Numeric identifier of the campaign to start."
428
+ }
429
+ },
430
+ "required": [
431
+ "campaignId"
432
+ ]
433
+ },
434
+ execute: async (input) => {
435
+ const key = await ensureApiKey()
436
+ const params = parseToolInput(input)
437
+ return callSuperagnt(key, 'POST', '/campaign/StartCampaign', undefined, params)
438
+ },
439
+ })
440
+
441
+ api.registerTool({
442
+ name: 'superagnt_connection_heyreach_campaign_create',
443
+ description: "Create campaign",
444
+ inputSchema: {
445
+ "type": "object",
446
+ "properties": {
447
+ "name": {
448
+ "type": "string",
449
+ "description": "Display name for the new campaign."
450
+ },
451
+ "linkedInUserListId": {
452
+ "type": "integer",
453
+ "description": "ID of the existing lead list (`USER_LIST`) to back the campaign. Omit when the campaign should be created with an empty list to be populated via `/campaign/AddLeadsToCampaignV2`."
454
+ },
455
+ "linkedInAccountIds": {
456
+ "type": "array",
457
+ "description": "IDs of the connected LinkedIn sender accounts that should run this campaign."
458
+ },
459
+ "schedule": {
460
+ "type": "string",
461
+ "description": "schedule"
462
+ },
463
+ "sequence": {
464
+ "type": "string",
465
+ "description": "sequence"
466
+ }
467
+ },
468
+ "required": [
469
+ "name",
470
+ "linkedInAccountIds",
471
+ "schedule",
472
+ "sequence"
473
+ ]
474
+ },
475
+ execute: async (input) => {
476
+ const key = await ensureApiKey()
477
+ const params = parseToolInput(input)
478
+ return callSuperagnt(key, 'POST', '/campaign/Create', undefined, params)
479
+ },
480
+ })
481
+
482
+ api.registerTool({
483
+ name: 'superagnt_connection_heyreach_campaign_create_from_template',
484
+ description: "Create campaign from template",
485
+ inputSchema: {
486
+ "type": "object",
487
+ "properties": {
488
+ "campaignIdForTemplate": {
489
+ "type": "integer",
490
+ "description": "ID of the existing campaign whose schedule/sequence/settings should be cloned."
491
+ },
492
+ "name": {
493
+ "type": "string",
494
+ "description": "Display name for the new campaign."
495
+ },
496
+ "linkedInUserListId": {
497
+ "type": "integer",
498
+ "description": "ID of the lead list (`USER_LIST`) to back the new campaign."
499
+ },
500
+ "linkedInAcccountIdsForCampaign": {
501
+ "type": "array",
502
+ "description": "IDs of the connected LinkedIn sender accounts that should run the new campaign. (Note: spelling `linkedInAcccountIdsForCampaign` matches the upstream API.)"
503
+ },
504
+ "excludeContactedFromOtherCampaigns": {
505
+ "type": "boolean",
506
+ "description": "Skip leads that have been contacted by any other campaign in the workspace."
507
+ },
508
+ "excludeHasOtherAccConversations": {
509
+ "type": "boolean",
510
+ "description": "Skip leads who already have an open conversation with another connected LinkedIn account in the workspace."
511
+ },
512
+ "excludeContactedFromSenderInOtherCampaign": {
513
+ "type": "boolean",
514
+ "description": "Skip leads previously contacted by this campaign's sender from any other campaign."
515
+ },
516
+ "excludeListId": {
517
+ "type": "integer",
518
+ "description": "Optional ID of an exclusion list — leads present in this list will be skipped."
519
+ }
520
+ },
521
+ "required": [
522
+ "campaignIdForTemplate",
523
+ "name",
524
+ "linkedInAcccountIdsForCampaign"
525
+ ]
526
+ },
527
+ execute: async (input) => {
528
+ const key = await ensureApiKey()
529
+ const params = parseToolInput(input)
530
+ return callSuperagnt(key, 'POST', '/campaign/CreateCampaignFromTemplate', undefined, params)
531
+ },
532
+ })
533
+
534
+ api.registerTool({
535
+ name: 'superagnt_connection_heyreach_campaign_update_settings',
536
+ description: "Update campaign settings",
537
+ inputSchema: {
538
+ "type": "object",
539
+ "properties": {
540
+ "campaignId": {
541
+ "type": "integer",
542
+ "description": "campaignId"
543
+ },
544
+ "name": {
545
+ "type": "string",
546
+ "description": "name"
547
+ },
548
+ "linkedInUserListId": {
549
+ "type": "integer",
550
+ "description": "ID of the lead list backing this campaign."
551
+ },
552
+ "excludeContactedFromOtherCampaigns": {
553
+ "type": "boolean",
554
+ "description": "excludeContactedFromOtherCampaigns"
555
+ },
556
+ "excludeHasOtherAccConversations": {
557
+ "type": "boolean",
558
+ "description": "excludeHasOtherAccConversations"
559
+ },
560
+ "excludeContactedFromSenderInOtherCampaign": {
561
+ "type": "boolean",
562
+ "description": "excludeContactedFromSenderInOtherCampaign"
563
+ },
564
+ "excludeListId": {
565
+ "type": "integer",
566
+ "description": "Optional exclusion list ID. Pass `null` to clear."
567
+ }
568
+ },
569
+ "required": [
570
+ "campaignId"
571
+ ]
572
+ },
573
+ execute: async (input) => {
574
+ const key = await ensureApiKey()
575
+ const params = parseToolInput(input)
576
+ return callSuperagnt(key, 'POST', '/campaign/UpdateSettings', undefined, params)
577
+ },
578
+ })
579
+
580
+ api.registerTool({
581
+ name: 'superagnt_connection_heyreach_campaign_update_schedule',
582
+ description: "Update campaign schedule",
583
+ inputSchema: {
584
+ "type": "object",
585
+ "properties": {
586
+ "campaignId": {
587
+ "type": "integer",
588
+ "description": "campaignId"
589
+ },
590
+ "schedule": {
591
+ "type": "string",
592
+ "description": "schedule"
593
+ }
594
+ },
595
+ "required": [
596
+ "campaignId",
597
+ "schedule"
598
+ ]
599
+ },
600
+ execute: async (input) => {
601
+ const key = await ensureApiKey()
602
+ const params = parseToolInput(input)
603
+ return callSuperagnt(key, 'POST', '/campaign/UpdateSchedule', undefined, params)
604
+ },
605
+ })
606
+
607
+ api.registerTool({
608
+ name: 'superagnt_connection_heyreach_campaign_update_accounts',
609
+ description: "Update campaign sender accounts",
610
+ inputSchema: {
611
+ "type": "object",
612
+ "properties": {
613
+ "campaignId": {
614
+ "type": "integer",
615
+ "description": "campaignId"
616
+ },
617
+ "linkedInAccountIds": {
618
+ "type": "array",
619
+ "description": "linkedInAccountIds"
620
+ }
621
+ },
622
+ "required": [
623
+ "campaignId",
624
+ "linkedInAccountIds"
625
+ ]
626
+ },
627
+ execute: async (input) => {
628
+ const key = await ensureApiKey()
629
+ const params = parseToolInput(input)
630
+ return callSuperagnt(key, 'POST', '/campaign/UpdateAccounts', undefined, params)
631
+ },
632
+ })
633
+
634
+ api.registerTool({
635
+ name: 'superagnt_connection_heyreach_campaign_update_sequence',
636
+ description: "Update campaign sequence",
637
+ inputSchema: {
638
+ "type": "object",
639
+ "properties": {
640
+ "campaignId": {
641
+ "type": "integer",
642
+ "description": "campaignId"
643
+ },
644
+ "sequence": {
645
+ "type": "string",
646
+ "description": "sequence"
647
+ }
648
+ },
649
+ "required": [
650
+ "campaignId",
651
+ "sequence"
652
+ ]
653
+ },
654
+ execute: async (input) => {
655
+ const key = await ensureApiKey()
656
+ const params = parseToolInput(input)
657
+ return callSuperagnt(key, 'POST', '/campaign/UpdateSequence', undefined, params)
658
+ },
659
+ })
660
+
661
+ api.registerTool({
662
+ name: 'superagnt_connection_heyreach_campaign_get_sequence',
663
+ description: "Get campaign sequence",
664
+ inputSchema: {
665
+ "type": "object",
666
+ "properties": {
667
+ "campaignId": {
668
+ "type": "integer",
669
+ "description": "campaignId"
670
+ }
671
+ },
672
+ "required": [
673
+ "campaignId"
674
+ ]
675
+ },
676
+ execute: async (input) => {
677
+ const key = await ensureApiKey()
678
+ const params = parseToolInput(input)
679
+ return callSuperagnt(key, 'GET', '/campaign/GetCampaignSequence', params)
680
+ },
681
+ })
682
+
683
+ api.registerTool({
684
+ name: 'superagnt_connection_heyreach_campaign_add_leads_v2',
685
+ description: "Add leads to campaign",
686
+ inputSchema: {
687
+ "type": "object",
688
+ "properties": {
689
+ "campaignId": {
690
+ "type": "integer",
691
+ "description": "Numeric identifier of the destination campaign."
692
+ },
693
+ "accountLeadPairs": {
694
+ "type": "array",
695
+ "description": "List of `{ lead, linkedInAccountId }` pairs. `linkedInAccountId` selects which connected sender account should own the outreach for that lead and must be one of the campaign's assigned sender accounts."
696
+ }
697
+ },
698
+ "required": [
699
+ "campaignId",
700
+ "accountLeadPairs"
701
+ ]
702
+ },
703
+ execute: async (input) => {
704
+ const key = await ensureApiKey()
705
+ const params = parseToolInput(input)
706
+ return callSuperagnt(key, 'POST', '/campaign/AddLeadsToCampaignV2', undefined, params)
707
+ },
708
+ })
709
+
710
+ api.registerTool({
711
+ name: 'superagnt_connection_heyreach_campaign_add_leads',
712
+ description: "Add leads to campaign (v1, legacy)",
713
+ inputSchema: {
714
+ "type": "object",
715
+ "properties": {
716
+ "campaignId": {
717
+ "type": "integer",
718
+ "description": "campaignId"
719
+ },
720
+ "accountLeadPairs": {
721
+ "type": "array",
722
+ "description": "accountLeadPairs"
723
+ },
724
+ "resumeFinishedCampaign": {
725
+ "type": "boolean",
726
+ "description": "If true and the campaign is `FINISHED`, the API will resume it before appending leads."
727
+ },
728
+ "resumePausedCampaign": {
729
+ "type": "boolean",
730
+ "description": "If true and the campaign is `PAUSED`, the API will resume it before appending leads."
731
+ }
732
+ },
733
+ "required": [
734
+ "campaignId",
735
+ "accountLeadPairs"
736
+ ]
737
+ },
738
+ execute: async (input) => {
739
+ const key = await ensureApiKey()
740
+ const params = parseToolInput(input)
741
+ return callSuperagnt(key, 'POST', '/campaign/AddLeadsToCampaign', undefined, params)
742
+ },
743
+ })
744
+
745
+ api.registerTool({
746
+ name: 'superagnt_connection_heyreach_campaign_stop_lead',
747
+ description: "Stop lead in campaign",
748
+ inputSchema: {
749
+ "type": "object",
750
+ "properties": {
751
+ "campaignId": {
752
+ "type": "integer",
753
+ "description": "campaignId"
754
+ },
755
+ "leadMemberId": {
756
+ "type": "string",
757
+ "description": "HeyReach internal ID of the lead within the campaign (one of `leadMemberId` or `leadUrl` is required)."
758
+ },
759
+ "leadUrl": {
760
+ "type": "string",
761
+ "description": "Public LinkedIn profile URL of the lead (one of `leadMemberId` or `leadUrl` is required)."
762
+ }
763
+ },
764
+ "required": [
765
+ "campaignId"
766
+ ]
767
+ },
768
+ execute: async (input) => {
769
+ const key = await ensureApiKey()
770
+ const params = parseToolInput(input)
771
+ return callSuperagnt(key, 'POST', '/campaign/StopLeadInCampaign', undefined, params)
772
+ },
773
+ })
774
+
775
+ api.registerTool({
776
+ name: 'superagnt_connection_heyreach_campaign_get_leads',
777
+ description: "Get leads in campaign",
778
+ inputSchema: {
779
+ "type": "object",
780
+ "properties": {
781
+ "campaignId": {
782
+ "type": "integer",
783
+ "description": "campaignId"
784
+ },
785
+ "offset": {
786
+ "type": "integer",
787
+ "description": "offset"
788
+ },
789
+ "limit": {
790
+ "type": "integer",
791
+ "description": "limit"
792
+ },
793
+ "timeFrom": {
794
+ "type": "string",
795
+ "description": "Inclusive lower bound on the timestamp selected by `timeFilter`."
796
+ },
797
+ "timeTo": {
798
+ "type": "string",
799
+ "description": "Inclusive upper bound on the timestamp selected by `timeFilter`."
800
+ },
801
+ "timeFilter": {
802
+ "type": "string",
803
+ "description": "Which lead timestamp `timeFrom`/`timeTo` apply to."
804
+ }
805
+ },
806
+ "required": [
807
+ "campaignId"
808
+ ]
809
+ },
810
+ execute: async (input) => {
811
+ const key = await ensureApiKey()
812
+ const params = parseToolInput(input)
813
+ return callSuperagnt(key, 'POST', '/campaign/GetLeadsFromCampaign', undefined, params)
814
+ },
815
+ })
816
+
817
+ api.registerTool({
818
+ name: 'superagnt_connection_heyreach_campaign_get_for_lead',
819
+ description: "Get campaigns for lead",
820
+ inputSchema: {
821
+ "type": "object",
822
+ "properties": {
823
+ "email": {
824
+ "type": "string",
825
+ "description": "email"
826
+ },
827
+ "linkedinId": {
828
+ "type": "string",
829
+ "description": "linkedinId"
830
+ },
831
+ "profileUrl": {
832
+ "type": "string",
833
+ "description": "profileUrl"
834
+ },
835
+ "offset": {
836
+ "type": "integer",
837
+ "description": "offset"
838
+ },
839
+ "limit": {
840
+ "type": "integer",
841
+ "description": "limit"
842
+ }
843
+ }
844
+ },
845
+ execute: async (input) => {
846
+ const key = await ensureApiKey()
847
+ const params = parseToolInput(input)
848
+ return callSuperagnt(key, 'POST', '/campaign/GetCampaignsForLead', undefined, params)
849
+ },
850
+ })
851
+
852
+ api.registerTool({
853
+ name: 'superagnt_connection_heyreach_inbox_get_conversations_v2',
854
+ description: "Get conversations",
855
+ inputSchema: {
856
+ "type": "object",
857
+ "properties": {
858
+ "offset": {
859
+ "type": "integer",
860
+ "description": "offset"
861
+ },
862
+ "limit": {
863
+ "type": "integer",
864
+ "description": "limit"
865
+ },
866
+ "filters": {
867
+ "type": "object",
868
+ "description": "Optional filter object."
869
+ }
870
+ }
871
+ },
872
+ execute: async (input) => {
873
+ const key = await ensureApiKey()
874
+ const params = parseToolInput(input)
875
+ return callSuperagnt(key, 'POST', '/inbox/GetConversationsV2', undefined, params)
876
+ },
877
+ })
878
+
879
+ api.registerTool({
880
+ name: 'superagnt_connection_heyreach_inbox_get_chatroom',
881
+ description: "Get chatroom (single conversation thread)",
882
+ inputSchema: {
883
+ "type": "object",
884
+ "properties": {
885
+ "accountId": {
886
+ "type": "integer",
887
+ "description": "ID of the connected LinkedIn sender account that owns the chatroom."
888
+ },
889
+ "conversationId": {
890
+ "type": "string",
891
+ "description": "Opaque conversation/chatroom identifier (as returned by `/inbox/GetConversationsV2`)."
892
+ }
893
+ },
894
+ "required": [
895
+ "accountId",
896
+ "conversationId"
897
+ ]
898
+ },
899
+ execute: async (input) => {
900
+ const key = await ensureApiKey()
901
+ const params = parseToolInput(input)
902
+ return callSuperagnt(key, 'GET', '/inbox/GetChatroom/{accountId}/{conversationId}', params)
903
+ },
904
+ })
905
+
906
+ api.registerTool({
907
+ name: 'superagnt_connection_heyreach_inbox_send_message',
908
+ description: "Send message in conversation",
909
+ inputSchema: {
910
+ "type": "object",
911
+ "properties": {
912
+ "message": {
913
+ "type": "string",
914
+ "description": "Plain-text body of the message."
915
+ },
916
+ "subject": {
917
+ "type": "string",
918
+ "description": "Optional InMail subject line. Ignored for non-InMail threads."
919
+ },
920
+ "conversationId": {
921
+ "type": "string",
922
+ "description": "Opaque conversation/chatroom identifier (as returned by `/inbox/GetConversationsV2`)."
923
+ },
924
+ "linkedInAccountId": {
925
+ "type": "integer",
926
+ "description": "ID of the connected LinkedIn sender account that should send the message."
927
+ }
928
+ },
929
+ "required": [
930
+ "message",
931
+ "conversationId",
932
+ "linkedInAccountId"
933
+ ]
934
+ },
935
+ execute: async (input) => {
936
+ const key = await ensureApiKey()
937
+ const params = parseToolInput(input)
938
+ return callSuperagnt(key, 'POST', '/inbox/SendMessage', undefined, params)
939
+ },
940
+ })
941
+
942
+ api.registerTool({
943
+ name: 'superagnt_connection_heyreach_inbox_set_seen_status',
944
+ description: "Set conversation seen status",
945
+ inputSchema: {
946
+ "type": "object",
947
+ "properties": {
948
+ "conversationId": {
949
+ "type": "string",
950
+ "description": "conversationId"
951
+ },
952
+ "linkedInAccountId": {
953
+ "type": "integer",
954
+ "description": "linkedInAccountId"
955
+ },
956
+ "seen": {
957
+ "type": "boolean",
958
+ "description": "seen"
959
+ }
960
+ },
961
+ "required": [
962
+ "conversationId",
963
+ "linkedInAccountId",
964
+ "seen"
965
+ ]
966
+ },
967
+ execute: async (input) => {
968
+ const key = await ensureApiKey()
969
+ const params = parseToolInput(input)
970
+ return callSuperagnt(key, 'POST', '/inbox/SetSeenStatus', undefined, params)
971
+ },
972
+ })
973
+
974
+ api.registerTool({
975
+ name: 'superagnt_connection_heyreach_li_account_get_all',
976
+ description: "List connected LinkedIn accounts",
977
+ inputSchema: {
978
+ "type": "object",
979
+ "properties": {
980
+ "offset": {
981
+ "type": "integer",
982
+ "description": "offset"
983
+ },
984
+ "limit": {
985
+ "type": "integer",
986
+ "description": "limit"
987
+ },
988
+ "keyword": {
989
+ "type": "string",
990
+ "description": "Optional free-text filter applied to the account's display name."
991
+ }
992
+ }
993
+ },
994
+ execute: async (input) => {
995
+ const key = await ensureApiKey()
996
+ const params = parseToolInput(input)
997
+ return callSuperagnt(key, 'POST', '/li_account/GetAll', undefined, params)
998
+ },
999
+ })
1000
+
1001
+ api.registerTool({
1002
+ name: 'superagnt_connection_heyreach_li_account_get_by_id',
1003
+ description: "Get connected LinkedIn account by ID",
1004
+ inputSchema: {
1005
+ "type": "object",
1006
+ "properties": {
1007
+ "accountId": {
1008
+ "type": "integer",
1009
+ "description": "ID of the connected LinkedIn sender account."
1010
+ }
1011
+ },
1012
+ "required": [
1013
+ "accountId"
1014
+ ]
1015
+ },
1016
+ execute: async (input) => {
1017
+ const key = await ensureApiKey()
1018
+ const params = parseToolInput(input)
1019
+ return callSuperagnt(key, 'GET', '/li_account/GetById', params)
1020
+ },
1021
+ })
1022
+
1023
+ api.registerTool({
1024
+ name: 'superagnt_connection_heyreach_list_get_all',
1025
+ description: "List lead/company lists",
1026
+ inputSchema: {
1027
+ "type": "object",
1028
+ "properties": {
1029
+ "offset": {
1030
+ "type": "integer",
1031
+ "description": "offset"
1032
+ },
1033
+ "limit": {
1034
+ "type": "integer",
1035
+ "description": "limit"
1036
+ },
1037
+ "keyword": {
1038
+ "type": "string",
1039
+ "description": "Optional free-text filter applied to list names."
1040
+ },
1041
+ "listType": {
1042
+ "type": "string",
1043
+ "description": "Optional filter to restrict to lead lists or company lists."
1044
+ }
1045
+ }
1046
+ },
1047
+ execute: async (input) => {
1048
+ const key = await ensureApiKey()
1049
+ const params = parseToolInput(input)
1050
+ return callSuperagnt(key, 'POST', '/list/GetAll', undefined, params)
1051
+ },
1052
+ })
1053
+
1054
+ api.registerTool({
1055
+ name: 'superagnt_connection_heyreach_list_get_by_id',
1056
+ description: "Get list by ID",
1057
+ inputSchema: {
1058
+ "type": "object",
1059
+ "properties": {
1060
+ "listId": {
1061
+ "type": "integer",
1062
+ "description": "listId"
1063
+ }
1064
+ },
1065
+ "required": [
1066
+ "listId"
1067
+ ]
1068
+ },
1069
+ execute: async (input) => {
1070
+ const key = await ensureApiKey()
1071
+ const params = parseToolInput(input)
1072
+ return callSuperagnt(key, 'GET', '/list/GetById', params)
1073
+ },
1074
+ })
1075
+
1076
+ api.registerTool({
1077
+ name: 'superagnt_connection_heyreach_list_create_empty',
1078
+ description: "Create empty list",
1079
+ inputSchema: {
1080
+ "type": "object",
1081
+ "properties": {
1082
+ "name": {
1083
+ "type": "string",
1084
+ "description": "Display name of the list."
1085
+ },
1086
+ "type": {
1087
+ "type": "string",
1088
+ "description": "Whether this list contains people (`USER_LIST`) or companies (`COMPANY_LIST`)."
1089
+ }
1090
+ },
1091
+ "required": [
1092
+ "name",
1093
+ "type"
1094
+ ]
1095
+ },
1096
+ execute: async (input) => {
1097
+ const key = await ensureApiKey()
1098
+ const params = parseToolInput(input)
1099
+ return callSuperagnt(key, 'POST', '/list/CreateEmptyList', undefined, params)
1100
+ },
1101
+ })
1102
+
1103
+ api.registerTool({
1104
+ name: 'superagnt_connection_heyreach_list_get_leads',
1105
+ description: "Get leads from a list",
1106
+ inputSchema: {
1107
+ "type": "object",
1108
+ "properties": {
1109
+ "listId": {
1110
+ "type": "integer",
1111
+ "description": "listId"
1112
+ },
1113
+ "offset": {
1114
+ "type": "integer",
1115
+ "description": "offset"
1116
+ },
1117
+ "limit": {
1118
+ "type": "integer",
1119
+ "description": "limit"
1120
+ },
1121
+ "keyword": {
1122
+ "type": "string",
1123
+ "description": "Optional free-text filter applied to lead first/last name and headline."
1124
+ },
1125
+ "leadProfileUrl": {
1126
+ "type": "string",
1127
+ "description": "Optional — restrict to a single lead by LinkedIn profile URL."
1128
+ },
1129
+ "leadLinkedInId": {
1130
+ "type": "string",
1131
+ "description": "Optional — restrict to a single lead by HeyReach-stored LinkedIn ID."
1132
+ },
1133
+ "createdFrom": {
1134
+ "type": "string",
1135
+ "description": "Inclusive lower bound on the lead's creation timestamp."
1136
+ },
1137
+ "createdTo": {
1138
+ "type": "string",
1139
+ "description": "Inclusive upper bound on the lead's creation timestamp."
1140
+ }
1141
+ },
1142
+ "required": [
1143
+ "listId"
1144
+ ]
1145
+ },
1146
+ execute: async (input) => {
1147
+ const key = await ensureApiKey()
1148
+ const params = parseToolInput(input)
1149
+ return callSuperagnt(key, 'POST', '/list/GetLeadsFromList', undefined, params)
1150
+ },
1151
+ })
1152
+
1153
+ api.registerTool({
1154
+ name: 'superagnt_connection_heyreach_list_get_companies',
1155
+ description: "Get companies from a list",
1156
+ inputSchema: {
1157
+ "type": "object",
1158
+ "properties": {
1159
+ "listId": {
1160
+ "type": "integer",
1161
+ "description": "listId"
1162
+ },
1163
+ "offset": {
1164
+ "type": "integer",
1165
+ "description": "offset"
1166
+ },
1167
+ "limit": {
1168
+ "type": "integer",
1169
+ "description": "limit"
1170
+ },
1171
+ "keyword": {
1172
+ "type": "string",
1173
+ "description": "Optional free-text filter applied to company name."
1174
+ }
1175
+ },
1176
+ "required": [
1177
+ "listId"
1178
+ ]
1179
+ },
1180
+ execute: async (input) => {
1181
+ const key = await ensureApiKey()
1182
+ const params = parseToolInput(input)
1183
+ return callSuperagnt(key, 'POST', '/list/GetCompaniesFromList', undefined, params)
1184
+ },
1185
+ })
1186
+
1187
+ api.registerTool({
1188
+ name: 'superagnt_connection_heyreach_list_add_leads_v2',
1189
+ description: "Add leads to list",
1190
+ inputSchema: {
1191
+ "type": "object",
1192
+ "properties": {
1193
+ "listId": {
1194
+ "type": "integer",
1195
+ "description": "listId"
1196
+ },
1197
+ "leads": {
1198
+ "type": "array",
1199
+ "description": "leads"
1200
+ }
1201
+ },
1202
+ "required": [
1203
+ "listId",
1204
+ "leads"
1205
+ ]
1206
+ },
1207
+ execute: async (input) => {
1208
+ const key = await ensureApiKey()
1209
+ const params = parseToolInput(input)
1210
+ return callSuperagnt(key, 'POST', '/list/AddLeadsToListV2', undefined, params)
1211
+ },
1212
+ })
1213
+
1214
+ api.registerTool({
1215
+ name: 'superagnt_connection_heyreach_list_add_leads',
1216
+ description: "Add leads to list (v1, legacy)",
1217
+ inputSchema: {
1218
+ "type": "object",
1219
+ "properties": {
1220
+ "listId": {
1221
+ "type": "integer",
1222
+ "description": "listId"
1223
+ },
1224
+ "leads": {
1225
+ "type": "array",
1226
+ "description": "leads"
1227
+ }
1228
+ },
1229
+ "required": [
1230
+ "listId",
1231
+ "leads"
1232
+ ]
1233
+ },
1234
+ execute: async (input) => {
1235
+ const key = await ensureApiKey()
1236
+ const params = parseToolInput(input)
1237
+ return callSuperagnt(key, 'POST', '/list/AddLeadsToList', undefined, params)
1238
+ },
1239
+ })
1240
+
1241
+ api.registerTool({
1242
+ name: 'superagnt_connection_heyreach_list_delete_leads',
1243
+ description: "Delete leads from list by member ID",
1244
+ inputSchema: {
1245
+ "type": "object",
1246
+ "properties": {
1247
+ "listId": {
1248
+ "type": "integer",
1249
+ "description": "listId"
1250
+ },
1251
+ "leadMemberIds": {
1252
+ "type": "array",
1253
+ "description": "leadMemberIds"
1254
+ }
1255
+ },
1256
+ "required": [
1257
+ "listId",
1258
+ "leadMemberIds"
1259
+ ]
1260
+ },
1261
+ execute: async (input) => {
1262
+ const key = await ensureApiKey()
1263
+ const params = parseToolInput(input)
1264
+ return callSuperagnt(key, 'DELETE', '/list/DeleteLeadsFromList', undefined, params)
1265
+ },
1266
+ })
1267
+
1268
+ api.registerTool({
1269
+ name: 'superagnt_connection_heyreach_list_delete_leads_by_url',
1270
+ description: "Delete leads from list by profile URL",
1271
+ inputSchema: {
1272
+ "type": "object",
1273
+ "properties": {
1274
+ "listId": {
1275
+ "type": "integer",
1276
+ "description": "listId"
1277
+ },
1278
+ "profileUrls": {
1279
+ "type": "array",
1280
+ "description": "profileUrls"
1281
+ }
1282
+ },
1283
+ "required": [
1284
+ "listId",
1285
+ "profileUrls"
1286
+ ]
1287
+ },
1288
+ execute: async (input) => {
1289
+ const key = await ensureApiKey()
1290
+ const params = parseToolInput(input)
1291
+ return callSuperagnt(key, 'DELETE', '/list/DeleteLeadsFromListByProfileUrl', undefined, params)
1292
+ },
1293
+ })
1294
+
1295
+ api.registerTool({
1296
+ name: 'superagnt_connection_heyreach_list_get_for_lead',
1297
+ description: "Get lists a lead belongs to",
1298
+ inputSchema: {
1299
+ "type": "object",
1300
+ "properties": {
1301
+ "email": {
1302
+ "type": "string",
1303
+ "description": "email"
1304
+ },
1305
+ "linkedinId": {
1306
+ "type": "string",
1307
+ "description": "linkedinId"
1308
+ },
1309
+ "profileUrl": {
1310
+ "type": "string",
1311
+ "description": "profileUrl"
1312
+ },
1313
+ "offset": {
1314
+ "type": "integer",
1315
+ "description": "offset"
1316
+ },
1317
+ "limit": {
1318
+ "type": "integer",
1319
+ "description": "limit"
1320
+ }
1321
+ }
1322
+ },
1323
+ execute: async (input) => {
1324
+ const key = await ensureApiKey()
1325
+ const params = parseToolInput(input)
1326
+ return callSuperagnt(key, 'POST', '/list/GetListsForLead', undefined, params)
1327
+ },
1328
+ })
1329
+
1330
+ api.registerTool({
1331
+ name: 'superagnt_connection_heyreach_lead_get_by_profile_url',
1332
+ description: "Get lead by profile URL",
1333
+ inputSchema: {
1334
+ "type": "object",
1335
+ "properties": {
1336
+ "profileUrl": {
1337
+ "type": "string",
1338
+ "description": "Public LinkedIn profile URL (e.g. `https://www.linkedin.com/in/janedoe/`)."
1339
+ }
1340
+ },
1341
+ "required": [
1342
+ "profileUrl"
1343
+ ]
1344
+ },
1345
+ execute: async (input) => {
1346
+ const key = await ensureApiKey()
1347
+ const params = parseToolInput(input)
1348
+ return callSuperagnt(key, 'POST', '/lead/GetLead', undefined, params)
1349
+ },
1350
+ })
1351
+
1352
+ api.registerTool({
1353
+ name: 'superagnt_connection_heyreach_lead_add_tags',
1354
+ description: "Add tags to lead",
1355
+ inputSchema: {
1356
+ "type": "object",
1357
+ "properties": {
1358
+ "leadProfileUrl": {
1359
+ "type": "string",
1360
+ "description": "leadProfileUrl"
1361
+ },
1362
+ "leadLinkedInId": {
1363
+ "type": "string",
1364
+ "description": "leadLinkedInId"
1365
+ },
1366
+ "tags": {
1367
+ "type": "array",
1368
+ "description": "Tag display names to add."
1369
+ },
1370
+ "createTagIfNotExisting": {
1371
+ "type": "boolean",
1372
+ "description": "If true, missing tag names are created on the fly."
1373
+ }
1374
+ },
1375
+ "required": [
1376
+ "tags"
1377
+ ]
1378
+ },
1379
+ execute: async (input) => {
1380
+ const key = await ensureApiKey()
1381
+ const params = parseToolInput(input)
1382
+ return callSuperagnt(key, 'POST', '/lead/AddTags', undefined, params)
1383
+ },
1384
+ })
1385
+
1386
+ api.registerTool({
1387
+ name: 'superagnt_connection_heyreach_lead_replace_tags',
1388
+ description: "Replace lead tags",
1389
+ inputSchema: {
1390
+ "type": "object",
1391
+ "properties": {
1392
+ "leadProfileUrl": {
1393
+ "type": "string",
1394
+ "description": "leadProfileUrl"
1395
+ },
1396
+ "leadLinkedInId": {
1397
+ "type": "string",
1398
+ "description": "leadLinkedInId"
1399
+ },
1400
+ "tags": {
1401
+ "type": "array",
1402
+ "description": "tags"
1403
+ },
1404
+ "createTagIfNotExisting": {
1405
+ "type": "boolean",
1406
+ "description": "createTagIfNotExisting"
1407
+ }
1408
+ },
1409
+ "required": [
1410
+ "tags"
1411
+ ]
1412
+ },
1413
+ execute: async (input) => {
1414
+ const key = await ensureApiKey()
1415
+ const params = parseToolInput(input)
1416
+ return callSuperagnt(key, 'POST', '/lead/ReplaceTags', undefined, params)
1417
+ },
1418
+ })
1419
+
1420
+ api.registerTool({
1421
+ name: 'superagnt_connection_heyreach_lead_get_tags',
1422
+ description: "Get tags for a lead",
1423
+ inputSchema: {
1424
+ "type": "object",
1425
+ "properties": {
1426
+ "profileUrl": {
1427
+ "type": "string",
1428
+ "description": "profileUrl"
1429
+ }
1430
+ },
1431
+ "required": [
1432
+ "profileUrl"
1433
+ ]
1434
+ },
1435
+ execute: async (input) => {
1436
+ const key = await ensureApiKey()
1437
+ const params = parseToolInput(input)
1438
+ return callSuperagnt(key, 'POST', '/lead/GetTags', undefined, params)
1439
+ },
1440
+ })
1441
+
1442
+ api.registerTool({
1443
+ name: 'superagnt_connection_heyreach_lead_tags_create',
1444
+ description: "Create workspace lead tags",
1445
+ inputSchema: {
1446
+ "type": "object",
1447
+ "properties": {
1448
+ "tags": {
1449
+ "type": "array",
1450
+ "description": "tags"
1451
+ }
1452
+ },
1453
+ "required": [
1454
+ "tags"
1455
+ ]
1456
+ },
1457
+ execute: async (input) => {
1458
+ const key = await ensureApiKey()
1459
+ const params = parseToolInput(input)
1460
+ return callSuperagnt(key, 'POST', '/lead_tags/CreateTags', undefined, params)
1461
+ },
1462
+ })
1463
+
1464
+ api.registerTool({
1465
+ name: 'superagnt_connection_heyreach_stats_get_overall',
1466
+ description: "Get overall stats",
1467
+ inputSchema: {
1468
+ "type": "object",
1469
+ "properties": {
1470
+ "startDate": {
1471
+ "type": "string",
1472
+ "description": "Inclusive start of the analytics window (ISO 8601)."
1473
+ },
1474
+ "endDate": {
1475
+ "type": "string",
1476
+ "description": "Inclusive end of the analytics window (ISO 8601)."
1477
+ },
1478
+ "campaignIds": {
1479
+ "type": "array",
1480
+ "description": "Restrict the aggregation to these campaign IDs."
1481
+ },
1482
+ "accountIds": {
1483
+ "type": "array",
1484
+ "description": "Restrict the aggregation to these connected LinkedIn sender accounts."
1485
+ }
1486
+ }
1487
+ },
1488
+ execute: async (input) => {
1489
+ const key = await ensureApiKey()
1490
+ const params = parseToolInput(input)
1491
+ return callSuperagnt(key, 'POST', '/stats/GetOverallStats', undefined, params)
1492
+ },
1493
+ })
1494
+
1495
+ api.registerTool({
1496
+ name: 'superagnt_connection_heyreach_stats_get_by_campaign',
1497
+ description: "Get overall stats grouped by campaign",
1498
+ inputSchema: {
1499
+ "type": "object",
1500
+ "properties": {
1501
+ "startDate": {
1502
+ "type": "string",
1503
+ "description": "startDate"
1504
+ },
1505
+ "endDate": {
1506
+ "type": "string",
1507
+ "description": "endDate"
1508
+ },
1509
+ "campaignIds": {
1510
+ "type": "array",
1511
+ "description": "campaignIds"
1512
+ },
1513
+ "accountIds": {
1514
+ "type": "array",
1515
+ "description": "accountIds"
1516
+ }
1517
+ }
1518
+ },
1519
+ execute: async (input) => {
1520
+ const key = await ensureApiKey()
1521
+ const params = parseToolInput(input)
1522
+ return callSuperagnt(key, 'POST', '/stats/GetOverallStatsByCampaign', undefined, params)
1523
+ },
1524
+ })
1525
+
1526
+ api.registerTool({
1527
+ name: 'superagnt_connection_heyreach_network_get_for_sender',
1528
+ description: "Get sender's LinkedIn network",
1529
+ inputSchema: {
1530
+ "type": "object",
1531
+ "properties": {
1532
+ "senderId": {
1533
+ "type": "integer",
1534
+ "description": "ID of the connected LinkedIn sender account whose network should be returned."
1535
+ },
1536
+ "offset": {
1537
+ "type": "integer",
1538
+ "description": "offset"
1539
+ },
1540
+ "limit": {
1541
+ "type": "integer",
1542
+ "description": "limit"
1543
+ },
1544
+ "keyword": {
1545
+ "type": "string",
1546
+ "description": "Optional free-text filter applied to first/last name and headline."
1547
+ }
1548
+ },
1549
+ "required": [
1550
+ "senderId"
1551
+ ]
1552
+ },
1553
+ execute: async (input) => {
1554
+ const key = await ensureApiKey()
1555
+ const params = parseToolInput(input)
1556
+ return callSuperagnt(key, 'POST', '/MyNetwork/GetMyNetworkForSender', undefined, params)
1557
+ },
1558
+ })
1559
+
1560
+ api.registerTool({
1561
+ name: 'superagnt_connection_heyreach_network_is_connection',
1562
+ description: "Check if a lead is a 1st-degree connection",
1563
+ inputSchema: {
1564
+ "type": "object",
1565
+ "properties": {
1566
+ "senderAccountId": {
1567
+ "type": "integer",
1568
+ "description": "ID of the connected LinkedIn sender account."
1569
+ },
1570
+ "leadProfileUrl": {
1571
+ "type": "string",
1572
+ "description": "leadProfileUrl"
1573
+ },
1574
+ "leadLinkedInId": {
1575
+ "type": "string",
1576
+ "description": "leadLinkedInId"
1577
+ }
1578
+ },
1579
+ "required": [
1580
+ "senderAccountId"
1581
+ ]
1582
+ },
1583
+ execute: async (input) => {
1584
+ const key = await ensureApiKey()
1585
+ const params = parseToolInput(input)
1586
+ return callSuperagnt(key, 'POST', '/MyNetwork/IsConnection', undefined, params)
1587
+ },
1588
+ })
1589
+
1590
+ api.registerTool({
1591
+ name: 'superagnt_connection_heyreach_webhook_create',
1592
+ description: "Create webhook subscription",
1593
+ inputSchema: {
1594
+ "type": "object",
1595
+ "properties": {
1596
+ "webhookName": {
1597
+ "type": "string",
1598
+ "description": "webhookName"
1599
+ },
1600
+ "webhookUrl": {
1601
+ "type": "string",
1602
+ "description": "webhookUrl"
1603
+ },
1604
+ "eventType": {
1605
+ "type": "string",
1606
+ "description": "eventType"
1607
+ },
1608
+ "campaignIds": {
1609
+ "type": "array",
1610
+ "description": "Optional — restrict to events originated by these campaigns. Empty/omitted means all campaigns."
1611
+ },
1612
+ "customHeaders": {
1613
+ "type": "object",
1614
+ "description": "Optional custom HTTP headers to include on every webhook delivery (e.g. for authentication)."
1615
+ }
1616
+ },
1617
+ "required": [
1618
+ "webhookName",
1619
+ "webhookUrl",
1620
+ "eventType"
1621
+ ]
1622
+ },
1623
+ execute: async (input) => {
1624
+ const key = await ensureApiKey()
1625
+ const params = parseToolInput(input)
1626
+ return callSuperagnt(key, 'POST', '/webhooks/CreateWebhook', undefined, params)
1627
+ },
1628
+ })
1629
+
1630
+ api.registerTool({
1631
+ name: 'superagnt_connection_heyreach_webhook_get_by_id',
1632
+ description: "Get webhook by ID",
1633
+ inputSchema: {
1634
+ "type": "object",
1635
+ "properties": {
1636
+ "webhookId": {
1637
+ "type": "integer",
1638
+ "description": "webhookId"
1639
+ },
1640
+ "includeCustomHeaders": {
1641
+ "type": "boolean",
1642
+ "description": "Set to `true` to include any configured custom HTTP headers in the response."
1643
+ }
1644
+ },
1645
+ "required": [
1646
+ "webhookId"
1647
+ ]
1648
+ },
1649
+ execute: async (input) => {
1650
+ const key = await ensureApiKey()
1651
+ const params = parseToolInput(input)
1652
+ return callSuperagnt(key, 'GET', '/webhooks/GetWebhookById', params)
1653
+ },
1654
+ })
1655
+
1656
+ api.registerTool({
1657
+ name: 'superagnt_connection_heyreach_webhook_get_all',
1658
+ description: "List webhooks",
1659
+ inputSchema: {
1660
+ "type": "object",
1661
+ "properties": {
1662
+ "offset": {
1663
+ "type": "integer",
1664
+ "description": "offset"
1665
+ },
1666
+ "limit": {
1667
+ "type": "integer",
1668
+ "description": "limit"
1669
+ },
1670
+ "includeCustomHeaders": {
1671
+ "type": "boolean",
1672
+ "description": "includeCustomHeaders"
1673
+ }
1674
+ }
1675
+ },
1676
+ execute: async (input) => {
1677
+ const key = await ensureApiKey()
1678
+ const params = parseToolInput(input)
1679
+ return callSuperagnt(key, 'POST', '/webhooks/GetAllWebhooks', undefined, params)
1680
+ },
1681
+ })
1682
+
1683
+ api.registerTool({
1684
+ name: 'superagnt_connection_heyreach_webhook_update',
1685
+ description: "Update webhook subscription",
1686
+ inputSchema: {
1687
+ "type": "object",
1688
+ "properties": {
1689
+ "webhookId": {
1690
+ "type": "integer",
1691
+ "description": "webhookId"
1692
+ },
1693
+ "webhookName": {
1694
+ "type": "string",
1695
+ "description": "webhookName"
1696
+ },
1697
+ "webhookUrl": {
1698
+ "type": "string",
1699
+ "description": "webhookUrl"
1700
+ },
1701
+ "eventType": {
1702
+ "type": "string",
1703
+ "description": "eventType"
1704
+ },
1705
+ "campaignIds": {
1706
+ "type": "array",
1707
+ "description": "campaignIds"
1708
+ },
1709
+ "isActive": {
1710
+ "type": "boolean",
1711
+ "description": "isActive"
1712
+ },
1713
+ "customHeaders": {
1714
+ "type": "object",
1715
+ "description": "customHeaders"
1716
+ }
1717
+ },
1718
+ "required": [
1719
+ "webhookId"
1720
+ ]
1721
+ },
1722
+ execute: async (input) => {
1723
+ const key = await ensureApiKey()
1724
+ const params = parseToolInput(input)
1725
+ return callSuperagnt(key, 'PATCH', '/webhooks/UpdateWebhook', undefined, params)
1726
+ },
1727
+ })
1728
+
1729
+ api.registerTool({
1730
+ name: 'superagnt_connection_heyreach_webhook_delete',
1731
+ description: "Delete webhook subscription",
1732
+ inputSchema: {
1733
+ "type": "object",
1734
+ "properties": {
1735
+ "webhookId": {
1736
+ "type": "integer",
1737
+ "description": "webhookId"
1738
+ }
1739
+ },
1740
+ "required": [
1741
+ "webhookId"
1742
+ ]
1743
+ },
1744
+ execute: async (input) => {
1745
+ const key = await ensureApiKey()
1746
+ const params = parseToolInput(input)
1747
+ return callSuperagnt(key, 'DELETE', '/webhooks/DeleteWebhook', undefined, params)
1748
+ },
1749
+ })
1750
+
1751
+ api.registerTool({
1752
+ name: 'superagnt_connection_heyreach_org_workspaces_get_all',
1753
+ description: "List workspaces (organization-scoped key)",
1754
+ inputSchema: {
1755
+ "type": "object",
1756
+ "properties": {
1757
+ "Offset": {
1758
+ "type": "integer",
1759
+ "description": "Offset"
1760
+ },
1761
+ "Limit": {
1762
+ "type": "integer",
1763
+ "description": "Limit"
1764
+ }
1765
+ }
1766
+ },
1767
+ execute: async (input) => {
1768
+ const key = await ensureApiKey()
1769
+ const params = parseToolInput(input)
1770
+ return callSuperagnt(key, 'GET', '/management/organizations/workspaces', params)
1771
+ },
1772
+ })
1773
+
1774
+ api.registerTool({
1775
+ name: 'superagnt_connection_heyreach_org_workspaces_create',
1776
+ description: "Create workspace",
1777
+ inputSchema: {
1778
+ "type": "object",
1779
+ "properties": {
1780
+ "workspaceName": {
1781
+ "type": "string",
1782
+ "description": "workspaceName"
1783
+ },
1784
+ "seatsLimit": {
1785
+ "type": "integer",
1786
+ "description": "Optional cap on workspace seats."
1787
+ }
1788
+ },
1789
+ "required": [
1790
+ "workspaceName"
1791
+ ]
1792
+ },
1793
+ execute: async (input) => {
1794
+ const key = await ensureApiKey()
1795
+ const params = parseToolInput(input)
1796
+ return callSuperagnt(key, 'POST', '/management/organizations/workspaces', undefined, params)
1797
+ },
1798
+ })
1799
+
1800
+ api.registerTool({
1801
+ name: 'superagnt_connection_heyreach_org_workspaces_update',
1802
+ description: "Update workspace",
1803
+ inputSchema: {
1804
+ "type": "object",
1805
+ "properties": {
1806
+ "workspaceId": {
1807
+ "type": "integer",
1808
+ "description": "workspaceId"
1809
+ },
1810
+ "workspaceName": {
1811
+ "type": "string",
1812
+ "description": "workspaceName"
1813
+ },
1814
+ "seatsLimit": {
1815
+ "type": "object",
1816
+ "description": "Wrap the new seats cap as `{ \"value\": <integer> }`, or pass `null` to remove the cap."
1817
+ }
1818
+ },
1819
+ "required": [
1820
+ "workspaceId"
1821
+ ]
1822
+ },
1823
+ execute: async (input) => {
1824
+ const key = await ensureApiKey()
1825
+ const params = parseToolInput(input)
1826
+ return callSuperagnt(key, 'PATCH', '/management/organizations/workspaces/{workspaceId}', undefined, params)
1827
+ },
1828
+ })
1829
+
1830
+ api.registerTool({
1831
+ name: 'superagnt_connection_heyreach_org_workspace_api_keys_get',
1832
+ description: "Get workspace API keys",
1833
+ inputSchema: {
1834
+ "type": "object",
1835
+ "properties": {
1836
+ "workspaceId": {
1837
+ "type": "integer",
1838
+ "description": "workspaceId"
1839
+ }
1840
+ },
1841
+ "required": [
1842
+ "workspaceId"
1843
+ ]
1844
+ },
1845
+ execute: async (input) => {
1846
+ const key = await ensureApiKey()
1847
+ const params = parseToolInput(input)
1848
+ return callSuperagnt(key, 'GET', '/management/organizations/api-keys/workspaces/{workspaceId}', params)
1849
+ },
1850
+ })
1851
+
1852
+ api.registerTool({
1853
+ name: 'superagnt_connection_heyreach_org_workspace_api_keys_create',
1854
+ description: "Create workspace API key",
1855
+ inputSchema: {
1856
+ "type": "object",
1857
+ "properties": {
1858
+ "workspaceId": {
1859
+ "type": "integer",
1860
+ "description": "workspaceId"
1861
+ },
1862
+ "apiKeyType": {
1863
+ "type": "string",
1864
+ "description": "apiKeyType"
1865
+ }
1866
+ },
1867
+ "required": [
1868
+ "workspaceId",
1869
+ "apiKeyType"
1870
+ ]
1871
+ },
1872
+ execute: async (input) => {
1873
+ const key = await ensureApiKey()
1874
+ const params = parseToolInput(input)
1875
+ return callSuperagnt(key, 'POST', '/management/organizations/api-keys/workspaces/{workspaceId}', undefined, params)
1876
+ },
1877
+ })
1878
+
1879
+ api.registerTool({
1880
+ name: 'superagnt_connection_heyreach_org_users_get_all',
1881
+ description: "List users in the organization",
1882
+ inputSchema: {
1883
+ "type": "object",
1884
+ "properties": {
1885
+ "offset": {
1886
+ "type": "integer",
1887
+ "description": "offset"
1888
+ },
1889
+ "limit": {
1890
+ "type": "integer",
1891
+ "description": "limit"
1892
+ },
1893
+ "role": {
1894
+ "type": "string",
1895
+ "description": "role"
1896
+ },
1897
+ "invitationStatus": {
1898
+ "type": "array",
1899
+ "description": "invitationStatus"
1900
+ }
1901
+ }
1902
+ },
1903
+ execute: async (input) => {
1904
+ const key = await ensureApiKey()
1905
+ const params = parseToolInput(input)
1906
+ return callSuperagnt(key, 'POST', '/management/organizations/users', undefined, params)
1907
+ },
1908
+ })
1909
+
1910
+ api.registerTool({
1911
+ name: 'superagnt_connection_heyreach_org_user_get_by_id',
1912
+ description: "Get user by ID",
1913
+ inputSchema: {
1914
+ "type": "object",
1915
+ "properties": {
1916
+ "userId": {
1917
+ "type": "integer",
1918
+ "description": "userId"
1919
+ }
1920
+ },
1921
+ "required": [
1922
+ "userId"
1923
+ ]
1924
+ },
1925
+ execute: async (input) => {
1926
+ const key = await ensureApiKey()
1927
+ const params = parseToolInput(input)
1928
+ return callSuperagnt(key, 'GET', '/management/organizations/users/{userId}', params)
1929
+ },
1930
+ })
1931
+
1932
+ api.registerTool({
1933
+ name: 'superagnt_connection_heyreach_org_workspace_users_get_all',
1934
+ description: "List users in workspace",
1935
+ inputSchema: {
1936
+ "type": "object",
1937
+ "properties": {
1938
+ "workspaceId": {
1939
+ "type": "integer",
1940
+ "description": "workspaceId"
1941
+ },
1942
+ "offset": {
1943
+ "type": "integer",
1944
+ "description": "offset"
1945
+ },
1946
+ "limit": {
1947
+ "type": "integer",
1948
+ "description": "limit"
1949
+ },
1950
+ "role": {
1951
+ "type": "string",
1952
+ "description": "role"
1953
+ },
1954
+ "invitationStatus": {
1955
+ "type": "array",
1956
+ "description": "invitationStatus"
1957
+ }
1958
+ },
1959
+ "required": [
1960
+ "workspaceId"
1961
+ ]
1962
+ },
1963
+ execute: async (input) => {
1964
+ const key = await ensureApiKey()
1965
+ const params = parseToolInput(input)
1966
+ return callSuperagnt(key, 'POST', '/management/organizations/users/workspaces/{workspaceId}', undefined, params)
1967
+ },
1968
+ })
1969
+
1970
+ api.registerTool({
1971
+ name: 'superagnt_connection_heyreach_org_invite_admins',
1972
+ description: "Invite admins",
1973
+ inputSchema: {
1974
+ "type": "object",
1975
+ "properties": {
1976
+ "inviterEmail": {
1977
+ "type": "string",
1978
+ "description": "Email of the existing organization user the invitation should appear to come from."
1979
+ },
1980
+ "emails": {
1981
+ "type": "array",
1982
+ "description": "emails"
1983
+ }
1984
+ },
1985
+ "required": [
1986
+ "inviterEmail",
1987
+ "emails"
1988
+ ]
1989
+ },
1990
+ execute: async (input) => {
1991
+ const key = await ensureApiKey()
1992
+ const params = parseToolInput(input)
1993
+ return callSuperagnt(key, 'POST', '/management/organizations/users/invite/admins', undefined, params)
1994
+ },
1995
+ })
1996
+
1997
+ api.registerTool({
1998
+ name: 'superagnt_connection_heyreach_org_invite_managers',
1999
+ description: "Invite managers",
2000
+ inputSchema: {
2001
+ "type": "object",
2002
+ "properties": {
2003
+ "inviterEmail": {
2004
+ "type": "string",
2005
+ "description": "inviterEmail"
2006
+ },
2007
+ "emails": {
2008
+ "type": "array",
2009
+ "description": "emails"
2010
+ },
2011
+ "workspaceIds": {
2012
+ "type": "array",
2013
+ "description": "workspaceIds"
2014
+ }
2015
+ },
2016
+ "required": [
2017
+ "inviterEmail",
2018
+ "emails",
2019
+ "workspaceIds"
2020
+ ]
2021
+ },
2022
+ execute: async (input) => {
2023
+ const key = await ensureApiKey()
2024
+ const params = parseToolInput(input)
2025
+ return callSuperagnt(key, 'POST', '/management/organizations/users/invite/managers', undefined, params)
2026
+ },
2027
+ })
2028
+
2029
+ api.registerTool({
2030
+ name: 'superagnt_connection_heyreach_org_invite_members',
2031
+ description: "Invite members",
2032
+ inputSchema: {
2033
+ "type": "object",
2034
+ "properties": {
2035
+ "inviterEmail": {
2036
+ "type": "string",
2037
+ "description": "inviterEmail"
2038
+ },
2039
+ "emails": {
2040
+ "type": "array",
2041
+ "description": "emails"
2042
+ },
2043
+ "workspaceIds": {
2044
+ "type": "array",
2045
+ "description": "workspaceIds"
2046
+ },
2047
+ "permissions": {
2048
+ "type": "string",
2049
+ "description": "permissions"
2050
+ }
2051
+ },
2052
+ "required": [
2053
+ "inviterEmail",
2054
+ "emails",
2055
+ "workspaceIds",
2056
+ "permissions"
2057
+ ]
2058
+ },
2059
+ execute: async (input) => {
2060
+ const key = await ensureApiKey()
2061
+ const params = parseToolInput(input)
2062
+ return callSuperagnt(key, 'POST', '/management/organizations/users/invite/members', undefined, params)
2063
+ },
2064
+ })
2065
+
2066
+ promptState.toolCount = 59
2067
+ promptState.ready = true
2068
+ }