autotouch-cli 0.2.107__tar.gz → 0.2.108__tar.gz
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.
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/PKG-INFO +1 -1
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_cli/cli.py +30 -0
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_cli/cli_contracts.py +1 -0
- autotouch_cli-0.2.108/autotouch_cli/commands/outreach.py +308 -0
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_cli/data/CLI_REFERENCE.md +330 -1
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_cli/data/cli-manifest.json +1866 -1
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_cli/parser.py +17 -0
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_cli/templates.py +25 -6
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_cli/workflows/registry.py +7 -4
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_cli.egg-info/PKG-INFO +1 -1
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_cli.egg-info/SOURCES.txt +1 -0
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_shared/provider_registry.py +7 -3
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/pyproject.toml +1 -1
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/MANIFEST.in +0 -0
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/README.md +0 -0
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_cli/__init__.py +0 -0
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_cli/commands/__init__.py +0 -0
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_cli/commands/agents.py +0 -0
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_cli/commands/auth.py +0 -0
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_cli/commands/cells.py +0 -0
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_cli/commands/columns.py +0 -0
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_cli/commands/integrations.py +0 -0
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_cli/commands/jobs.py +0 -0
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_cli/commands/leads.py +0 -0
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_cli/commands/linkedin.py +0 -0
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_cli/commands/list_build.py +0 -0
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_cli/commands/prompts.py +0 -0
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_cli/commands/rows.py +0 -0
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_cli/commands/search.py +0 -0
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_cli/commands/sender_accounts.py +0 -0
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_cli/commands/sequences.py +0 -0
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_cli/commands/tables.py +0 -0
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_cli/commands/tasks.py +0 -0
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_cli/commands/webhooks.py +0 -0
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_cli/commands/workspace_secrets.py +0 -0
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_cli/core/__init__.py +0 -0
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_cli/core/auth.py +0 -0
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_cli/core/config.py +0 -0
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_cli/core/csv_import.py +0 -0
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_cli/core/http.py +0 -0
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_cli/core/io.py +0 -0
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_cli/core/output.py +0 -0
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_cli/core/polling.py +0 -0
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_cli/core/run.py +0 -0
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_cli/core/validation.py +0 -0
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_cli/exceptions.py +0 -0
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_cli/mongo_status.py +0 -0
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_cli/parser_groups.py +0 -0
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_cli/sequence_support.py +0 -0
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_cli/workflows/__init__.py +0 -0
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_cli.egg-info/dependency_links.txt +0 -0
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_cli.egg-info/entry_points.txt +0 -0
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_cli.egg-info/requires.txt +0 -0
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_cli.egg-info/top_level.txt +0 -0
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_shared/__init__.py +0 -0
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_shared/linkedin_contract.py +0 -0
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_shared/linkedin_filters.py +0 -0
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_shared/list_build_contract.py +0 -0
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_shared/product_lifecycle.py +0 -0
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/autotouch_shared/search_contract.py +0 -0
- {autotouch_cli-0.2.107 → autotouch_cli-0.2.108}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: autotouch-cli
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.108
|
|
4
4
|
Summary: Autotouch Smart Table CLI
|
|
5
5
|
Project-URL: Homepage, https://app.autotouch.ai
|
|
6
6
|
Project-URL: Documentation, https://github.com/nicolonic/autotouch_main/tree/main/docs/research-table/reference
|
|
@@ -121,6 +121,17 @@ from autotouch_cli.commands.list_build import (
|
|
|
121
121
|
cmd_list_build_status as cmd_list_build_status_impl,
|
|
122
122
|
cmd_list_build_sync_to_table as cmd_list_build_sync_to_table_impl,
|
|
123
123
|
)
|
|
124
|
+
from autotouch_cli.commands.outreach import (
|
|
125
|
+
OutreachCommandRuntime as OutreachCommandHandlerRuntime,
|
|
126
|
+
cmd_outreach_accounts_list as cmd_outreach_accounts_list_impl,
|
|
127
|
+
cmd_outreach_campaigns_activate as cmd_outreach_campaigns_activate_impl,
|
|
128
|
+
cmd_outreach_campaigns_create as cmd_outreach_campaigns_create_impl,
|
|
129
|
+
cmd_outreach_campaigns_get as cmd_outreach_campaigns_get_impl,
|
|
130
|
+
cmd_outreach_campaigns_list as cmd_outreach_campaigns_list_impl,
|
|
131
|
+
cmd_outreach_campaigns_pause as cmd_outreach_campaigns_pause_impl,
|
|
132
|
+
cmd_outreach_campaigns_sync_accounts as cmd_outreach_campaigns_sync_accounts_impl,
|
|
133
|
+
cmd_outreach_campaigns_sync_templates as cmd_outreach_campaigns_sync_templates_impl,
|
|
134
|
+
)
|
|
124
135
|
from autotouch_cli.commands.rows import (
|
|
125
136
|
RowCommandRuntime as RowCommandHandlerRuntime,
|
|
126
137
|
cmd_rows_add as cmd_rows_add_impl,
|
|
@@ -1406,6 +1417,15 @@ def _integration_command_runtime() -> IntegrationCommandHandlerRuntime:
|
|
|
1406
1417
|
)
|
|
1407
1418
|
|
|
1408
1419
|
|
|
1420
|
+
def _outreach_command_runtime() -> OutreachCommandHandlerRuntime:
|
|
1421
|
+
return OutreachCommandHandlerRuntime(
|
|
1422
|
+
resolve_token=_resolve_token,
|
|
1423
|
+
request_api=_request_api,
|
|
1424
|
+
print_json=lambda data, compact=False: _print_json(data, compact=compact),
|
|
1425
|
+
load_json_input=_load_json_input,
|
|
1426
|
+
)
|
|
1427
|
+
|
|
1428
|
+
|
|
1409
1429
|
def _sender_account_command_runtime() -> SenderAccountCommandHandlerRuntime:
|
|
1410
1430
|
return SenderAccountCommandHandlerRuntime(
|
|
1411
1431
|
resolve_token=_resolve_token,
|
|
@@ -1549,6 +1569,16 @@ _register("integrations_recipe", cmd_integrations_recipe_impl, _integration_comm
|
|
|
1549
1569
|
_register("integrations_from_crm_status", cmd_integrations_from_crm_status_impl, _integration_command_runtime)
|
|
1550
1570
|
_register("integrations_to_crm_status", cmd_integrations_to_crm_status_impl, _integration_command_runtime)
|
|
1551
1571
|
|
|
1572
|
+
# -- Outreach commands --
|
|
1573
|
+
_register("outreach_accounts_list", cmd_outreach_accounts_list_impl, _outreach_command_runtime)
|
|
1574
|
+
_register("outreach_campaigns_list", cmd_outreach_campaigns_list_impl, _outreach_command_runtime)
|
|
1575
|
+
_register("outreach_campaigns_get", cmd_outreach_campaigns_get_impl, _outreach_command_runtime)
|
|
1576
|
+
_register("outreach_campaigns_create", cmd_outreach_campaigns_create_impl, _outreach_command_runtime)
|
|
1577
|
+
_register("outreach_campaigns_sync_accounts", cmd_outreach_campaigns_sync_accounts_impl, _outreach_command_runtime)
|
|
1578
|
+
_register("outreach_campaigns_sync_templates", cmd_outreach_campaigns_sync_templates_impl, _outreach_command_runtime)
|
|
1579
|
+
_register("outreach_campaigns_activate", cmd_outreach_campaigns_activate_impl, _outreach_command_runtime)
|
|
1580
|
+
_register("outreach_campaigns_pause", cmd_outreach_campaigns_pause_impl, _outreach_command_runtime)
|
|
1581
|
+
|
|
1552
1582
|
# -- Sender account commands --
|
|
1553
1583
|
_register("sender_accounts_list", cmd_sender_accounts_list_impl, _sender_account_command_runtime)
|
|
1554
1584
|
_register("sender_accounts_get", cmd_sender_accounts_get_impl, _sender_account_command_runtime)
|
|
@@ -54,6 +54,7 @@ _AUTH_MODE_PREFIXES: Tuple[Tuple[str, str], ...] = (
|
|
|
54
54
|
("webhooks.", "developer_key_or_user_session"),
|
|
55
55
|
("search.", "developer_key_or_user_session"),
|
|
56
56
|
("linkedin.", "developer_key_or_user_session"),
|
|
57
|
+
("outreach.", "developer_key_or_user_session"),
|
|
57
58
|
("workflows.", "none"),
|
|
58
59
|
)
|
|
59
60
|
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import argparse
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
from typing import Any, Callable, Dict, Optional, Sequence
|
|
6
|
+
from urllib.parse import urlencode
|
|
7
|
+
|
|
8
|
+
from autotouch_cli.exceptions import AutotouchInputError
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
OUTREACH_PROVIDERS = ("instantly", "smartlead")
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@dataclass(frozen=True)
|
|
15
|
+
class OutreachCommandRuntime:
|
|
16
|
+
resolve_token: Callable[[Optional[str], bool], Optional[str]]
|
|
17
|
+
request_api: Callable[..., Any]
|
|
18
|
+
print_json: Callable[[Any, bool], None]
|
|
19
|
+
load_json_input: Callable[..., Any]
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def _provider(args: argparse.Namespace) -> str:
|
|
23
|
+
provider = str(getattr(args, "provider", "") or "").strip().lower()
|
|
24
|
+
if provider not in OUTREACH_PROVIDERS:
|
|
25
|
+
raise AutotouchInputError("--provider must be instantly or smartlead")
|
|
26
|
+
return provider
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def _base_payload(args: argparse.Namespace, *, runtime: OutreachCommandRuntime) -> Dict[str, Any]:
|
|
30
|
+
explicit = runtime.load_json_input(
|
|
31
|
+
inline_json=getattr(args, "data_json", None),
|
|
32
|
+
file_path=getattr(args, "data_file", None),
|
|
33
|
+
context="data",
|
|
34
|
+
default=None,
|
|
35
|
+
)
|
|
36
|
+
if explicit is not None:
|
|
37
|
+
if not isinstance(explicit, dict):
|
|
38
|
+
raise AutotouchInputError("outreach payload must be a JSON object")
|
|
39
|
+
return explicit
|
|
40
|
+
return {}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def _account_payload(args: argparse.Namespace, *, runtime: OutreachCommandRuntime) -> Dict[str, Any]:
|
|
44
|
+
payload = _base_payload(args, runtime=runtime)
|
|
45
|
+
if "accountSelection" not in payload and getattr(args, "account_selection", None):
|
|
46
|
+
payload["accountSelection"] = args.account_selection
|
|
47
|
+
selected = getattr(args, "selected_account", None) or []
|
|
48
|
+
if selected and "selectedAccounts" not in payload:
|
|
49
|
+
payload["selectedAccounts"] = selected
|
|
50
|
+
if getattr(args, "min_health_score", None) is not None and "minHealthScore" not in payload:
|
|
51
|
+
payload["minHealthScore"] = int(args.min_health_score)
|
|
52
|
+
if getattr(args, "no_refresh", False) and "refresh" not in payload:
|
|
53
|
+
payload["refresh"] = False
|
|
54
|
+
return payload
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def cmd_outreach_campaigns_list(args: argparse.Namespace, *, runtime: OutreachCommandRuntime) -> None:
|
|
58
|
+
token = runtime.resolve_token(args.token, required=True)
|
|
59
|
+
provider = _provider(args)
|
|
60
|
+
data = runtime.request_api(
|
|
61
|
+
"GET",
|
|
62
|
+
f"/api/integrations/{provider}/campaigns",
|
|
63
|
+
base_url=args.base_url,
|
|
64
|
+
token=token,
|
|
65
|
+
use_x_api_key=args.use_x_api_key,
|
|
66
|
+
timeout=args.timeout,
|
|
67
|
+
verbose=args.verbose,
|
|
68
|
+
)
|
|
69
|
+
runtime.print_json(data, args.compact)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def cmd_outreach_campaigns_get(args: argparse.Namespace, *, runtime: OutreachCommandRuntime) -> None:
|
|
73
|
+
token = runtime.resolve_token(args.token, required=True)
|
|
74
|
+
provider = _provider(args)
|
|
75
|
+
data = runtime.request_api(
|
|
76
|
+
"GET",
|
|
77
|
+
f"/api/integrations/{provider}/campaigns/{args.campaign_id}",
|
|
78
|
+
base_url=args.base_url,
|
|
79
|
+
token=token,
|
|
80
|
+
use_x_api_key=args.use_x_api_key,
|
|
81
|
+
timeout=args.timeout,
|
|
82
|
+
verbose=args.verbose,
|
|
83
|
+
)
|
|
84
|
+
runtime.print_json(data, args.compact)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def cmd_outreach_campaigns_create(args: argparse.Namespace, *, runtime: OutreachCommandRuntime) -> None:
|
|
88
|
+
token = runtime.resolve_token(args.token, required=True)
|
|
89
|
+
provider = _provider(args)
|
|
90
|
+
payload = _account_payload(args, runtime=runtime)
|
|
91
|
+
if "name" not in payload:
|
|
92
|
+
name = str(getattr(args, "name", "") or "").strip()
|
|
93
|
+
if not name:
|
|
94
|
+
raise AutotouchInputError("--name is required unless --data-json/--data-file provides name")
|
|
95
|
+
payload["name"] = name
|
|
96
|
+
if getattr(args, "activate", False):
|
|
97
|
+
payload["activate"] = True
|
|
98
|
+
data = runtime.request_api(
|
|
99
|
+
"POST",
|
|
100
|
+
f"/api/integrations/{provider}/campaigns",
|
|
101
|
+
base_url=args.base_url,
|
|
102
|
+
token=token,
|
|
103
|
+
use_x_api_key=args.use_x_api_key,
|
|
104
|
+
payload=payload,
|
|
105
|
+
timeout=args.timeout,
|
|
106
|
+
verbose=args.verbose,
|
|
107
|
+
)
|
|
108
|
+
runtime.print_json(data, args.compact)
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
def cmd_outreach_campaigns_sync_accounts(args: argparse.Namespace, *, runtime: OutreachCommandRuntime) -> None:
|
|
112
|
+
token = runtime.resolve_token(args.token, required=True)
|
|
113
|
+
provider = _provider(args)
|
|
114
|
+
payload = _account_payload(args, runtime=runtime)
|
|
115
|
+
data = runtime.request_api(
|
|
116
|
+
"POST",
|
|
117
|
+
f"/api/integrations/{provider}/campaigns/{args.campaign_id}/sync-account-pool",
|
|
118
|
+
base_url=args.base_url,
|
|
119
|
+
token=token,
|
|
120
|
+
use_x_api_key=args.use_x_api_key,
|
|
121
|
+
payload=payload,
|
|
122
|
+
timeout=args.timeout,
|
|
123
|
+
verbose=args.verbose,
|
|
124
|
+
)
|
|
125
|
+
runtime.print_json(data, args.compact)
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def cmd_outreach_campaigns_sync_templates(args: argparse.Namespace, *, runtime: OutreachCommandRuntime) -> None:
|
|
129
|
+
token = runtime.resolve_token(args.token, required=True)
|
|
130
|
+
provider = _provider(args)
|
|
131
|
+
payload = _base_payload(args, runtime=runtime)
|
|
132
|
+
if "steps" not in payload:
|
|
133
|
+
raise AutotouchInputError("sync-templates requires --data-json/--data-file with steps[]")
|
|
134
|
+
data = runtime.request_api(
|
|
135
|
+
"POST",
|
|
136
|
+
f"/api/integrations/{provider}/campaigns/{args.campaign_id}/sync-templates",
|
|
137
|
+
base_url=args.base_url,
|
|
138
|
+
token=token,
|
|
139
|
+
use_x_api_key=args.use_x_api_key,
|
|
140
|
+
payload=payload,
|
|
141
|
+
timeout=args.timeout,
|
|
142
|
+
verbose=args.verbose,
|
|
143
|
+
)
|
|
144
|
+
runtime.print_json(data, args.compact)
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
def _campaign_state(args: argparse.Namespace, *, runtime: OutreachCommandRuntime, action: str) -> None:
|
|
148
|
+
token = runtime.resolve_token(args.token, required=True)
|
|
149
|
+
provider = _provider(args)
|
|
150
|
+
data = runtime.request_api(
|
|
151
|
+
"POST",
|
|
152
|
+
f"/api/integrations/{provider}/campaigns/{args.campaign_id}/{action}",
|
|
153
|
+
base_url=args.base_url,
|
|
154
|
+
token=token,
|
|
155
|
+
use_x_api_key=args.use_x_api_key,
|
|
156
|
+
payload={},
|
|
157
|
+
timeout=args.timeout,
|
|
158
|
+
verbose=args.verbose,
|
|
159
|
+
)
|
|
160
|
+
runtime.print_json(data, args.compact)
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
def cmd_outreach_campaigns_activate(args: argparse.Namespace, *, runtime: OutreachCommandRuntime) -> None:
|
|
164
|
+
_campaign_state(args, runtime=runtime, action="activate")
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
def cmd_outreach_campaigns_pause(args: argparse.Namespace, *, runtime: OutreachCommandRuntime) -> None:
|
|
168
|
+
_campaign_state(args, runtime=runtime, action="pause")
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
def cmd_outreach_accounts_list(args: argparse.Namespace, *, runtime: OutreachCommandRuntime) -> None:
|
|
172
|
+
token = runtime.resolve_token(args.token, required=True)
|
|
173
|
+
provider = str(getattr(args, "provider", "") or "").strip().lower()
|
|
174
|
+
if provider and provider not in OUTREACH_PROVIDERS:
|
|
175
|
+
raise AutotouchInputError("--provider must be instantly or smartlead")
|
|
176
|
+
query = f"?{urlencode({'provider': provider})}" if provider else ""
|
|
177
|
+
data = runtime.request_api(
|
|
178
|
+
"GET",
|
|
179
|
+
f"/api/email-accounts/external-accounts{query}",
|
|
180
|
+
base_url=args.base_url,
|
|
181
|
+
token=token,
|
|
182
|
+
use_x_api_key=args.use_x_api_key,
|
|
183
|
+
timeout=args.timeout,
|
|
184
|
+
verbose=args.verbose,
|
|
185
|
+
)
|
|
186
|
+
runtime.print_json(data, args.compact)
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
def _add_provider_argument(parser: argparse.ArgumentParser) -> None:
|
|
190
|
+
parser.add_argument("--provider", required=True, choices=list(OUTREACH_PROVIDERS))
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
def _add_account_policy_arguments(parser: argparse.ArgumentParser) -> None:
|
|
194
|
+
parser.add_argument(
|
|
195
|
+
"--account-selection",
|
|
196
|
+
choices=["all_eligible", "selected"],
|
|
197
|
+
default="all_eligible",
|
|
198
|
+
help="Sending account pool selection (default: all_eligible)",
|
|
199
|
+
)
|
|
200
|
+
parser.add_argument(
|
|
201
|
+
"--selected-account",
|
|
202
|
+
action="append",
|
|
203
|
+
default=None,
|
|
204
|
+
help="Sending account email when --account-selection selected; repeatable",
|
|
205
|
+
)
|
|
206
|
+
parser.add_argument(
|
|
207
|
+
"--min-health-score",
|
|
208
|
+
type=int,
|
|
209
|
+
help="One-off mailbox health threshold 0-100; does not update org settings",
|
|
210
|
+
)
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
def _add_json_payload_arguments(parser: argparse.ArgumentParser) -> None:
|
|
214
|
+
parser.add_argument("--data-json", help="Explicit JSON payload")
|
|
215
|
+
parser.add_argument("--data-file", help="Path to JSON payload file")
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
def register_outreach_subcommands(
|
|
219
|
+
subparsers: argparse._SubParsersAction[argparse.ArgumentParser],
|
|
220
|
+
*,
|
|
221
|
+
add_api_common_arguments: Callable[[argparse.ArgumentParser], None],
|
|
222
|
+
handlers: Dict[str, Callable[[argparse.Namespace], None]],
|
|
223
|
+
) -> None:
|
|
224
|
+
parser = subparsers.add_parser(
|
|
225
|
+
"outreach",
|
|
226
|
+
help="Manage Instantly/Smartlead campaign handoff from Autotouch",
|
|
227
|
+
description=(
|
|
228
|
+
"Manage external outreach-provider campaigns used by research-table to_outreach. "
|
|
229
|
+
"Autotouch can create/configure campaigns, map healthy sender accounts, upload rows, "
|
|
230
|
+
"and explicitly activate/pause campaigns; the provider runs the campaign after activation."
|
|
231
|
+
),
|
|
232
|
+
)
|
|
233
|
+
parser._codex_examples = [
|
|
234
|
+
"autotouch outreach accounts list --provider instantly",
|
|
235
|
+
"autotouch outreach campaigns list --provider instantly",
|
|
236
|
+
"autotouch outreach campaigns create --provider instantly --name 'June Buyers' --min-health-score 100",
|
|
237
|
+
"autotouch columns recipe --type to_outreach --out-file push-to-outreach.json",
|
|
238
|
+
]
|
|
239
|
+
outreach_sub = parser.add_subparsers(dest="outreach_cmd", required=True)
|
|
240
|
+
|
|
241
|
+
accounts = outreach_sub.add_parser("accounts", help="Inspect eligible provider sending accounts")
|
|
242
|
+
accounts_sub = accounts.add_subparsers(dest="outreach_accounts_cmd", required=True)
|
|
243
|
+
accounts_list = accounts_sub.add_parser(
|
|
244
|
+
"list",
|
|
245
|
+
help="List Instantly/Smartlead sending accounts with Autotouch eligibility applied",
|
|
246
|
+
)
|
|
247
|
+
accounts_list.add_argument("--provider", choices=list(OUTREACH_PROVIDERS), help="Filter provider")
|
|
248
|
+
add_api_common_arguments(accounts_list)
|
|
249
|
+
accounts_list.set_defaults(func=handlers["accounts_list"])
|
|
250
|
+
|
|
251
|
+
campaigns = outreach_sub.add_parser("campaigns", help="List, create, and manage provider campaigns")
|
|
252
|
+
campaigns_sub = campaigns.add_subparsers(dest="outreach_campaigns_cmd", required=True)
|
|
253
|
+
|
|
254
|
+
plist = campaigns_sub.add_parser("list", help="List provider campaigns")
|
|
255
|
+
_add_provider_argument(plist)
|
|
256
|
+
add_api_common_arguments(plist)
|
|
257
|
+
plist.set_defaults(func=handlers["campaigns_list"])
|
|
258
|
+
|
|
259
|
+
pget = campaigns_sub.add_parser("get", help="Get one provider campaign")
|
|
260
|
+
_add_provider_argument(pget)
|
|
261
|
+
pget.add_argument("--campaign-id", required=True)
|
|
262
|
+
add_api_common_arguments(pget)
|
|
263
|
+
pget.set_defaults(func=handlers["campaigns_get"])
|
|
264
|
+
|
|
265
|
+
pcreate = campaigns_sub.add_parser(
|
|
266
|
+
"create",
|
|
267
|
+
help="Create a draft provider campaign",
|
|
268
|
+
description=(
|
|
269
|
+
"Create an Instantly/Smartlead campaign and attach eligible sending accounts. "
|
|
270
|
+
"The campaign is draft/inactive by default; use activate explicitly when ready. "
|
|
271
|
+
"Use --data-file for optional schedule or deterministic template steps."
|
|
272
|
+
),
|
|
273
|
+
)
|
|
274
|
+
_add_provider_argument(pcreate)
|
|
275
|
+
pcreate.add_argument("--name", help="Campaign name; required unless provided in --data-json/--data-file")
|
|
276
|
+
_add_account_policy_arguments(pcreate)
|
|
277
|
+
pcreate.add_argument("--activate", action="store_true", help="Activate immediately after create")
|
|
278
|
+
_add_json_payload_arguments(pcreate)
|
|
279
|
+
add_api_common_arguments(pcreate)
|
|
280
|
+
pcreate.set_defaults(func=handlers["campaigns_create"])
|
|
281
|
+
|
|
282
|
+
psync_accounts = campaigns_sub.add_parser("sync-accounts", help="Sync campaign sender account pool")
|
|
283
|
+
_add_provider_argument(psync_accounts)
|
|
284
|
+
psync_accounts.add_argument("--campaign-id", required=True)
|
|
285
|
+
_add_account_policy_arguments(psync_accounts)
|
|
286
|
+
psync_accounts.add_argument("--no-refresh", action="store_true", help="Use cached provider account snapshot")
|
|
287
|
+
_add_json_payload_arguments(psync_accounts)
|
|
288
|
+
add_api_common_arguments(psync_accounts)
|
|
289
|
+
psync_accounts.set_defaults(func=handlers["campaigns_sync_accounts"])
|
|
290
|
+
|
|
291
|
+
psync_templates = campaigns_sub.add_parser("sync-templates", help="Sync deterministic provider template steps")
|
|
292
|
+
_add_provider_argument(psync_templates)
|
|
293
|
+
psync_templates.add_argument("--campaign-id", required=True)
|
|
294
|
+
_add_json_payload_arguments(psync_templates)
|
|
295
|
+
add_api_common_arguments(psync_templates)
|
|
296
|
+
psync_templates.set_defaults(func=handlers["campaigns_sync_templates"])
|
|
297
|
+
|
|
298
|
+
pactivate = campaigns_sub.add_parser("activate", help="Activate a provider campaign")
|
|
299
|
+
_add_provider_argument(pactivate)
|
|
300
|
+
pactivate.add_argument("--campaign-id", required=True)
|
|
301
|
+
add_api_common_arguments(pactivate)
|
|
302
|
+
pactivate.set_defaults(func=handlers["campaigns_activate"])
|
|
303
|
+
|
|
304
|
+
ppause = campaigns_sub.add_parser("pause", help="Pause a provider campaign")
|
|
305
|
+
_add_provider_argument(ppause)
|
|
306
|
+
ppause.add_argument("--campaign-id", required=True)
|
|
307
|
+
add_api_common_arguments(ppause)
|
|
308
|
+
ppause.set_defaults(func=handlers["campaigns_pause"])
|