airbyte-agent-slack 0.1.38__tar.gz → 0.1.39__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.
Files changed (62) hide show
  1. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/CHANGELOG.md +5 -0
  2. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/PKG-INFO +3 -3
  3. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/README.md +2 -2
  4. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/__init__.py +4 -2
  5. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/_vendored/connector_sdk/cloud_utils/client.py +62 -0
  6. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/_vendored/connector_sdk/executor/hosted_executor.py +54 -25
  7. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/connector.py +122 -9
  8. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/models.py +22 -8
  9. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/pyproject.toml +1 -1
  10. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/.gitignore +0 -0
  11. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/AUTH.md +0 -0
  12. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/REFERENCE.md +0 -0
  13. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/_vendored/__init__.py +0 -0
  14. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/_vendored/connector_sdk/__init__.py +0 -0
  15. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/_vendored/connector_sdk/auth_strategies.py +0 -0
  16. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/_vendored/connector_sdk/auth_template.py +0 -0
  17. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/_vendored/connector_sdk/cloud_utils/__init__.py +0 -0
  18. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/_vendored/connector_sdk/connector_model_loader.py +0 -0
  19. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/_vendored/connector_sdk/constants.py +0 -0
  20. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/_vendored/connector_sdk/exceptions.py +0 -0
  21. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/_vendored/connector_sdk/executor/__init__.py +0 -0
  22. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/_vendored/connector_sdk/executor/local_executor.py +0 -0
  23. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/_vendored/connector_sdk/executor/models.py +0 -0
  24. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/_vendored/connector_sdk/extensions.py +0 -0
  25. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/_vendored/connector_sdk/http/__init__.py +0 -0
  26. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/_vendored/connector_sdk/http/adapters/__init__.py +0 -0
  27. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/_vendored/connector_sdk/http/adapters/httpx_adapter.py +0 -0
  28. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/_vendored/connector_sdk/http/config.py +0 -0
  29. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/_vendored/connector_sdk/http/exceptions.py +0 -0
  30. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/_vendored/connector_sdk/http/protocols.py +0 -0
  31. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/_vendored/connector_sdk/http/response.py +0 -0
  32. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/_vendored/connector_sdk/http_client.py +0 -0
  33. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/_vendored/connector_sdk/introspection.py +0 -0
  34. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/_vendored/connector_sdk/logging/__init__.py +0 -0
  35. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/_vendored/connector_sdk/logging/logger.py +0 -0
  36. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/_vendored/connector_sdk/logging/types.py +0 -0
  37. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/_vendored/connector_sdk/observability/__init__.py +0 -0
  38. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/_vendored/connector_sdk/observability/config.py +0 -0
  39. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/_vendored/connector_sdk/observability/models.py +0 -0
  40. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/_vendored/connector_sdk/observability/redactor.py +0 -0
  41. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/_vendored/connector_sdk/observability/session.py +0 -0
  42. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/_vendored/connector_sdk/performance/__init__.py +0 -0
  43. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/_vendored/connector_sdk/performance/instrumentation.py +0 -0
  44. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/_vendored/connector_sdk/performance/metrics.py +0 -0
  45. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/_vendored/connector_sdk/schema/__init__.py +0 -0
  46. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/_vendored/connector_sdk/schema/base.py +0 -0
  47. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/_vendored/connector_sdk/schema/components.py +0 -0
  48. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/_vendored/connector_sdk/schema/connector.py +0 -0
  49. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/_vendored/connector_sdk/schema/extensions.py +0 -0
  50. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/_vendored/connector_sdk/schema/operations.py +0 -0
  51. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/_vendored/connector_sdk/schema/security.py +0 -0
  52. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/_vendored/connector_sdk/secrets.py +0 -0
  53. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/_vendored/connector_sdk/telemetry/__init__.py +0 -0
  54. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/_vendored/connector_sdk/telemetry/config.py +0 -0
  55. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/_vendored/connector_sdk/telemetry/events.py +0 -0
  56. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/_vendored/connector_sdk/telemetry/tracker.py +0 -0
  57. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/_vendored/connector_sdk/types.py +0 -0
  58. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/_vendored/connector_sdk/utils.py +0 -0
  59. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/_vendored/connector_sdk/validation.py +0 -0
  60. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/_vendored/connector_sdk/validation_replication.py +0 -0
  61. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/connector_model.py +0 -0
  62. {airbyte_agent_slack-0.1.38 → airbyte_agent_slack-0.1.39}/airbyte_agent_slack/types.py +0 -0
@@ -1,5 +1,10 @@
1
1
  # Slack changelog
2
2
 
3
+ ## [0.1.39] - 2026-01-30
4
+ - Updated connector definition (YAML version 0.1.12)
5
+ - Source commit: b184da3e
6
+ - SDK version: 0.1.0
7
+
3
8
  ## [0.1.38] - 2026-01-30
4
9
  - Updated connector definition (YAML version 0.1.12)
5
10
  - Source commit: 40765c71
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: airbyte-agent-slack
3
- Version: 0.1.38
3
+ Version: 0.1.39
4
4
  Summary: Airbyte Slack Connector for AI platforms
5
5
  Project-URL: Homepage, https://github.com/airbytehq/airbyte-agent-connectors
6
6
  Project-URL: Documentation, https://docs.airbyte.com/ai-agents/
@@ -158,7 +158,7 @@ See the official [Slack API reference](https://api.slack.com/methods).
158
158
 
159
159
  ## Version information
160
160
 
161
- - **Package version:** 0.1.38
161
+ - **Package version:** 0.1.39
162
162
  - **Connector version:** 0.1.12
163
- - **Generated with Connector SDK commit SHA:** 40765c717093dffed8c5e9ed8d5b3a6fbbe9b181
163
+ - **Generated with Connector SDK commit SHA:** b184da3e22ef8521d2eeebf3c96a0fe8da2424f5
164
164
  - **Changelog:** [View changelog](https://github.com/airbytehq/airbyte-agent-connectors/blob/main/connectors/slack/CHANGELOG.md)
@@ -125,7 +125,7 @@ See the official [Slack API reference](https://api.slack.com/methods).
125
125
 
126
126
  ## Version information
127
127
 
128
- - **Package version:** 0.1.38
128
+ - **Package version:** 0.1.39
129
129
  - **Connector version:** 0.1.12
130
- - **Generated with Connector SDK commit SHA:** 40765c717093dffed8c5e9ed8d5b3a6fbbe9b181
130
+ - **Generated with Connector SDK commit SHA:** b184da3e22ef8521d2eeebf3c96a0fe8da2424f5
131
131
  - **Changelog:** [View changelog](https://github.com/airbytehq/airbyte-agent-connectors/blob/main/connectors/slack/CHANGELOG.md)
@@ -7,6 +7,7 @@ Auto-generated from OpenAPI specification.
7
7
  from .connector import SlackConnector
8
8
  from .models import (
9
9
  SlackAuthConfig,
10
+ SlackReplicationConfig,
10
11
  User,
11
12
  UserProfile,
12
13
  ResponseMetadata,
@@ -17,9 +18,9 @@ from .models import (
17
18
  ChannelPurpose,
18
19
  ChannelsListResponse,
19
20
  ChannelResponse,
20
- Reaction,
21
21
  Attachment,
22
22
  File,
23
+ Reaction,
23
24
  Message,
24
25
  Thread,
25
26
  EditedInfo,
@@ -86,6 +87,7 @@ from .types import (
86
87
  __all__ = [
87
88
  "SlackConnector",
88
89
  "SlackAuthConfig",
90
+ "SlackReplicationConfig",
89
91
  "User",
90
92
  "UserProfile",
91
93
  "ResponseMetadata",
@@ -96,9 +98,9 @@ __all__ = [
96
98
  "ChannelPurpose",
97
99
  "ChannelsListResponse",
98
100
  "ChannelResponse",
99
- "Reaction",
100
101
  "Attachment",
101
102
  "File",
103
+ "Reaction",
102
104
  "Message",
103
105
  "Thread",
104
106
  "EditedInfo",
@@ -161,6 +161,68 @@ class AirbyteCloudClient:
161
161
  connector_id = connectors[0]["id"]
162
162
  return connector_id
163
163
 
164
+ async def create_source(
165
+ self,
166
+ name: str,
167
+ connector_definition_id: str,
168
+ external_user_id: str,
169
+ credentials: dict[str, Any],
170
+ replication_config: dict[str, Any] | None = None,
171
+ ) -> str:
172
+ """Create a new source on Airbyte Agent Platform.
173
+
174
+ Args:
175
+ name: Source name
176
+ connector_definition_id: UUID of the connector definition
177
+ external_user_id: User identifier
178
+ credentials: Connector auth config dict
179
+ replication_config: Optional replication settings (e.g., start_date for
180
+ connectors with x-airbyte-replication-config). Required for REPLICATION
181
+ mode sources like Intercom.
182
+
183
+ Returns:
184
+ The created source ID (UUID string)
185
+
186
+ Raises:
187
+ httpx.HTTPStatusError: If creation fails
188
+
189
+ Example:
190
+ source_id = await client.create_source(
191
+ name="My Gong Source",
192
+ connector_definition_id="32382e40-3b49-4b99-9c5c-4076501914e7",
193
+ external_user_id="my-workspace",
194
+ credentials={"access_key": "...", "access_key_secret": "..."}
195
+ )
196
+
197
+ # For REPLICATION mode sources (e.g., Intercom):
198
+ source_id = await client.create_source(
199
+ name="My Intercom Source",
200
+ connector_definition_id="d8313939-3782-41b0-be29-b3ca20d8dd3a",
201
+ external_user_id="my-workspace",
202
+ credentials={"access_token": "..."},
203
+ replication_config={"start_date": "2024-01-01T00:00:00Z"}
204
+ )
205
+ """
206
+ token = await self.get_bearer_token()
207
+ url = f"{self.API_BASE_URL}/v1/integrations/connectors"
208
+ headers = {"Authorization": f"Bearer {token}"}
209
+
210
+ request_body: dict[str, Any] = {
211
+ "name": name,
212
+ "definition_id": connector_definition_id,
213
+ "external_user_id": external_user_id,
214
+ "credentials": credentials,
215
+ }
216
+
217
+ if replication_config is not None:
218
+ request_body["replication_config"] = replication_config
219
+
220
+ response = await self._http_client.post(url, json=request_body, headers=headers)
221
+ response.raise_for_status()
222
+
223
+ data = response.json()
224
+ return data["id"]
225
+
164
226
  async def execute_connector(
165
227
  self,
166
228
  connector_id: str,
@@ -19,19 +19,26 @@ class HostedExecutor:
19
19
  instead of directly calling external services. The cloud API handles all
20
20
  connector logic, secrets management, and execution.
21
21
 
22
- The executor takes an external_user_id and uses the AirbyteCloudClient to:
22
+ The executor uses the AirbyteCloudClient to:
23
23
  1. Authenticate with the Airbyte Platform (bearer token with caching)
24
- 2. Look up the user's connector
24
+ 2. Look up the user's connector (if connector_id not provided)
25
25
  3. Execute the connector operation via the cloud API
26
26
 
27
27
  Implements ExecutorProtocol.
28
28
 
29
29
  Example:
30
- # Create executor with user ID, credentials, and connector definition ID
30
+ # Create executor with explicit connector_id (no lookup needed)
31
+ executor = HostedExecutor(
32
+ airbyte_client_id="client_abc123",
33
+ airbyte_client_secret="secret_xyz789",
34
+ connector_id="existing-source-uuid",
35
+ )
36
+
37
+ # Or create executor with user ID for lookup
31
38
  executor = HostedExecutor(
32
- external_user_id="user-123",
33
39
  airbyte_client_id="client_abc123",
34
40
  airbyte_client_secret="secret_xyz789",
41
+ external_user_id="user-123",
35
42
  connector_definition_id="abc123-def456-ghi789",
36
43
  )
37
44
 
@@ -51,28 +58,48 @@ class HostedExecutor:
51
58
 
52
59
  def __init__(
53
60
  self,
54
- external_user_id: str,
55
61
  airbyte_client_id: str,
56
62
  airbyte_client_secret: str,
57
- connector_definition_id: str,
63
+ connector_id: str | None = None,
64
+ external_user_id: str | None = None,
65
+ connector_definition_id: str | None = None,
58
66
  ):
59
67
  """Initialize hosted executor.
60
68
 
69
+ Either provide connector_id directly OR (external_user_id + connector_definition_id)
70
+ for lookup.
71
+
61
72
  Args:
62
- external_user_id: User identifier in the Airbyte system
63
73
  airbyte_client_id: Airbyte client ID for authentication
64
74
  airbyte_client_secret: Airbyte client secret for authentication
65
- connector_definition_id: Connector definition ID used to look up
66
- the user's connector.
75
+ connector_id: Direct connector/source ID (skips lookup if provided)
76
+ external_user_id: User identifier in the Airbyte system (for lookup)
77
+ connector_definition_id: Connector definition ID (for lookup)
78
+
79
+ Raises:
80
+ ValueError: If neither connector_id nor (external_user_id + connector_definition_id) provided
67
81
 
68
82
  Example:
83
+ # With explicit connector_id (no lookup)
84
+ executor = HostedExecutor(
85
+ airbyte_client_id="client_abc123",
86
+ airbyte_client_secret="secret_xyz789",
87
+ connector_id="existing-source-uuid",
88
+ )
89
+
90
+ # With lookup by user + definition
69
91
  executor = HostedExecutor(
70
- external_user_id="user-123",
71
92
  airbyte_client_id="client_abc123",
72
93
  airbyte_client_secret="secret_xyz789",
94
+ external_user_id="user-123",
73
95
  connector_definition_id="abc123-def456-ghi789",
74
96
  )
75
97
  """
98
+ # Validate: either connector_id OR (external_user_id + connector_definition_id) required
99
+ if not connector_id and not (external_user_id and connector_definition_id):
100
+ raise ValueError("Either connector_id OR (external_user_id + connector_definition_id) must be provided")
101
+
102
+ self._connector_id = connector_id
76
103
  self._external_user_id = external_user_id
77
104
  self._connector_definition_id = connector_definition_id
78
105
 
@@ -86,10 +113,9 @@ class HostedExecutor:
86
113
  """Execute connector via cloud API (ExecutorProtocol implementation).
87
114
 
88
115
  Flow:
89
- 1. Get connector definition id from executor config
90
- 2. Look up the user's connector ID
91
- 3. Execute the connector operation via the cloud API
92
- 4. Parse the response into ExecutionResult
116
+ 1. Use provided connector_id or look up from external_user_id + definition_id
117
+ 2. Execute the connector operation via the cloud API
118
+ 3. Parse the response into ExecutionResult
93
119
 
94
120
  Args:
95
121
  config: Execution configuration (entity, action, params)
@@ -98,7 +124,7 @@ class HostedExecutor:
98
124
  ExecutionResult with success/failure status
99
125
 
100
126
  Raises:
101
- ValueError: If no connector or multiple connectors found for user
127
+ ValueError: If no connector or multiple connectors found for user (when doing lookup)
102
128
  httpx.HTTPStatusError: If API returns 4xx/5xx status code
103
129
  httpx.RequestError: If network request fails
104
130
 
@@ -114,23 +140,26 @@ class HostedExecutor:
114
140
 
115
141
  with tracer.start_as_current_span("airbyte.hosted_executor.execute") as span:
116
142
  # Add span attributes for observability
117
- span.set_attribute("connector.definition_id", self._connector_definition_id)
143
+ if self._connector_definition_id:
144
+ span.set_attribute("connector.definition_id", self._connector_definition_id)
118
145
  span.set_attribute("connector.entity", config.entity)
119
146
  span.set_attribute("connector.action", config.action)
120
- span.set_attribute("user.external_id", self._external_user_id)
147
+ if self._external_user_id:
148
+ span.set_attribute("user.external_id", self._external_user_id)
121
149
  if config.params:
122
150
  # Only add non-sensitive param keys
123
151
  span.set_attribute("connector.param_keys", list(config.params.keys()))
124
152
 
125
153
  try:
126
- # Step 1: Get connector definition id
127
- connector_definition_id = self._connector_definition_id
128
-
129
- # Step 2: Get the connector ID for this user
130
- connector_id = await self._cloud_client.get_connector_id(
131
- external_user_id=self._external_user_id,
132
- connector_definition_id=connector_definition_id,
133
- )
154
+ # Use provided connector_id or look it up
155
+ if self._connector_id:
156
+ connector_id = self._connector_id
157
+ else:
158
+ # Look up connector by external_user_id + definition_id
159
+ connector_id = await self._cloud_client.get_connector_id(
160
+ external_user_id=self._external_user_id, # type: ignore[arg-type]
161
+ connector_definition_id=self._connector_definition_id, # type: ignore[arg-type]
162
+ )
134
163
 
135
164
  span.set_attribute("connector.connector_id", connector_id)
136
165
 
@@ -38,6 +38,8 @@ from .types import (
38
38
  )
39
39
  if TYPE_CHECKING:
40
40
  from .models import SlackAuthConfig
41
+ from .models import SlackReplicationConfig
42
+
41
43
  # Import specific auth config classes for multi-auth isinstance checks
42
44
  from .models import SlackTokenAuthenticationAuthConfig, SlackOauth20AuthenticationAuthConfig
43
45
  # Import response models and envelope models at runtime
@@ -152,26 +154,35 @@ class SlackConnector:
152
154
  external_user_id: str | None = None,
153
155
  airbyte_client_id: str | None = None,
154
156
  airbyte_client_secret: str | None = None,
157
+ connector_id: str | None = None,
155
158
  on_token_refresh: Any | None = None ):
156
159
  """
157
160
  Initialize a new slack connector instance.
158
161
 
159
162
  Supports both local and hosted execution modes:
160
163
  - Local mode: Provide `auth_config` for direct API calls
161
- - Hosted mode: Provide `external_user_id`, `airbyte_client_id`, and `airbyte_client_secret` for hosted execution
164
+ - Hosted mode: Provide Airbyte credentials with either `connector_id` or `external_user_id`
162
165
 
163
166
  Args:
164
167
  auth_config: Typed authentication configuration (required for local mode)
165
- external_user_id: External user ID (required for hosted mode)
168
+ external_user_id: External user ID (for hosted mode lookup)
166
169
  airbyte_client_id: Airbyte OAuth client ID (required for hosted mode)
167
170
  airbyte_client_secret: Airbyte OAuth client secret (required for hosted mode)
171
+ connector_id: Specific connector/source ID (for hosted mode, skips lookup)
168
172
  on_token_refresh: Optional callback for OAuth2 token refresh persistence.
169
173
  Called with new_tokens dict when tokens are refreshed. Can be sync or async.
170
174
  Example: lambda tokens: save_to_database(tokens)
171
175
  Examples:
172
176
  # Local mode (direct API calls)
173
177
  connector = SlackConnector(auth_config=SlackAuthConfig(api_token="..."))
174
- # Hosted mode (executed on Airbyte cloud)
178
+ # Hosted mode with explicit connector_id (no lookup needed)
179
+ connector = SlackConnector(
180
+ airbyte_client_id="client_abc123",
181
+ airbyte_client_secret="secret_xyz789",
182
+ connector_id="existing-source-uuid"
183
+ )
184
+
185
+ # Hosted mode with lookup by external_user_id
175
186
  connector = SlackConnector(
176
187
  external_user_id="user-123",
177
188
  airbyte_client_id="client_abc123",
@@ -189,21 +200,24 @@ class SlackConnector:
189
200
  on_token_refresh=save_tokens
190
201
  )
191
202
  """
192
- # Hosted mode: external_user_id, airbyte_client_id, and airbyte_client_secret provided
193
- if external_user_id and airbyte_client_id and airbyte_client_secret:
203
+ # Hosted mode: Airbyte credentials + either connector_id OR external_user_id
204
+ is_hosted = airbyte_client_id and airbyte_client_secret and (connector_id or external_user_id)
205
+
206
+ if is_hosted:
194
207
  from ._vendored.connector_sdk.executor import HostedExecutor
195
208
  self._executor = HostedExecutor(
196
- external_user_id=external_user_id,
197
209
  airbyte_client_id=airbyte_client_id,
198
210
  airbyte_client_secret=airbyte_client_secret,
199
- connector_definition_id=str(SlackConnectorModel.id),
211
+ connector_id=connector_id,
212
+ external_user_id=external_user_id,
213
+ connector_definition_id=str(SlackConnectorModel.id) if not connector_id else None,
200
214
  )
201
215
  else:
202
216
  # Local mode: auth_config required
203
217
  if not auth_config:
204
218
  raise ValueError(
205
- "Either provide (external_user_id, airbyte_client_id, airbyte_client_secret) for hosted mode "
206
- "or auth_config for local mode"
219
+ "Either provide Airbyte credentials (airbyte_client_id, airbyte_client_secret) with "
220
+ "connector_id or external_user_id for hosted mode, or auth_config for local mode"
207
221
  )
208
222
 
209
223
  from ._vendored.connector_sdk.executor import LocalExecutor
@@ -567,6 +581,105 @@ class SlackConnector:
567
581
  )
568
582
  return entity_def.entity_schema if entity_def else None
569
583
 
584
+ @property
585
+ def connector_id(self) -> str | None:
586
+ """Get the connector/source ID (only available in hosted mode).
587
+
588
+ Returns:
589
+ The connector ID if in hosted mode, None if in local mode.
590
+
591
+ Example:
592
+ connector = await SlackConnector.create_hosted(...)
593
+ print(f"Created connector: {connector.connector_id}")
594
+ """
595
+ if hasattr(self, '_executor') and hasattr(self._executor, '_connector_id'):
596
+ return self._executor._connector_id
597
+ return None
598
+
599
+ # ===== HOSTED MODE FACTORY =====
600
+
601
+ @classmethod
602
+ async def create_hosted(
603
+ cls,
604
+ *,
605
+ external_user_id: str,
606
+ airbyte_client_id: str,
607
+ airbyte_client_secret: str,
608
+ auth_config: "SlackAuthConfig",
609
+ name: str | None = None,
610
+ replication_config: "SlackReplicationConfig" | None = None,
611
+ ) -> "SlackConnector":
612
+ """
613
+ Create a new hosted connector on Airbyte Cloud.
614
+
615
+ This factory method:
616
+ 1. Creates a source on Airbyte Cloud with the provided credentials
617
+ 2. Returns a connector configured with the new connector_id
618
+
619
+ Args:
620
+ external_user_id: Workspace identifier in Airbyte Cloud
621
+ airbyte_client_id: Airbyte OAuth client ID
622
+ airbyte_client_secret: Airbyte OAuth client secret
623
+ auth_config: Typed auth config (same as local mode)
624
+ name: Optional source name (defaults to connector name + external_user_id)
625
+ replication_config: Typed replication settings.
626
+ Required for connectors with x-airbyte-replication-config (REPLICATION mode sources).
627
+
628
+ Returns:
629
+ A SlackConnector instance configured in hosted mode
630
+
631
+ Example:
632
+ # Create a new hosted connector with API key auth
633
+ connector = await SlackConnector.create_hosted(
634
+ external_user_id="my-workspace",
635
+ airbyte_client_id="client_abc",
636
+ airbyte_client_secret="secret_xyz",
637
+ auth_config=SlackAuthConfig(api_token="..."),
638
+ )
639
+
640
+ # With replication config (required for this connector):
641
+ connector = await SlackConnector.create_hosted(
642
+ external_user_id="my-workspace",
643
+ airbyte_client_id="client_abc",
644
+ airbyte_client_secret="secret_xyz",
645
+ auth_config=SlackAuthConfig(api_token="..."),
646
+ replication_config=SlackReplicationConfig(start_date="...", lookback_window="...", join_channels="..."),
647
+ )
648
+
649
+ # Use the connector
650
+ result = await connector.execute("entity", "list", {})
651
+ """
652
+ from ._vendored.connector_sdk.cloud_utils import AirbyteCloudClient
653
+
654
+ client = AirbyteCloudClient(
655
+ client_id=airbyte_client_id,
656
+ client_secret=airbyte_client_secret,
657
+ )
658
+
659
+ try:
660
+ # Build credentials from auth_config
661
+ credentials = auth_config.model_dump(exclude_none=True)
662
+ replication_config_dict = replication_config.model_dump(exclude_none=True) if replication_config else None
663
+
664
+ # Create source on Airbyte Cloud
665
+ source_name = name or f"{cls.connector_name} - {external_user_id}"
666
+ source_id = await client.create_source(
667
+ name=source_name,
668
+ connector_definition_id=str(SlackConnectorModel.id),
669
+ external_user_id=external_user_id,
670
+ credentials=credentials,
671
+ replication_config=replication_config_dict,
672
+ )
673
+ finally:
674
+ await client.close()
675
+
676
+ # Return connector configured with the new connector_id
677
+ return cls(
678
+ airbyte_client_id=airbyte_client_id,
679
+ airbyte_client_secret=airbyte_client_secret,
680
+ connector_id=source_id,
681
+ )
682
+
570
683
 
571
684
 
572
685
  class UsersQuery:
@@ -34,6 +34,20 @@ class SlackOauth20AuthenticationAuthConfig(BaseModel):
34
34
 
35
35
  SlackAuthConfig = SlackTokenAuthenticationAuthConfig | SlackOauth20AuthenticationAuthConfig
36
36
 
37
+ # Replication configuration
38
+
39
+ class SlackReplicationConfig(BaseModel):
40
+ """Replication Configuration - Settings for data replication from Slack."""
41
+
42
+ model_config = ConfigDict(extra="forbid")
43
+
44
+ start_date: str
45
+ """UTC date and time in the format YYYY-MM-DDTHH:mm:ssZ from which to start replicating data."""
46
+ lookback_window: int
47
+ """Number of days to look back when syncing data (0-365)."""
48
+ join_channels: bool
49
+ """Whether to automatically join public channels to sync messages."""
50
+
37
51
  # ===== RESPONSE TYPE DEFINITIONS (PYDANTIC) =====
38
52
 
39
53
  class User(BaseModel):
@@ -176,14 +190,6 @@ class ChannelResponse(BaseModel):
176
190
  ok: Union[bool, Any] = Field(default=None)
177
191
  channel: Union[Channel, Any] = Field(default=None)
178
192
 
179
- class Reaction(BaseModel):
180
- """Message reaction"""
181
- model_config = ConfigDict(extra="allow", populate_by_name=True)
182
-
183
- name: Union[str | None, Any] = Field(default=None)
184
- users: Union[list[str] | None, Any] = Field(default=None)
185
- count: Union[int | None, Any] = Field(default=None)
186
-
187
193
  class Attachment(BaseModel):
188
194
  """Message attachment"""
189
195
  model_config = ConfigDict(extra="allow", populate_by_name=True)
@@ -229,6 +235,14 @@ class File(BaseModel):
229
235
  created: Union[int | None, Any] = Field(default=None)
230
236
  timestamp: Union[int | None, Any] = Field(default=None)
231
237
 
238
+ class Reaction(BaseModel):
239
+ """Message reaction"""
240
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
241
+
242
+ name: Union[str | None, Any] = Field(default=None)
243
+ users: Union[list[str] | None, Any] = Field(default=None)
244
+ count: Union[int | None, Any] = Field(default=None)
245
+
232
246
  class Message(BaseModel):
233
247
  """Slack message object"""
234
248
  model_config = ConfigDict(extra="allow", populate_by_name=True)
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "airbyte-agent-slack"
3
- version = "0.1.38"
3
+ version = "0.1.39"
4
4
  description = "Airbyte Slack Connector for AI platforms"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.13"