Skip to content

fix(slack): Serialize blocks key for payload #69021

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/sentry/integrations/slack/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from sentry.models.rule import Rule
from sentry.notifications.notifications.activity import EMAIL_CLASSES_BY_TYPE
from sentry.types.integrations import ExternalProviderEnum
from sentry.utils import json

_default_logger = getLogger(__name__)

Expand Down Expand Up @@ -166,6 +167,8 @@ def _handle_parent_notification(
block, fallback_text=notification_to_send
)
payload.update(slack_payload)
# TODO (Yash): Users should not have to remember to do this, interface should handle serializing the field
payload["blocks"] = json.dumps(payload.get("blocks"))
try:
client.post("/chat.postMessage", data=payload, timeout=5)
except Exception as err:
Expand Down