:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(alerts): show an insight alert's chart in its native Slack message (#120601)
Jimmy Zhu209a2f695d1a
diff --git a/posthog/slack/channels.py b/posthog/slack/channels.pyindex 9577f037d283..3f41ebeea548 100644--- a/posthog/slack/channels.py+++ b/posthog/slack/channels.py@@ -71,6 +71,10 @@ def context_block(text: str) -> dict[str, Any]:return {"type": "context", "elements": [{"type": "mrkdwn", "text": text}]}+def image_block(url: str, alt_text: str) -> dict[str, Any]:+ return {"type": "image", "image_url": url, "alt_text": alt_text}++def section_block(text: str, button: SlackButton | None = None) -> dict[str, Any]:"""One mrkdwn section, with a link button on its right when the section has one action."""block: dict[str, Any] = {"type": "section", "text": {"type": "mrkdwn", "text": text}}diff --git a/products/alerts/backend/apps.py b/products/alerts/backend/apps.pyindex ae57f90995fd..805468a0d1d4 100644--- a/products/alerts/backend/apps.py+++ b/products/alerts/backend/apps.py@@ -22,12 +22,16 @@ class AlertsConfig(AppConfig):list_delivery_destination_groups,)from products.alerts.backend.platform_alert_wording import describe_insight_transition # noqa: PLC0415- from products.alerts.backend.platform_hooks import emit_insight_legacy_events # noqa: PLC0415+ from products.alerts.backend.platform_hooks import ( # noqa: PLC0415+ emit_insight_legacy_events,+ insight_chart_image,+ )from products.alerts.backend.platform_source_config import load_insight_source_config # noqa: PLC0415from products.alerts_platform.backend.facade.contracts import SourceKind # noqa: PLC0415from products.alerts_platform.backend.facade.delivery import ( # noqa: PLC0415register_delivery_path_chooser,register_destination_resolver,+ register_image_resolver,register_legacy_event_emitter,register_source_describer,)@@ -37,4 +41,5 @@ class AlertsConfig(AppConfig):register_delivery_path_chooser(choose_delivery_path)register_legacy_event_emitter(SourceKind.INSIGHT, emit_insight_legacy_events)register_source_describer(SourceKind.INSIGHT, describe_insight_transition)+ register_image_resolver(SourceKind.INSIGHT, insight_chart_image)register_source_config(SourceKind.INSIGHT, load_insight_source_config)diff --git a/products/alerts/backend/platform_alert_legacy_events.py b/products/alerts/backend/platform_alert_legacy_events.pyindex c3868bd46e49..ec6a327c709a 100644--- a/products/alerts/backend/platform_alert_legacy_events.py+++ b/products/alerts/backend/platform_alert_legacy_events.py@@ -26,6 +26,7 @@ from products.alerts_platform.backend.facade.contracts import (AnnouncedTransition,EvaluationAnnouncement,LegacyEventEmission,+ MessageImage,)from products.cdp.backend.internal_events import LEGACY_INSIGHT_ALERT_EVENT@@ -70,6 +71,14 @@ def insight_chart_url_of(team_id: int, source_detail: dict[str, Any]) -> str | N)+def insight_chart_image(*, team_id: int, transition: AnnouncedTransition) -> MessageImage | None:+ """The chart a native message shows for a firing, with its URL minted as the message goes out."""+ if transition.kind != AlertEventKind.FIRING:+ return None+ url = insight_chart_url_of(team_id, transition.source_detail)+ return MessageImage(url=url, alt_text="Insight chart") if url else None++def _firing_event(alert: AlertConfiguration, transition: AnnouncedTransition) -> AlertInternalEvent:detail = transition.source_detailproperties: dict[str, Any] = {diff --git a/products/alerts/backend/platform_hooks.py b/products/alerts/backend/platform_hooks.pyindex 8c9de6c45f8a..a39c6c508c20 100644--- a/products/alerts/backend/platform_hooks.py+++ b/products/alerts/backend/platform_hooks.py@@ -13,8 +13,10 @@ from typing import TYPE_CHECKINGif TYPE_CHECKING:from products.alerts_platform.backend.facade.contracts import (AlertDeliveryRequest,+ AnnouncedTransition,EvaluationAnnouncement,LegacyEventEmission,+ MessageImage,)@@ -28,3 +30,11 @@ def emit_insight_legacy_events(platform_alert_legacy_events.emit_insight_legacy_events(request=request, announcement=announcement, emissions=emissions)+++def insight_chart_image(*, team_id: int, transition: AnnouncedTransition) -> MessageImage | None:+ from products.alerts.backend import (+ platform_alert_legacy_events, # noqa: PLC0415 - keeps the alert task helpers off the startup path+ )++ return platform_alert_legacy_events.insight_chart_image(team_id=team_id, transition=transition)diff --git a/products/alerts/backend/test/test_platform_alert_legacy_events.py b/products/alerts/backend/test/test_platform_alert_legacy_events.pyindex 522c4089dde0..a831fc1e4256 100644--- a/products/alerts/backend/test/test_platform_alert_legacy_events.py+++ b/products/alerts/backend/test/test_platform_alert_legacy_events.py@@ -4,12 +4,14 @@ from typing import Anyfrom posthog.test.base import APIBaseTestfrom unittest.mock import patch+from django.test import SimpleTestCase+from parameterized import parameterizedfrom posthog.schema_enums import AlertStatefrom posthog.tasks.alerts.utils import RenderedInsightChart, trigger_alert_hog_functions-from products.alerts.backend.platform_alert_legacy_events import emit_insight_legacy_events+from products.alerts.backend.platform_alert_legacy_events import emit_insight_legacy_events, insight_chart_imagefrom products.alerts.backend.test.insight_alerts import create_insight_alertfrom products.alerts_platform.backend.facade.contracts import (AlertDeliveryRequest,@@ -17,6 +19,7 @@ from products.alerts_platform.backend.facade.contracts import (AnnouncedTransition,EvaluationAnnouncement,LegacyEventEmission,+ MessageImage,SourceKind,)@@ -116,3 +119,43 @@ class TestInsightLegacyEvents(APIBaseTest):self, _name: str, kind: AlertEventKind, sends_message: bool, alert_id: str | None) -> None:assert self._emit(self._emission(kind, sends_message=sends_message), alert_id=alert_id) == []+++class TestInsightChartImage(SimpleTestCase):+ @parameterized.expand(+ [+ (+ "a_firing_with_a_chart",+ AlertEventKind.FIRING,+ {"insight_chart_asset_id": 7, "insight_chart_render_user_id": 3},+ True,+ ),+ ("a_firing_without_one", AlertEventKind.FIRING, {}, False),+ (+ "an_error",+ AlertEventKind.ERRORED,+ {"insight_chart_asset_id": 7, "insight_chart_render_user_id": 3},+ False,+ ),+ ]+ )+ def test_a_native_message_shows_the_chart_a_firing_rendered(+ self, _name: str, kind: AlertEventKind, detail: dict[str, Any], shown: bool+ ) -> None:+ transition = AnnouncedTransition(+ grouping_key="",+ kind=kind,+ episode_started_at=None,+ value=150.0,+ labels={},+ condition={},+ source_config={},+ error_message=None,+ occurred_at=datetime(2026, 10, 20, 9, 0, tzinfo=UTC),+ source_detail=detail,+ )++ with patch(f"{_EMITTER}.insight_chart_url", return_value=CHART_URL):+ image = insight_chart_image(team_id=2, transition=transition)++ assert image == (MessageImage(url=CHART_URL, alt_text="Insight chart") if shown else None)diff --git a/products/alerts/backend/test/test_platform_alert_wording.py b/products/alerts/backend/test/test_platform_alert_wording.pyindex 1b7276d0ff52..f426752f556c 100644--- a/products/alerts/backend/test/test_platform_alert_wording.py+++ b/products/alerts/backend/test/test_platform_alert_wording.py@@ -16,10 +16,12 @@ from products.alerts_platform.backend.facade.contracts import (SourceDescription,)-DETAIL = {+DETAIL: dict[str, Any] = {"breaches": ["Signups (50) is less than lower threshold (100)"],"insight_name": "Signups","insight_short_id": "abc123",+ "insight_chart_asset_id": 7,+ "insight_chart_render_user_id": 3,}LINK = MessageLink(label="View insight", url=absolute_uri("/project/7/insights/abc123"))@@ -28,7 +30,7 @@ class TestDescribeInsightTransition(SimpleTestCase):@parameterized.expand([(- "a_firing_states_its_breach_and_links_its_insight",+ "a_firing_states_its_breach_and_shows_and_links_its_insight",AlertEventKind.FIRING,DETAIL,SourceDescription(diff --git a/products/alerts_platform/backend/delivery/describers.py b/products/alerts_platform/backend/delivery/describers.pyindex d0e03057453b..f9d2c2cf93cc 100644--- a/products/alerts_platform/backend/delivery/describers.py+++ b/products/alerts_platform/backend/delivery/describers.py@@ -12,8 +12,10 @@ from posthog.slack.channels import clip_textfrom products.alerts_platform.backend.facade.contracts import (AnnouncedTransition,+ MessageImage,SourceDescriber,SourceDescription,+ SourceImageResolver,SourceKind,)@@ -24,10 +26,15 @@ MAX_CONTEXT_LINE_CHARS: Final = 300# A data link can carry a whole filter in its query string. Slack refuses a post whose button URL is# over 3000 characters, so a longer link is dropped rather than costing the message.MAX_DATA_LINK_URL_CHARS: Final = 2000+# Slack refuses an image block whose URL is over 3000 characters, so a longer image is dropped too.+# Its alt text has a 2000-character limit, which a clip keeps the image inside.+MAX_IMAGE_URL_CHARS: Final = 3000+MAX_IMAGE_ALT_TEXT_CHARS: Final = 2000logger = structlog.get_logger(__name__)_describers: dict[SourceKind, SourceDescriber] = {}+_image_resolvers: dict[SourceKind, SourceImageResolver] = {}def register(source: SourceKind, describer: SourceDescriber) -> None:@@ -76,3 +83,29 @@ def _bounded(source: SourceKind, description: SourceDescription) -> SourceDescricontext=tuple(clip_text(line, MAX_CONTEXT_LINE_CHARS) for line in description.context[:MAX_CONTEXT_LINES]),data_link=data_link,)+++def register_image_resolver(source: SourceKind, resolver: SourceImageResolver) -> None:+ registered = _image_resolvers.get(source)+ if registered is not None and registered is not resolver:+ raise RuntimeError(f"A different image resolver is already registered for {source} alerts.")+ _image_resolvers[source] = resolver+++def resolve_image(source: SourceKind, *, team_id: int, transition: AnnouncedTransition) -> MessageImage | None:+ """The source's picture for a transition, or None. A picture is never worth a lost notification,+ so a resolver that fails sends the message without one."""+ resolver = _image_resolvers.get(source)+ if resolver is None:+ return None+ try:+ image = resolver(team_id=team_id, transition=transition)+ except Exception:+ logger.exception("alerts_platform.image_resolver_failed", source=source.value)+ return None+ if image is None:+ return None+ if len(image.url) > MAX_IMAGE_URL_CHARS:+ logger.warning("alerts_platform.image_url_too_long", source=source.value, length=len(image.url))+ return None+ return MessageImage(url=image.url, alt_text=clip_text(image.alt_text, MAX_IMAGE_ALT_TEXT_CHARS))diff --git a/products/alerts_platform/backend/delivery/message.py b/products/alerts_platform/backend/delivery/message.pyindex d5eba7405616..d83140fbf9e4 100644--- a/products/alerts_platform/backend/delivery/message.py+++ b/products/alerts_platform/backend/delivery/message.py@@ -12,13 +12,14 @@ from typing import Any, Finalfrom posthog.dataclasses import frozenfrom posthog.utils import absolute_uri, pluralize-from products.alerts_platform.backend.delivery.describers import describe+from products.alerts_platform.backend.delivery.describers import describe, resolve_imagefrom products.alerts_platform.backend.facade.contracts import (AlertEventKind,AnnouncedTransition,EvaluationAnnouncement,IncidentAction,MessageDetail,+ MessageImage,MessageLink,SourceKind,)@@ -70,6 +71,7 @@ class AlertMessage:transition: AnnouncedTransitioncontext: tuple[str, ...] = ()data_link: MessageLink | None = None+ image: MessageImage | None = Noneincident_action: IncidentAction | None = None@property@@ -199,5 +201,6 @@ def build_message(transition=transition,context=description.context,data_link=description.data_link,+ image=resolve_image(announcement.source, team_id=team_id, transition=transition),incident_action=incident_action,)diff --git a/products/alerts_platform/backend/delivery/slack.py b/products/alerts_platform/backend/delivery/slack.pyindex b66107e7e514..ea79d0b23e8c 100644--- a/products/alerts_platform/backend/delivery/slack.py+++ b/products/alerts_platform/backend/delivery/slack.py@@ -17,6 +17,7 @@ from posthog.slack.channels import (clip_text,context_block,header_block,+ image_block,post_message,section_block,update_message,@@ -35,6 +36,10 @@ MAX_CONTEXT_CHARS: Final = 3000# Separates alert traffic from the API-driven calls on the shared Slack egress metrics.EGRESS_SOURCE: Final = "alerts"+# What Slack answers when it cannot fetch an image block, such as an expired chart URL. It refuses+# the whole message, so the message goes again without its image rather than not at all.+IMAGE_REFUSAL: Final = "invalid_blocks"+def _line(detail: MessageDetail) -> str:# The value carries a query error, which is user-written text. Unescaped `<...>` is live in@@ -62,10 +67,20 @@ def blocks_for(message: AlertMessage) -> list[dict[str, Any]]:# Escaping can grow it fourfold, so the clip comes after it.context = " | ".join(escape_slack_mrkdwn(line) for line in message.context)blocks.append(context_block(clip_text(context, MAX_CONTEXT_CHARS)))+ if message.image is not None:+ blocks.append(image_block(message.image.url, message.image.alt_text))blocks.append(actions_block([SlackButton(text=link.label, url=link.url) for link in message.links]))return blocks+def _without_images(blocks: list[dict[str, Any]]) -> list[dict[str, Any]]:+ return [block for block in blocks if block.get("type") != "image"]+++def _refused_image(error: SlackApiError, blocks: list[dict[str, Any]]) -> bool:+ return error.response.get("error") == IMAGE_REFUSAL and len(_without_images(blocks)) < len(blocks)++def _with_state_line(blocks: list[dict[str, Any]], state_line: str) -> list[dict[str, Any]]:"""The opening blocks unchanged, with the state line above the buttons `blocks_for` ends with.@@ -97,8 +112,9 @@ class SlackTransport:blocks = blocks_for(message)# The one place the alert's name reaches mrkdwn: the header renders plain text.text = escape_slack_mrkdwn(message.title)- try:- response = post_message(++ def post(blocks: list[dict[str, Any]]) -> Any:+ return post_message(slack,channel,blocks,@@ -107,6 +123,15 @@ class SlackTransport:# A root edit notifies nobody, so a resolve also goes to the channel, as legacy posted it.reply_broadcast=in_reply_to is not None and message.transition.kind == AlertEventKind.RESOLVED,)++ try:+ try:+ response = post(blocks)+ except SlackApiError as error:+ if not _refused_image(error, blocks):+ raise+ blocks = _without_images(blocks)+ response = post(blocks)except SlackApiError as error:# A refusal a person can fix, such as a channel the bot has left, rather than a# transport failure a retry would clear.@@ -125,16 +150,18 @@ class SlackTransport:if workspace_id is None or not channel or not ts or not root.root_content:raise DeliveryError("This Slack conversation has no opening message to edit.")slack = SlackIntegration(self._integration(team_id=team_id, workspace_id=workspace_id), source=EGRESS_SOURCE)+ blocks = _with_state_line(root.root_content["blocks"], state_line)+ # Screen readers read the fallback text rather than the blocks, so it carries the current+ # state too.+ text = f"{root.root_content['text']} ({state_line})"try:- update_message(- slack,- channel,- ts,- _with_state_line(root.root_content["blocks"], state_line),- # Screen readers read the fallback text rather than the blocks, so it carries the- # current state too.- f"{root.root_content['text']} ({state_line})",- )+ try:+ update_message(slack, channel, ts, blocks, text)+ except SlackApiError as error:+ # A chart URL expires, so an edit long after the opening message can lose it.+ if not _refused_image(error, blocks):+ raise+ update_message(slack, channel, ts, _without_images(blocks), text)except SlackApiError as error:raise DeliveryError(f"Slack refused the edit: {error.response.get('error')}") from errordiff --git a/products/alerts_platform/backend/facade/contracts.py b/products/alerts_platform/backend/facade/contracts.pyindex 235819d4db34..bc9dace05324 100644--- a/products/alerts_platform/backend/facade/contracts.py+++ b/products/alerts_platform/backend/facade/contracts.py@@ -1246,6 +1246,12 @@ class MessageLink:url: str+@frozen+class MessageImage:+ url: str+ alt_text: str++@frozenclass SourceDescription:"""What a source says about one transition, in the words its own product uses.@@ -1274,6 +1280,17 @@ class SourceDescriber(Protocol):def __call__(self, *, project_id: int, transition: AnnouncedTransition) -> SourceDescription: ...+class SourceImageResolver(Protocol):+ """The picture a message shows for a transition, such as an insight's chart, or None.++ Runs on the send path like a describer, but it may read storage: a picture's URL can open it+ without a login, so the source stores the picture by id and mints the URL as the message goes.+ A provider that cannot show a picture leaves it out.+ """++ def __call__(self, *, team_id: int, transition: AnnouncedTransition) -> MessageImage | None: ...++class LegacyWebhookBody(Protocol):"""The webhook body a source's own stack sent, for teams whose receivers still parse it.diff --git a/products/alerts_platform/backend/facade/delivery.py b/products/alerts_platform/backend/facade/delivery.pyindex b5425e87eaae..b83246e078b8 100644--- a/products/alerts_platform/backend/facade/delivery.py+++ b/products/alerts_platform/backend/facade/delivery.py@@ -18,6 +18,7 @@ from products.alerts_platform.backend.facade.contracts import (LegacyEventEmitter,LegacyWebhookBody,SourceDescriber,+ SourceImageResolver,SourceKind,)@@ -33,6 +34,10 @@ def register_source_describer(source: SourceKind, describer: SourceDescriber) ->describers.register(source, describer)+def register_image_resolver(source: SourceKind, resolver: SourceImageResolver) -> None:+ describers.register_image_resolver(source, resolver)++def refused_destination(data: AlertDestinationData) -> str | None:"""Why native delivery would refuse to send to this destination, or None when it would send."""return addresses.refused_destination(data)diff --git a/products/alerts_platform/backend/tests/delivery_messages.py b/products/alerts_platform/backend/tests/delivery_messages.pyindex f36e8b80649b..90db46c0dcb9 100644--- a/products/alerts_platform/backend/tests/delivery_messages.py+++ b/products/alerts_platform/backend/tests/delivery_messages.py@@ -16,6 +16,7 @@ from products.alerts_platform.backend.facade.contracts import (AnnouncedTransition,IncidentAction,MessageDetail,+ MessageImage,MessageLink,SourceKind,)@@ -50,6 +51,7 @@ def alert_message(symbol: str = "\U0001f534",context: tuple[str, ...] = (),data_link: MessageLink | None = None,+ image: MessageImage | None = None,) -> AlertMessage:return AlertMessage(headline=headline,@@ -62,6 +64,7 @@ def alert_message(transition=transition or announced_transition(),context=context,data_link=data_link,+ image=image,incident_action=incident_action,)diff --git a/products/alerts_platform/backend/tests/test_delivery_message.py b/products/alerts_platform/backend/tests/test_delivery_message.pyindex 2605f2065177..fd8b9739dba7 100644--- a/products/alerts_platform/backend/tests/test_delivery_message.py+++ b/products/alerts_platform/backend/tests/test_delivery_message.py@@ -13,6 +13,7 @@ from products.alerts_platform.backend.facade.contracts import (EvaluationAnnouncement,IncidentAction,MessageDetail,+ MessageImage,MessageLink,SourceDescription,SourceKind,@@ -23,6 +24,11 @@ def _described_by(describer: Any) -> Any:return patch.dict(describers._describers, {SourceKind.LOGS: describer})+def _resolver_that_raises(**_: Any) -> MessageImage:+ raise RuntimeError("asset gone")+++CHART = MessageImage(url="https://app.example.com/chart.png", alt_text="Chart")LOGS_DESCRIPTION = SourceDescription(details=(MessageDetail(label="Threshold breached", value="300 logs in 5m (threshold: above 100)"),),context=("Services: checkout",),@@ -184,6 +190,25 @@ class TestAlertMessage:assert (message.context, message.data_link) == (("Services: checkout",), None)+ @pytest.mark.parametrize(+ "resolver,expected",+ [+ pytest.param(lambda **_: CHART, CHART, id="shown"),+ # A URL Slack would refuse costs the whole message, so the picture is left out instead.+ pytest.param(+ lambda **_: MessageImage(url="https://app.example.com/chart?" + "q" * 3000, alt_text="Chart"),+ None,+ id="url_too_long",+ ),+ pytest.param(_resolver_that_raises, None, id="resolver_raises"),+ ],+ )+ def test_a_source_picture_is_resolved_as_the_message_goes_out(self, resolver: Any, expected: Any) -> None:+ with patch.dict(describers._image_resolvers, {SourceKind.LOGS: resolver}):+ message = _build(_announcement(), _transition(AlertEventKind.FIRING))++ assert message.image == expected+@pytest.mark.parametrize("answer", ["raises", "returns_none"])def test_a_broken_describer_still_delivers_the_platform_wording(self, answer: str) -> None:def broken(**_: Any) -> Any:diff --git a/products/alerts_platform/backend/tests/test_delivery_slack.py b/products/alerts_platform/backend/tests/test_delivery_slack.pyindex 076f28c0a3ee..68593521c4f6 100644--- a/products/alerts_platform/backend/tests/test_delivery_slack.py+++ b/products/alerts_platform/backend/tests/test_delivery_slack.py@@ -18,6 +18,7 @@ from products.alerts_platform.backend.facade.contracts import (AlertDestinationData,AlertEventKind,MessageDetail,+ MessageImage,MessageLink,)from products.alerts_platform.backend.tests.delivery_messages import ALERT_URL, alert_message, announced_transition@@ -84,6 +85,22 @@ class TestSlackBlocks(SimpleTestCase):assert [block["type"] for block in blocks] == ["header", "actions"]assert blocks[1]["elements"][0]["url"] == ALERT_URL+ def test_a_source_image_sits_above_the_buttons(self) -> None:+ # The state line a resolve adds goes above the last block, so the buttons have to stay last.+ message = alert_message(+ context=("Insight: Signups",),+ image=MessageImage(url="https://app.example.com/chart.png", alt_text="Insight chart"),+ )++ blocks = blocks_for(message)++ assert [block["type"] for block in blocks] == ["header", "context", "image", "actions"]+ assert blocks[2] == {+ "type": "image",+ "image_url": "https://app.example.com/chart.png",+ "alt_text": "Insight chart",+ }+def test_the_source_data_link_comes_before_the_alert_link(self) -> None:data_url = "https://app.example.com/project/1/logs"message = alert_message(data_link=MessageLink(label="View logs", url=data_url))@@ -171,6 +188,19 @@ class TestSlackTransport(APIBaseTest):with pytest.raises(DeliveryError):SlackTransport().deliver(team_id=self.team.id, target=self.target, message=MESSAGE)+ def test_a_message_whose_image_slack_cannot_fetch_goes_again_without_it(self) -> None:+ message = alert_message(image=MessageImage(url="https://app.example.com/chart.png", alt_text="Insight chart"))+ with patch("products.alerts_platform.backend.delivery.slack.SlackIntegration") as slack_integration:+ post = slack_integration.return_value.client.chat_postMessage+ post.side_effect = [SlackApiError("invalid_blocks", {"error": "invalid_blocks"}), {"ts": "1700000000.1"}]+ handle = SlackTransport().deliver(team_id=self.team.id, target=self.target, message=message)++ assert post.call_count == 2+ assert "image" not in [block["type"] for block in post.call_args.kwargs["blocks"]]+ # An edit restates what was posted, so it never names the image again.+ assert handle is not None and handle.root_content is not None+ assert handle.root_content["blocks"] == post.call_args.kwargs["blocks"]+def test_a_destination_missing_its_channel_is_refused(self) -> None:target = cast(AlertDestinationData, {"type": "slack", "slack_workspace_id": self.integration.id})