diff --git a/src/api/endpoints.py b/src/api/endpoints.py index 6762105..7bfef29 100644 --- a/src/api/endpoints.py +++ b/src/api/endpoints.py @@ -107,7 +107,7 @@ async def message_actions(payload: str = Form(...)) -> JSONResponse: if slack.convert_user_response_to_bool(form_json): logger.info("User approved the announcement!") - slack.add_announcement(form_json.get("value", None)) + slack.add_announcement(form_json.get("actions", [{}])[0].get("text", None)) if response_url: await httpx.post( diff --git a/src/core/slack.py b/src/core/slack.py index 1df3583..6b7202b 100644 --- a/src/core/slack.py +++ b/src/core/slack.py @@ -101,7 +101,7 @@ def convert_user_response_to_bool(message_data: dict) -> bool: try: user_response = ( - message_data.get("actions", [])[0].get("action_id", "no_j") == "yes_j" + message_data.get("actions", [{}])[0].get("action_id", "no_j") == "yes_j" ) except Exception as e: logger.error(f"Failed to parse data: {e}")