Skip to content

: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.

feat(subscriptions): let AI slack reports post charts in the thread (#126656)

Ryland Bowles0ad3633b7118
diff --git a/products/subscriptions/backend/logic/subscription_writes.py b/products/subscriptions/backend/logic/subscription_writes.py
index 26b1b61daa5f..c466662849f6 100644
--- a/products/subscriptions/backend/logic/subscription_writes.py
+++ b/products/subscriptions/backend/logic/subscription_writes.py
@@ -392,9 +392,8 @@ class _SubscriptionWrite:
if "delivery_config" in attrs
else (self.instance.delivery_config if self.instance else None)
) or {}
- # A prompt report never reads the gallery option, so only the value a request sends can be
- # wrong. An insight or dashboard report does read it, so the stored value still decides: a
- # target or permission change would break the next delivery.
+ # A prompt report on a target that ignores the option still delivers, so only a value the request
+ # sends is checked. Older prompt rows can store it on an email target and must stay editable.
gallery_enabled = (
submitted_delivery_config
if resource_type == Subscription.ResourceType.AI_PROMPT
@@ -413,18 +412,6 @@ class _SubscriptionWrite:
]
}
)
- elif gallery_enabled:
- # The prompt Slack renderer already posts every chart in the main message and never reads this option.
- raise SubscriptionRequestInvalidError(
- {
- "delivery_config": [
- "post_all_insights_in_main_message only applies to insight and dashboard "
- f"subscriptions. This subscription has resource_type '{resource_type}', so "
- "remove it from delivery_config. A prompt report already posts all its chart "
- "images in the main message."
- ]
- }
- )
# Reject re-enables of subscriptions whose delivery prerequisite is still
# permanently broken — otherwise the next delivery would just auto-disable
@@ -502,7 +489,12 @@ class _SubscriptionWrite:
raise SubscriptionRequestInvalidError(
{"integration_id": ["This integration does not exist or does not belong to your team."]}
)
- if gallery_enabled and SlackIntegration(integration).missing_scopes({"files:write"}):
+ # A prompt report links its chart images instead of uploading them, so it needs no file upload permission.
+ if (
+ gallery_enabled
+ and resource_type != Subscription.ResourceType.AI_PROMPT
+ and SlackIntegration(integration).missing_scopes({"files:write"})
+ ):
raise SubscriptionRequestInvalidError(
{
"delivery_config": [
diff --git a/products/subscriptions/backend/presentation/views.py b/products/subscriptions/backend/presentation/views.py
index c126306d5277..9d9fda2bd943 100644
--- a/products/subscriptions/backend/presentation/views.py
+++ b/products/subscriptions/backend/presentation/views.py
@@ -209,12 +209,14 @@ class DeliveryConfigSerializer(serializers.Serializer):
required=False,
default=False,
help_text=(
- "Slack insight and dashboard subscriptions only: when true, upload all insight images "
- "together in the main Slack message instead of posting the first image in the main "
- "message and the rest as threaded replies. Defaults to false. The request is rejected "
- "when target_type is not 'slack', when the subscription sets prompt instead of insight "
- "or dashboard, or when the Slack integration does not hold the files:write permission. "
- "Omit it unless the user asks for one combined message."
+ "Slack subscriptions only. Insight and dashboard subscriptions: when true, upload all insight "
+ "images together in the main Slack message instead of posting the first image in the main "
+ "message and the rest as threaded replies. Prompt subscriptions: when true, post the chart "
+ "images in the main message with the summary; when false, post them in the first thread "
+ "reply. Defaults to false. The request is rejected when target_type is not 'slack', or when "
+ "an insight or dashboard subscription's Slack integration does not hold the files:write "
+ "permission. "
+ "Omit it unless the user asks for all images or charts in the main message."
),
)
include_images = serializers.BooleanField(
diff --git a/products/subscriptions/backend/temporal/ai_subscription/delivery.py b/products/subscriptions/backend/temporal/ai_subscription/delivery.py
index 4bf72ffd9c5e..d6fc4e6516f6 100644
--- a/products/subscriptions/backend/temporal/ai_subscription/delivery.py
+++ b/products/subscriptions/backend/temporal/ai_subscription/delivery.py
@@ -592,6 +592,10 @@ def send_email_ai_subscription_credit_limited(
message.send(send_async=False)
+def _slack_charts_in_main_message(subscription: Subscription) -> bool:
+ return bool(subscription.delivery_config.get("post_all_insights_in_main_message", False))
+
+
def _build_ai_slack_message(
subscription: Subscription,
markdown: str,
@@ -617,6 +621,7 @@ def _build_ai_slack_message(
{"type": "header", "text": {"type": "plain_text", "text": heading[:150]}},
*_slack_report_blocks(first_section, env),
]
+ chart_blocks: list[dict] = []
for chart in (charts or []) if subscription.includes_delivery_part("include_images") else []:
caption = chart.get("title") or "Chart"
image_block: dict = {
@@ -626,8 +631,11 @@ def _build_ai_slack_message(
}
if chart.get("title"):
image_block["title"] = {"type": "plain_text", "text": caption[:SLACK_IMAGE_TITLE_LIMIT]}
- blocks.append(image_block)
- if len(sections) > 1:
+ chart_blocks.append(image_block)
+ charts_in_thread = bool(chart_blocks) and not _slack_charts_in_main_message(subscription)
+ if not charts_in_thread:
+ blocks.extend(chart_blocks)
+ if len(sections) > 1 or charts_in_thread:
blocks.append(
{"type": "section", "text": {"type": "mrkdwn", "text": "_See thread for the rest of the report._"}}
)
@@ -685,6 +693,11 @@ def _build_ai_slack_message(
{"blocks": overflow[start : start + SLACK_MESSAGE_BLOCK_LIMIT]}
for start in range(0, len(overflow), SLACK_MESSAGE_BLOCK_LIMIT)
)
+ if charts_in_thread:
+ thread_messages.extend(
+ {"blocks": chart_blocks[start : start + SLACK_MESSAGE_BLOCK_LIMIT]}
+ for start in range(0, len(chart_blocks), SLACK_MESSAGE_BLOCK_LIMIT)
+ )
for section in sections[1:]:
section_blocks = _slack_report_blocks(section, env)
thread_messages.extend(
@@ -716,7 +729,12 @@ async def send_slack_ai_subscription_report(
try:
return await deliver_slack_message_data(integration, subscription, build(effective_charts))
except SlackApiError as exc:
- if not effective_charts or exc.response.get("error") != "invalid_blocks":
+ # Threaded charts are not in the main message, so dropping them cannot fix a rejected main message.
+ if (
+ not effective_charts
+ or not _slack_charts_in_main_message(subscription)
+ or exc.response.get("error") != "invalid_blocks"
+ ):
raise
logger.warning(
"ai_report.slack_charts_rejected_resending_without_them",
diff --git a/products/subscriptions/backend/temporal/ai_subscription/test/test_delivery.py b/products/subscriptions/backend/temporal/ai_subscription/test/test_delivery.py
index 982a7afd794a..c8511b12daec 100644
--- a/products/subscriptions/backend/temporal/ai_subscription/test/test_delivery.py
+++ b/products/subscriptions/backend/temporal/ai_subscription/test/test_delivery.py
@@ -50,6 +50,7 @@ _DELIVERY = "products.subscriptions.backend.temporal.ai_subscription.delivery"
_ACTIVITIES = "products.subscriptions.backend.temporal.ai_subscription.activities"
_PARA = "a" * (SLACK_MRKDWN_SECTION_LIMIT - 100)
+_LONG_PARA = "b" * (SLACK_MARKDOWN_MESSAGE_LIMIT - 100)
_DELIVERY_ID = uuid.UUID("12345678-1234-5678-1234-567812345678")
_SUBSCRIPTION_URL = "https://app.posthog.com/project/1/subscriptions/2"
@@ -293,6 +294,12 @@ def _mock_subscription() -> MagicMock:
return sub
+def _charts_in_main_message_subscription() -> MagicMock:
+ sub = _mock_subscription()
+ sub.delivery_config = {"post_all_insights_in_main_message": True}
+ return sub
+
+
def _build_message(markdown: str) -> SlackMessage:
return _build_ai_slack_message(_mock_subscription(), markdown, delivery_id=_DELIVERY_ID)
@@ -422,7 +429,7 @@ class TestBuildChartImageUrls:
class TestChartsOnSlackMessages:
def test_charts_follow_the_report_text(self) -> None:
message = _build_ai_slack_message(
- _mock_subscription(), "A short report.", delivery_id=_DELIVERY_ID, charts=[_CHART]
+ _charts_in_main_message_subscription(), "A short report.", delivery_id=_DELIVERY_ID, charts=[_CHART]
)
assert [block["type"] for block in message.blocks[:4]] == [
@@ -439,7 +446,7 @@ class TestChartsOnSlackMessages:
def test_an_untitled_chart_posts_no_title_block(self) -> None:
message = _build_ai_slack_message(
- _mock_subscription(),
+ _charts_in_main_message_subscription(),
"A short report.",
delivery_id=_DELIVERY_ID,
charts=[{"title": "", "image_url": "https://ph.test/img.png"}],
@@ -453,6 +460,42 @@ class TestChartsOnSlackMessages:
assert all(block["type"] != "image" for block in message.blocks)
+ @parameterized.expand(
+ [
+ ("missing", {}, False),
+ ("off", {"post_all_insights_in_main_message": False}, False),
+ ("on", {"post_all_insights_in_main_message": True}, True),
+ ]
+ )
+ def test_the_gallery_option_decides_where_charts_go(self, _name, delivery_config, in_main_message) -> None:
+ subscription = _mock_subscription()
+ subscription.delivery_config = delivery_config
+
+ message = _build_ai_slack_message(
+ subscription, f"{_LONG_PARA}\n\n{_LONG_PARA}", delivery_id=_DELIVERY_ID, charts=[_CHART]
+ )
+
+ replies = [reply["blocks"] for reply in message.thread_messages]
+ assert any(block["type"] == "image" for block in message.blocks) is in_main_message
+ if in_main_message:
+ assert all(block["type"] != "image" for blocks in replies for block in blocks)
+ else:
+ # The charts open the thread, ahead of the rest of the report text.
+ assert [block["type"] for block in replies[0]] == ["image"]
+ assert len(replies) > 1
+ assert all(block["type"] != "image" for blocks in replies[1:] for block in blocks)
+
+ def test_a_short_report_with_threaded_charts_points_to_the_thread(self) -> None:
+ message = _build_ai_slack_message(
+ _mock_subscription(), "A short report.", delivery_id=_DELIVERY_ID, charts=[_CHART]
+ )
+
+ assert {
+ "type": "section",
+ "text": {"type": "mrkdwn", "text": "_See thread for the rest of the report._"},
+ } in message.blocks
+ assert [reply["blocks"][0]["type"] for reply in message.thread_messages] == ["image"]
+
async def test_a_chart_slack_rejects_costs_the_chart_not_the_report(self) -> None:
sent: list[list[dict]] = []
@@ -464,7 +507,7 @@ class TestChartsOnSlackMessages:
with patch(f"{_DELIVERY}.deliver_slack_message_data", side_effect=_deliver):
await send_slack_ai_subscription_report(
- subscription=_mock_subscription(),
+ subscription=_charts_in_main_message_subscription(),
markdown="A short report.",
integration=MagicMock(),
delivery_id=_DELIVERY_ID,
@@ -476,6 +519,25 @@ class TestChartsOnSlackMessages:
assert all(block["type"] != "image" for block in sent[1])
assert {"type": "markdown", "text": "A short report."} in sent[1]
+ async def test_threaded_charts_do_not_trigger_the_resend(self) -> None:
+ sent: list[list[dict]] = []
+
+ async def _deliver(_integration, _subscription, message_data):
+ sent.append(message_data.blocks)
+ raise SlackApiError("bad blocks", response={"error": "invalid_blocks"})
+
+ with patch(f"{_DELIVERY}.deliver_slack_message_data", side_effect=_deliver):
+ with pytest.raises(SlackApiError):
+ await send_slack_ai_subscription_report(
+ subscription=_mock_subscription(),
+ markdown="A short report.",
+ integration=MagicMock(),
+ delivery_id=_DELIVERY_ID,
+ charts=[_CHART],
+ )
+
+ assert len(sent) == 1
+
async def test_a_hidden_chart_does_not_trigger_the_resend(self) -> None:
# A report that hides its charts already sends a payload with no image block, so the
# retry would repeat an identical message and double the posts Slack rate-limits.
@@ -622,6 +684,7 @@ class TestBuildAISlackMessage:
def test_with_images_delivery_keeps_charts_without_posthog_controls(self) -> None:
subscription = _mock_subscription()
subscription.delivery_config = {
+ "post_all_insights_in_main_message": True,
"include_images": True,
"include_feedback": False,
"include_manage_link": False,
diff --git a/products/subscriptions/backend/tests/test_subscription.py b/products/subscriptions/backend/tests/test_subscription.py
index 0a57281bc925..6d81fead0a05 100644
--- a/products/subscriptions/backend/tests/test_subscription.py
+++ b/products/subscriptions/backend/tests/test_subscription.py
@@ -59,11 +59,6 @@ from ee.api.test.base import APILicensedTest
WAREHOUSE_ACCESS_CONTROL_FLAG = "posthog.hogql.database.database._evaluate_warehouse_access_control_flag"
VALID_TEAMS_WEBHOOK_URL = "https://prod-25.westeurope.logic.azure.com:443/workflows/abc/triggers/manual/paths/invoke"
-GALLERY_ON_PROMPT_ERROR = (
- "post_all_insights_in_main_message only applies to insight and dashboard subscriptions. This "
- "subscription has resource_type 'ai_prompt', so remove it from delivery_config. A prompt report "
- "already posts all its chart images in the main message."
-)
GALLERY_FILES_WRITE_ERROR = (
"post_all_insights_in_main_message requires the Slack files:write permission. Reconnect Slack to "
"grant it, or remove the option from delivery_config to save the subscription now. Each delivery "
@@ -4258,55 +4253,26 @@ class TestAISubscriptionAPI(APILicensedTest):
@parameterized.expand(
[
- ("unrelated_field", "files:write", {"enabled": False}),
- ("delivery_config_without_the_option", "files:write", {"delivery_config": {"include_images": False}}),
- ("slack_without_files_write", "channels:read", {"enabled": False}),
- ]
- )
- def test_stored_gallery_option_does_not_block_other_prompt_edits(
- self, mock_is_cloud, mock_flag, mock_sync, _name, extra_scope, patch_body
- ):
- self._enable_ai()
- self._mock_temporal(mock_sync)
- integration = Integration.objects.create(
- team=self.team, kind="slack", config={"scope": f"chat:write,{extra_scope}"}
- )
- create_response = self.client.post(
- f"/api/projects/{self.team.id}/subscriptions",
- self._make_ai_payload(
- target_type="slack",
- target_value="C1234|#general",
- integration_id=integration.id,
+ ("slack_without_files_write", "slack", "C1234|#general", status.HTTP_201_CREATED, None),
+ (
+ "email",
+ "email",
+ status.HTTP_400_BAD_REQUEST,
+ "post_all_insights_in_main_message only applies to Slack subscriptions. "
+ "This subscription delivers to email, so remove it from delivery_config.",
),
- )
- assert create_response.status_code == status.HTTP_201_CREATED, create_response.json()
- subscription_id = create_response.json()["id"]
- # Seeded directly because create rejects the option. Rows like this predate the rule, and
- # validating the stored value would leave them impossible to edit or even to disable.
- Subscription.objects.filter(id=subscription_id).update(
- delivery_config={"post_all_insights_in_main_message": True}
- )
-
- patch_response = self.client.patch(f"/api/projects/{self.team.id}/subscriptions/{subscription_id}", patch_body)
-
- assert patch_response.status_code == status.HTTP_200_OK, patch_response.json()
-
- @parameterized.expand(
- [
- ("email", "email", "[email protected]"),
- ("slack", "slack", "C1234|#general"),
]
)
- def test_gallery_option_is_rejected_on_prompt_create(
- self, mock_is_cloud, mock_flag, mock_sync, _name, target_type, target_value
+ def test_gallery_option_on_prompt_create(
+ self, mock_is_cloud, mock_flag, mock_sync, _name, target_type, target_value, expected_status, expected_detail
):
self._enable_ai()
self._mock_temporal(mock_sync)
overrides: dict = {"target_type": target_type, "target_value": target_value}
if target_type == "slack":
- # files:write present, so the permission rule cannot be what rejects the request.
overrides["integration_id"] = Integration.objects.create(
- team=self.team, kind="slack", config={"scope": "chat:write,files:write"}
+ team=self.team, kind="slack", config={"scope": "chat:write"}
).id
response = self.client.post(
@@ -4314,15 +4280,17 @@ class TestAISubscriptionAPI(APILicensedTest):
self._make_ai_payload(delivery_config={"post_all_insights_in_main_message": True}, **overrides),
)
- assert response.status_code == status.HTTP_400_BAD_REQUEST, response.json()
- assert response.json()["detail"] == GALLERY_ON_PROMPT_ERROR
+ assert response.status_code == expected_status, response.json()
+ if expected_detail:
+ assert response.json()["detail"] == expected_detail
+ else:
+ subscription = Subscription.objects.get(id=response.json()["id"])
+ assert subscription.delivery_config["post_all_insights_in_main_message"] is True
- def test_gallery_option_is_rejected_on_prompt_patch(self, mock_is_cloud, mock_flag, mock_sync):
+ def test_gallery_option_is_accepted_on_prompt_patch_without_files_write(self, mock_is_cloud, mock_flag, mock_sync):
self._enable_ai()
self._mock_temporal(mock_sync)
- integration = Integration.objects.create(
- team=self.team, kind="slack", config={"scope": "chat:write,files:write"}
- )
+ integration = Integration.objects.create(team=self.team, kind="slack", config={"scope": "chat:write"})
create_response = self.client.post(
f"/api/projects/{self.team.id}/subscriptions",
self._make_ai_payload(
@@ -4332,14 +4300,16 @@ class TestAISubscriptionAPI(APILicensedTest):
),
)
assert create_response.status_code == status.HTTP_201_CREATED, create_response.json()
+ subscription_id = create_response.json()["id"]
patch_response = self.client.patch(
- f"/api/projects/{self.team.id}/subscriptions/{create_response.json()['id']}",
+ f"/api/projects/{self.team.id}/subscriptions/{subscription_id}",
{"delivery_config": {"post_all_insights_in_main_message": True}},
)
- assert patch_response.status_code == status.HTTP_400_BAD_REQUEST, patch_response.json()
- assert patch_response.json()["detail"] == GALLERY_ON_PROMPT_ERROR
+ assert patch_response.status_code == status.HTTP_200_OK, patch_response.json()
+ subscription = Subscription.objects.get(id=subscription_id)
+ assert subscription.delivery_config["post_all_insights_in_main_message"] is True
def test_gallery_option_is_accepted_as_false_on_a_prompt_subscription(self, mock_is_cloud, mock_flag, mock_sync):
self._enable_ai()
diff --git a/products/subscriptions/frontend/components/Subscriptions/AiPromptFields.tsx b/products/subscriptions/frontend/components/Subscriptions/AiPromptFields.tsx
index cbb4a2873165..8d79cab1bef3 100644
--- a/products/subscriptions/frontend/components/Subscriptions/AiPromptFields.tsx
+++ b/products/subscriptions/frontend/components/Subscriptions/AiPromptFields.tsx
@@ -294,6 +294,35 @@ export function AiPromptFields({
/>
)
})}
+ {targetType === 'slack' && (
+ <LemonSwitch
+ checked={Boolean(deliveryConfig?.post_all_insights_in_main_message)}
+ onChange={(enabled) =>
+ onChange({
+ ...deliveryConfig,
+ post_all_insights_in_main_message: enabled,
+ })
+ }
+ disabledReason={
+ getAiSubscriptionDisplayOptionState(deliveryConfig, 'images')
+ ? undefined
+ : 'Turn on chart images to choose where charts go.'
+ }
+ bordered
+ fullWidth
+ data-attr="ai-subscription-post-all-insights-in-main-message"
+ label={
+ <div className="flex flex-col gap-1 py-1">
+ <div className="leading-tight">
+ Post all charts in the main message
+ </div>
+ <div className="text-xs text-secondary font-normal leading-tight">
+ When off, charts go in the first thread reply.
+ </div>
+ </div>
+ }
+ />
+ )}
</div>
),
},
diff --git a/products/subscriptions/frontend/components/Subscriptions/utils.test.ts b/products/subscriptions/frontend/components/Subscriptions/utils.test.ts
index e230af7e591d..ba9437808704 100644
--- a/products/subscriptions/frontend/components/Subscriptions/utils.test.ts
+++ b/products/subscriptions/frontend/components/Subscriptions/utils.test.ts
@@ -297,10 +297,10 @@ describe('Slack gallery delivery config', () => {
false,
],
[
- 'removes the flag for a prompt subscription',
+ 'keeps the flag for a prompt subscription without files:write',
subscription({ resource_type: 'ai_prompt' }),
- [slackIntegration(7, 'files:write')],
- false,
+ [slackIntegration(7, 'chat:write')],
+ true,
],
['removes the flag when the loaded integration is missing', subscription({}), [], false],
['preserves the flag while integrations are unresolved', subscription({}), null, true],
diff --git a/products/subscriptions/frontend/components/Subscriptions/utils.tsx b/products/subscriptions/frontend/components/Subscriptions/utils.tsx
index 76a9e98f4fb4..e5acf13ce228 100644
--- a/products/subscriptions/frontend/components/Subscriptions/utils.tsx
+++ b/products/subscriptions/frontend/components/Subscriptions/utils.tsx
@@ -331,15 +331,11 @@ export function coerceDeliveryConfigForScope(
if (!deliveryConfig?.post_all_insights_in_main_message) {
return deliveryConfig
}
- // A prompt report always posts its charts in the main message, so the API rejects this option
- // and the form hides its toggle. Without this the stored flag has no control that can clear it.
- if (subscription.resource_type === SubscriptionResourceTypes.AiPrompt) {
- return { ...deliveryConfig, post_all_insights_in_main_message: false }
- }
if (subscription.target_type !== 'slack') {
return { ...deliveryConfig, post_all_insights_in_main_message: false }
}
- if (integrations == null) {
+ // A prompt report links its chart images instead of uploading them, so it needs no file upload permission.
+ if (subscription.resource_type === SubscriptionResourceTypes.AiPrompt || integrations == null) {
return deliveryConfig
}
diff --git a/products/subscriptions/frontend/generated/api.schemas.ts b/products/subscriptions/frontend/generated/api.schemas.ts
index 5ac82d8fbe88..de4d9849eb6b 100644
--- a/products/subscriptions/frontend/generated/api.schemas.ts
+++ b/products/subscriptions/frontend/generated/api.schemas.ts
@@ -203,7 +203,7 @@ export interface UserBasicApi {
* Typed view over the Subscription.delivery_config JSON blob.
*/
export interface DeliveryConfigApi {
- /** Slack insight and dashboard subscriptions only: when true, upload all insight images together in the main Slack message instead of posting the first image in the main message and the rest as threaded replies. Defaults to false. The request is rejected when target_type is not 'slack', when the subscription sets prompt instead of insight or dashboard, or when the Slack integration does not hold the files:write permission. Omit it unless the user asks for one combined message. */
+ /** Slack subscriptions only. Insight and dashboard subscriptions: when true, upload all insight images together in the main Slack message instead of posting the first image in the main message and the rest as threaded replies. Prompt subscriptions: when true, post the chart images in the main message with the summary; when false, post them in the first thread reply. Defaults to false. The request is rejected when target_type is not 'slack', or when an insight or dashboard subscription's Slack integration does not hold the files:write permission. Omit it unless the user asks for all images or charts in the main message. */
post_all_insights_in_main_message?: boolean
/** Prompt subscriptions only: include generated chart images. Defaults to true when omitted. The request is rejected when the subscription sets insight or dashboard instead of prompt. It does not control the AI summary on an insight or dashboard subscription: use summary_enabled and summary_prompt_guide for that. */
include_images?: boolean
diff --git a/products/subscriptions/frontend/generated/api.zod.ts b/products/subscriptions/frontend/generated/api.zod.ts
index e9341023e557..0487274fa6f1 100644
--- a/products/subscriptions/frontend/generated/api.zod.ts
+++ b/products/subscriptions/frontend/generated/api.zod.ts
@@ -210,7 +210,7 @@ export const SubscriptionsCreateBody = /* @__PURE__ */ zod
.boolean()
.default(subscriptionsCreateBodyDeliveryConfigOnePostAllInsightsInMainMessageDefault)
.describe(
- "Slack insight and dashboard subscriptions only: when true, upload all insight images together in the main Slack message instead of posting the first image in the main message and the rest as threaded replies. Defaults to false. The request is rejected when target_type is not 'slack', when the subscription sets prompt instead of insight or dashboard, or when the Slack integration does not hold the files:write permission. Omit it unless the user asks for one combined message."
+ "Slack subscriptions only. Insight and dashboard subscriptions: when true, upload all insight images together in the main Slack message instead of posting the first image in the main message and the rest as threaded replies. Prompt subscriptions: when true, post the chart images in the main message with the summary; when false, post them in the first thread reply. Defaults to false. The request is rejected when target_type is not 'slack', or when an insight or dashboard subscription's Slack integration does not hold the files:write permission. Omit it unless the user asks for all images or charts in the main message."
),
include_images: zod
.boolean()
@@ -446,7 +446,7 @@ export const SubscriptionsUpdateBody = /* @__PURE__ */ zod
.boolean()
.default(subscriptionsUpdateBodyDeliveryConfigOnePostAllInsightsInMainMessageDefault)
.describe(
- "Slack insight and dashboard subscriptions only: when true, upload all insight images together in the main Slack message instead of posting the first image in the main message and the rest as threaded replies. Defaults to false. The request is rejected when target_type is not 'slack', when the subscription sets prompt instead of insight or dashboard, or when the Slack integration does not hold the files:write permission. Omit it unless the user asks for one combined message."
+ "Slack subscriptions only. Insight and dashboard subscriptions: when true, upload all insight images together in the main Slack message instead of posting the first image in the main message and the rest as threaded replies. Prompt subscriptions: when true, post the chart images in the main message with the summary; when false, post them in the first thread reply. Defaults to false. The request is rejected when target_type is not 'slack', or when an insight or dashboard subscription's Slack integration does not hold the files:write permission. Omit it unless the user asks for all images or charts in the main message."
),
include_images: zod
.boolean()
@@ -687,7 +687,7 @@ export const SubscriptionsPartialUpdateBody = /* @__PURE__ */ zod
.boolean()
.default(subscriptionsPartialUpdateBodyDeliveryConfigOnePostAllInsightsInMainMessageDefault)
.describe(
- "Slack insight and dashboard subscriptions only: when true, upload all insight images together in the main Slack message instead of posting the first image in the main message and the rest as threaded replies. Defaults to false. The request is rejected when target_type is not 'slack', when the subscription sets prompt instead of insight or dashboard, or when the Slack integration does not hold the files:write permission. Omit it unless the user asks for one combined message."
+ "Slack subscriptions only. Insight and dashboard subscriptions: when true, upload all insight images together in the main Slack message instead of posting the first image in the main message and the rest as threaded replies. Prompt subscriptions: when true, post the chart images in the main message with the summary; when false, post them in the first thread reply. Defaults to false. The request is rejected when target_type is not 'slack', or when an insight or dashboard subscription's Slack integration does not hold the files:write permission. Omit it unless the user asks for all images or charts in the main message."
),
include_images: zod
.boolean()
diff --git a/products/subscriptions/skills/managing-subscriptions/references/destinations.md b/products/subscriptions/skills/managing-subscriptions/references/destinations.md
index 1699b84a0879..30e02e34a3b3 100644
--- a/products/subscriptions/skills/managing-subscriptions/references/destinations.md
+++ b/products/subscriptions/skills/managing-subscriptions/references/destinations.md
@@ -34,9 +34,13 @@ The default is `false`.
PostHog sends the first image in the main message and the rest in a thread.
Set the option to `true` to send all images in the main message.
-This option requires the Slack `files:write` permission.
+Only dashboard snapshots need the Slack `files:write` permission for this option.
It does not apply to email or Teams.
+For AI prompt reports, the same option controls where the chart images go in Slack.
+With the default `false`, the main message holds the summary and the charts go in the first thread reply.
+Set it to `true` to post the charts in the main message.
+
## Microsoft Teams
1. Ask the user to add the Workflows app to the target channel.
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 8ec925d31867..8329cd27c770 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -34004,7 +34004,7 @@ export namespace Schemas {
* Typed view over the Subscription.delivery_config JSON blob.
*/
export interface DeliveryConfig {
- /** Slack insight and dashboard subscriptions only: when true, upload all insight images together in the main Slack message instead of posting the first image in the main message and the rest as threaded replies. Defaults to false. The request is rejected when target_type is not 'slack', when the subscription sets prompt instead of insight or dashboard, or when the Slack integration does not hold the files:write permission. Omit it unless the user asks for one combined message. */
+ /** Slack subscriptions only. Insight and dashboard subscriptions: when true, upload all insight images together in the main Slack message instead of posting the first image in the main message and the rest as threaded replies. Prompt subscriptions: when true, post the chart images in the main message with the summary; when false, post them in the first thread reply. Defaults to false. The request is rejected when target_type is not 'slack', or when an insight or dashboard subscription's Slack integration does not hold the files:write permission. Omit it unless the user asks for all images or charts in the main message. */
post_all_insights_in_main_message?: boolean;
/** Prompt subscriptions only: include generated chart images. Defaults to true when omitted. The request is rejected when the subscription sets insight or dashboard instead of prompt. It does not control the AI summary on an insight or dashboard subscription: use summary_enabled and summary_prompt_guide for that. */
include_images?: boolean;
diff --git a/services/mcp/src/generated/subscriptions/api.ts b/services/mcp/src/generated/subscriptions/api.ts
index 5450e9207264..0d90af994408 100644
--- a/services/mcp/src/generated/subscriptions/api.ts
+++ b/services/mcp/src/generated/subscriptions/api.ts
@@ -231,7 +231,7 @@ export const SubscriptionsCreateBody = () => zod
.boolean()
.default(subscriptionsCreateBodyDeliveryConfigOnePostAllInsightsInMainMessageDefault)
.describe(
- "Slack insight and dashboard subscriptions only: when true, upload all insight images together in the main Slack message instead of posting the first image in the main message and the rest as threaded replies. Defaults to false. The request is rejected when target_type is not 'slack', when the subscription sets prompt instead of insight or dashboard, or when the Slack integration does not hold the files:write permission. Omit it unless the user asks for one combined message."
+ "Slack subscriptions only. Insight and dashboard subscriptions: when true, upload all insight images together in the main Slack message instead of posting the first image in the main message and the rest as threaded replies. Prompt subscriptions: when true, post the chart images in the main message with the summary; when false, post them in the first thread reply. Defaults to false. The request is rejected when target_type is not 'slack', or when an insight or dashboard subscription's Slack integration does not hold the files:write permission. Omit it unless the user asks for all images or charts in the main message."
),
include_images: zod
.boolean()
@@ -461,7 +461,7 @@ export const SubscriptionsPartialUpdateBody = () => zod
.boolean()
.default(subscriptionsPartialUpdateBodyDeliveryConfigOnePostAllInsightsInMainMessageDefault)
.describe(
- "Slack insight and dashboard subscriptions only: when true, upload all insight images together in the main Slack message instead of posting the first image in the main message and the rest as threaded replies. Defaults to false. The request is rejected when target_type is not 'slack', when the subscription sets prompt instead of insight or dashboard, or when the Slack integration does not hold the files:write permission. Omit it unless the user asks for one combined message."
+ "Slack subscriptions only. Insight and dashboard subscriptions: when true, upload all insight images together in the main Slack message instead of posting the first image in the main message and the rest as threaded replies. Prompt subscriptions: when true, post the chart images in the main message with the summary; when false, post them in the first thread reply. Defaults to false. The request is rejected when target_type is not 'slack', or when an insight or dashboard subscription's Slack integration does not hold the files:write permission. Omit it unless the user asks for all images or charts in the main message."
),
include_images: zod
.boolean()
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/subscriptions-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/subscriptions-create.json
index 231c4b9e608e..de6d731675b5 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/subscriptions-create.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/subscriptions-create.json
@@ -127,7 +127,7 @@
},
"post_all_insights_in_main_message": {
"default": false,
- "description": "Slack insight and dashboard subscriptions only: when true, upload all insight images together in the main Slack message instead of posting the first image in the main message and the rest as threaded replies. Defaults to false. The request is rejected when target_type is not 'slack', when the subscription sets prompt instead of insight or dashboard, or when the Slack integration does not hold the files:write permission. Omit it unless the user asks for one combined message.",
+ "description": "Slack subscriptions only. Insight and dashboard subscriptions: when true, upload all insight images together in the main Slack message instead of posting the first image in the main message and the rest as threaded replies. Prompt subscriptions: when true, post the chart images in the main message with the summary; when false, post them in the first thread reply. Defaults to false. The request is rejected when target_type is not 'slack', or when an insight or dashboard subscription's Slack integration does not hold the files:write permission. Omit it unless the user asks for all images or charts in the main message.",
"type": "boolean"
}
},
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/subscriptions-partial-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/subscriptions-partial-update.json
index 1aa5fb54226f..a116c62eaacd 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/subscriptions-partial-update.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/subscriptions-partial-update.json
@@ -126,7 +126,7 @@
},
"post_all_insights_in_main_message": {
"default": false,
- "description": "Slack insight and dashboard subscriptions only: when true, upload all insight images together in the main Slack message instead of posting the first image in the main message and the rest as threaded replies. Defaults to false. The request is rejected when target_type is not 'slack', when the subscription sets prompt instead of insight or dashboard, or when the Slack integration does not hold the files:write permission. Omit it unless the user asks for one combined message.",
+ "description": "Slack subscriptions only. Insight and dashboard subscriptions: when true, upload all insight images together in the main Slack message instead of posting the first image in the main message and the rest as threaded replies. Prompt subscriptions: when true, post the chart images in the main message with the summary; when false, post them in the first thread reply. Defaults to false. The request is rejected when target_type is not 'slack', or when an insight or dashboard subscription's Slack integration does not hold the files:write permission. Omit it unless the user asks for all images or charts in the main message.",
"type": "boolean"
}
},