slack_connector
slack_connector
¶
Slack connector — bulk channel message sync via the Slack Web API.
Uses OAuth tokens stored locally (see :mod:openjarvis.connectors.oauth).
All network calls are isolated in module-level functions (_slack_api_*)
to make them trivially mockable in tests.
Classes¶
SlackConnector
¶
Bases: BaseConnector
Connector that syncs channel message history from Slack via the Web API.
Authentication is handled through Slack OAuth 2.0. Tokens are stored locally in a JSON credentials file.
| PARAMETER | DESCRIPTION |
|---|---|
credentials_path
|
Path to the JSON file where OAuth tokens are stored. Defaults to
TYPE:
|
Source code in src/openjarvis/connectors/slack_connector.py
Functions¶
is_connected
¶
Return True if a credentials file with a valid token exists.
disconnect
¶
auth_url
¶
Return a Slack OAuth consent URL requesting channel history scopes.
Source code in src/openjarvis/connectors/slack_connector.py
handle_callback
¶
Handle the OAuth callback by persisting the authorization code.
In a full implementation this would exchange the code for tokens. For now the code is saved directly as the token value.
Source code in src/openjarvis/connectors/slack_connector.py
sync
¶
sync(*, since: Optional[datetime] = None, cursor: Optional[str] = None) -> Iterator[Document]
Yield :class:Document objects for Slack channel messages.
Builds a user map, then paginates through channels and retrieves message history for each channel.
| PARAMETER | DESCRIPTION |
|---|---|
since
|
Not yet used (reserved for incremental sync).
TYPE:
|
cursor
|
Not yet used (reserved for pagination resumption).
TYPE:
|
Source code in src/openjarvis/connectors/slack_connector.py
251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 | |
sync_status
¶
sync_status() -> SyncStatus
Return sync progress from the most recent :meth:sync call.
Source code in src/openjarvis/connectors/slack_connector.py
mcp_tools
¶
mcp_tools() -> List[ToolSpec]
Expose three MCP tool specs for real-time Slack queries.
Source code in src/openjarvis/connectors/slack_connector.py
401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 | |