Skip to content

Commit a09b129

Browse files
authored
fix(slack): Serialize blocks key for payload (#69021)
Json payload for slack request requires the blocks key to be serialized as a string Resolves: https://github.com/getsentry/team-core-product-foundations/issues/188#issue-2192978404
1 parent 144ff52 commit a09b129

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/sentry/integrations/slack/service.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from sentry.models.rule import Rule
1414
from sentry.notifications.notifications.activity import EMAIL_CLASSES_BY_TYPE
1515
from sentry.types.integrations import ExternalProviderEnum
16+
from sentry.utils import json
1617

1718
_default_logger = getLogger(__name__)
1819

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

0 commit comments

Comments
 (0)