open-swe/agent/tools/slack_thread_reply.py
Brace Sproul bd52e5e09d
chore: Drop monorepo (#1029)
* chore: Drop monorepo

* cr
2026-03-06 16:10:34 -08:00

27 lines
873 B
Python

import asyncio
from typing import Any
from langgraph.config import get_config
from ..utils.slack import post_slack_thread_reply
def slack_thread_reply(message: str) -> dict[str, Any]:
"""Post a message to the current Slack thread."""
config = get_config()
configurable = config.get("configurable", {})
slack_thread = configurable.get("slack_thread", {})
channel_id = slack_thread.get("channel_id")
thread_ts = slack_thread.get("thread_ts")
if not channel_id or not thread_ts:
return {
"success": False,
"error": "Missing slack_thread.channel_id or slack_thread.thread_ts in config",
}
if not message.strip():
return {"success": False, "error": "Message cannot be empty"}
success = asyncio.run(post_slack_thread_reply(channel_id, thread_ts, message))
return {"success": success}