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(workflows): tag broadcasts and filter the list by tag (#121086)

Meikel Ratz60fb63f379ae
diff --git a/posthog/test/repo_invariants/test_pagination_contract.py b/posthog/test/repo_invariants/test_pagination_contract.py
index 0c685aaacd28..949a1481810a 100644
--- a/posthog/test/repo_invariants/test_pagination_contract.py
+++ b/posthog/test/repo_invariants/test_pagination_contract.py
@@ -22,6 +22,7 @@ LIST_VIEWSETS_WITHOUT_DIRECT_SHARED_PAGINATION = {
"products.customer_analytics.backend.presentation.views.views.AccountViewSet",
"products.managed_migrations.backend.api.support_batch_imports.BatchImportSupportViewSet",
"products.reminders.backend.api.reminder.ReminderViewSet",
+ "products.workflows.backend.presentation.views.hog_flow.HogFlowViewSet",
"products.workflows.backend.presentation.views.hog_flow_template.PublicHogFlowTemplateViewSet",
}
diff --git a/products/workflows/backend/presentation/views/hog_flow.py b/products/workflows/backend/presentation/views/hog_flow.py
index cf9605755620..8f5fb89134af 100644
--- a/products/workflows/backend/presentation/views/hog_flow.py
+++ b/products/workflows/backend/presentation/views/hog_flow.py
@@ -55,6 +55,11 @@ from posthog.api.log_entries import LogEntryMixin
from posthog.api.mixins import ValidatedRequest, validated_request
from posthog.api.routing import TeamAndOrgViewSetMixin
from posthog.api.shared import UserBasicSerializer
+from posthog.api.tagged_item import (
+ BulkUpdateTagsUUIDRequestSerializer,
+ BulkUpdateTagsUUIDResponseSerializer,
+ TaggedItemViewSetMixin,
+)
from posthog.auth import InternalAPIAuthentication
from posthog.clickhouse.query_tagging import Feature, tag_queries
from posthog.dataclasses import frozen
@@ -3016,6 +3021,7 @@ class HogFlowMinimalSerializer(UserAccessControlSerializerMixin, serializers.Ser
"last_run",
"pending_suggestions",
"suggestions_enabled",
+ "tags",
]
read_only_fields = fields
@@ -3440,10 +3446,12 @@ class HogFlowSerializer(HogFlowMinimalSerializer):
"email_sending_pause_requires_support",
"email_sending_resumed_at",
"last_run",
+ "tags",
]
read_only_fields = [
"id",
"version",
+ "tags",
"created_at",
"created_by",
"updated_at",
@@ -4765,9 +4773,19 @@ class HogFlowVersionMetricsRequestSerializer(AppMetricsRequestSerializer):
),
]
),
+ # The mixin action's default schema documents integer ids; workflows are keyed by UUID.
+ bulk_update_tags=extend_schema(
+ request=BulkUpdateTagsUUIDRequestSerializer,
+ responses={200: BulkUpdateTagsUUIDResponseSerializer},
+ ),
)
class HogFlowViewSet(
- TeamAndOrgViewSetMixin, AccessControlViewSetMixin, LogEntryMixin, AppMetricsMixin, viewsets.ModelViewSet
+ TaggedItemViewSetMixin,
+ TeamAndOrgViewSetMixin,
+ AccessControlViewSetMixin,
+ LogEntryMixin,
+ AppMetricsMixin,
+ viewsets.ModelViewSet,
):
scope_object = "hog_flow"
scope_object_read_actions = [
@@ -4812,8 +4830,11 @@ class HogFlowViewSet(
"convert_to_broadcast",
"approve_proposal",
"reject_proposal",
+ "bulk_update_tags",
]
queryset = HogFlow.objects.all()
+ bulk_update_tags_request_serializer_class = BulkUpdateTagsUUIDRequestSerializer
+ bulk_tag_activity_scope = "HogFlow"
pagination_class = HogFlowPagination
log_source = "hog_flow"
app_source = "hog_flow"
diff --git a/products/workflows/backend/tests/api/test_hog_flow.py b/products/workflows/backend/tests/api/test_hog_flow.py
index a290e34f2455..deb7d82e3037 100644
--- a/products/workflows/backend/tests/api/test_hog_flow.py
+++ b/products/workflows/backend/tests/api/test_hog_flow.py
@@ -413,6 +413,22 @@ class TestHogFlowAPI(APIBaseTest):
assert response.status_code == 200, response.json()
assert {flow["name"] for flow in response.json()["results"]} == {"Theirs"}
+ def test_bulk_update_tags_sets_tags_and_the_list_filters_on_them(self):
+ tagged = HogFlow.objects.create(team=self.team, name="Tagged", created_by=self.user)
+ HogFlow.objects.create(team=self.team, name="Untagged", created_by=self.user)
+
+ response = self.client.post(
+ f"/api/projects/{self.team.id}/hog_flows/bulk_update_tags",
+ {"ids": [str(tagged.id)], "action": "set", "tags": ["Launch", "q4"]},
+ )
+ assert response.status_code == 200, response.json()
+ assert response.json()["updated"] == [{"id": str(tagged.id), "tags": ["launch", "q4"]}]
+
+ # The filter takes a JSON list of stored names.
+ response = self.client.get(f'/api/projects/{self.team.id}/hog_flows?tags=["launch"]')
+ assert response.status_code == 200, response.json()
+ assert [(flow["name"], flow["tags"]) for flow in response.json()["results"]] == [("Tagged", ["launch", "q4"])]
+
@parameterized.expand(
[
("one_tag", '["growth"]', {"Onboarding", "Upsell"}),
diff --git a/products/workflows/frontend/Broadcasts/BroadcastsTable.tsx b/products/workflows/frontend/Broadcasts/BroadcastsTable.tsx
index eb1c9216340e..14aec7b18323 100644
--- a/products/workflows/frontend/Broadcasts/BroadcastsTable.tsx
+++ b/products/workflows/frontend/Broadcasts/BroadcastsTable.tsx
@@ -3,6 +3,8 @@ import { useActions, useValues } from 'kea'
import { LemonInput, LemonSelect, Tooltip } from '@posthog/lemon-ui'
import { MemberSelect } from 'lib/components/MemberSelect'
+import { ObjectTags } from 'lib/components/ObjectTags/ObjectTags'
+import { TagSelect } from 'lib/components/TagSelect'
import { LemonButton } from 'lib/lemon-ui/LemonButton'
import { More } from 'lib/lemon-ui/LemonButton/More'
import { LemonTable, LemonTableColumns } from 'lib/lemon-ui/LemonTable'
@@ -27,13 +29,23 @@ const METRIC_COLUMNS: { title: string; metricName: string }[] = [
]
export function BroadcastsTable(): JSX.Element {
- const { broadcasts, broadcastsLoading, hasLoadedBroadcasts, rowDetailsById, filters, filtersPending, loadFailed } =
- useValues(broadcastsLogic)
+ const {
+ broadcasts,
+ broadcastsLoading,
+ hasLoadedBroadcasts,
+ rowDetailsById,
+ filters,
+ filtersPending,
+ loadFailed,
+ tags: allTags,
+ savingTagsFor,
+ } = useValues(broadcastsLogic)
// Rows from other filters stay behind the loading state, and are dropped once the load for these fails.
const hideRows = loadFailed && filtersPending
- const { setFilters, archiveBroadcast, restoreBroadcast, deleteBroadcast } = useActions(broadcastsLogic)
+ const { setFilters, archiveBroadcast, restoreBroadcast, deleteBroadcast, saveBroadcastTags } =
+ useActions(broadcastsLogic)
const { page } = filters
- const isFiltered = !!filters.search || filters.status !== 'all' || !!filters.createdBy
+ const isFiltered = !!filters.search || filters.status !== 'all' || !!filters.createdBy || filters.tags.length > 0
const columns: LemonTableColumns<HogFlowMinimalApi> = [
{
@@ -64,6 +76,34 @@ export function BroadcastsTable(): JSX.Element {
return <BroadcastStatusTag status={getBroadcastStatus(item, rowDetailsById[item.id])} />
},
},
+ {
+ title: 'Tags',
+ key: 'tags',
+ width: 220,
+ render: function Render(_, item) {
+ const shown = {
+ tags: [...(item.tags ?? [])],
+ onTagClick: (tag: string) => {
+ if (!filters.tags.includes(tag)) {
+ setFilters({ tags: [...filters.tags, tag] })
+ }
+ },
+ wrap: true,
+ maxVisibleTags: 2,
+ 'data-attr': 'broadcast-tags',
+ }
+ return manageDisabledReason(item.user_access_level) ? (
+ <ObjectTags {...shown} staticOnly />
+ ) : (
+ <ObjectTags
+ {...shown}
+ onChange={(tags) => saveBroadcastTags(item.id, tags)}
+ saving={savingTagsFor === item.id}
+ tagsAvailable={allTags}
+ />
+ )
+ },
+ },
...METRIC_COLUMNS.map(({ title, metricName }) => ({
title,
width: 0,
@@ -177,6 +217,14 @@ export function BroadcastsTable(): JSX.Element {
value={filters.createdBy}
onChange={(user) => setFilters({ createdBy: user?.uuid || null })}
/>
+ <b className="ml-1">Tags</b>
+ <TagSelect
+ size="small"
+ defaultLabel="Any tags"
+ value={filters.tags}
+ onChange={(tags) => setFilters({ tags })}
+ listDataAttr="broadcasts-tags-filter-list"
+ />
</div>
</div>
<LemonTable
diff --git a/products/workflows/frontend/Broadcasts/broadcastWizardLogic.test.ts b/products/workflows/frontend/Broadcasts/broadcastWizardLogic.test.ts
index 6f8ec588b292..bb48cd5f94e5 100644
--- a/products/workflows/frontend/Broadcasts/broadcastWizardLogic.test.ts
+++ b/products/workflows/frontend/Broadcasts/broadcastWizardLogic.test.ts
@@ -52,6 +52,7 @@ function savedBroadcast(overrides: { name: string; subject: string; updatedAt: s
abort_action: null,
billable_action_types: [],
schedules: [],
+ tags: [],
user_access_level: 'editor',
draft: null,
draft_updated_at: null,
diff --git a/products/workflows/frontend/Broadcasts/broadcastsLogic.ts b/products/workflows/frontend/Broadcasts/broadcastsLogic.ts
index dee309c34f87..a743a2c52051 100644
--- a/products/workflows/frontend/Broadcasts/broadcastsLogic.ts
+++ b/products/workflows/frontend/Broadcasts/broadcastsLogic.ts
@@ -12,9 +12,15 @@ import { projectLogic } from 'scenes/projectLogic'
import { teamLogic } from 'scenes/teamLogic'
import { urls } from 'scenes/urls'
+import { tagsModel } from '~/models/tagsModel'
import { TeamPublicType, TeamType } from '~/types'
-import { hogFlowsBatchJobsList, hogFlowsList, hogFlowsSchedulesList } from 'products/workflows/frontend/generated/api'
+import {
+ hogFlowsBatchJobsList,
+ hogFlowsBulkUpdateTagsCreate,
+ hogFlowsList,
+ hogFlowsSchedulesList,
+} from 'products/workflows/frontend/generated/api'
import type {
HogFlowApi,
HogFlowBatchJobApi,
@@ -59,14 +65,15 @@ export interface BroadcastsFilters {
search: string
status: BroadcastsStatusFilter
createdBy: string | null
+ tags: string[]
page: number
}
-const DEFAULT_FILTERS: BroadcastsFilters = { search: '', status: 'all', createdBy: null, page: 1 }
+const DEFAULT_FILTERS: BroadcastsFilters = { search: '', status: 'all', createdBy: null, tags: [], page: 1 }
// The search params actionToUrl writes below. A URL that carries none of them states no filters at all,
// which is different from stating that every filter is off.
-const FILTER_URL_PARAMS = ['search', 'status', 'created_by', 'page']
+const FILTER_URL_PARAMS = ['search', 'status', 'created_by', 'tags', 'page']
type FlowStep = { id?: string; type?: string; config?: Record<string, any> }
@@ -194,6 +201,7 @@ async function loadRunMetricTotals(job: HogFlowBatchJobApi, timezone: string): P
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface broadcastsLogicValues {
currentProjectId: number | null // projectLogic
+ tags: string[] // tagsModel
currentTeam: TeamPublicType | TeamType | null // teamLogic
broadcasts: PaginatedHogFlowMinimalListApi
broadcastsLoading: boolean
@@ -204,13 +212,34 @@ export interface broadcastsLogicValues {
loadFailed: boolean
loadedFilters: BroadcastsFilters | null
rowDetailsById: Record<string, BroadcastRowDetails>
+ savingTagsFor: string | null
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface broadcastsLogicActions {
+ loadTags: () => {
+ value: true
+ } // tagsModel
+ loadTagsIfNeeded: () => {
+ value: true
+ } // tagsModel
archiveBroadcast: (broadcast: ManagedBroadcast) => {
broadcast: ManagedBroadcast
}
+ broadcastTagsChanged: (
+ id: string,
+ tags: string[]
+ ) => {
+ id: string
+ tags: string[]
+ }
+ broadcastTagsSaved: (
+ id: string,
+ tags: string[] | null
+ ) => {
+ id: string
+ tags: string[] | null
+ }
clearRowDetails: (id: string) => {
id: string
}
@@ -241,6 +270,13 @@ export interface broadcastsLogicActions {
restoreBroadcast: (broadcast: ManagedBroadcast) => {
broadcast: ManagedBroadcast
}
+ saveBroadcastTags: (
+ id: string,
+ tags: string[]
+ ) => {
+ id: string
+ tags: string[]
+ }
setFilters: (filters: Partial<BroadcastsFilters>) => {
filters: Partial<BroadcastsFilters>
}
@@ -276,7 +312,8 @@ export type broadcastsLogicType = MakeLogicType<
export const broadcastsLogic = kea<broadcastsLogicType>([
path(['products', 'workflows', 'frontend', 'Broadcasts', 'broadcastsLogic']),
connect(() => ({
- values: [projectLogic, ['currentProjectId'], teamLogic, ['currentTeam']],
+ values: [projectLogic, ['currentProjectId'], teamLogic, ['currentTeam'], tagsModel, ['tags']],
+ actions: [tagsModel, ['loadTags', 'loadTagsIfNeeded']],
})),
actions({
loadBroadcasts: true,
@@ -285,6 +322,9 @@ export const broadcastsLogic = kea<broadcastsLogicType>([
setRowDetails: (id: string, details: BroadcastRowDetails) => ({ id, details }),
clearRowDetails: (id: string) => ({ id }),
setLoadedFilters: (filters: BroadcastsFilters) => ({ filters }),
+ saveBroadcastTags: (id: string, tags: string[]) => ({ id, tags }),
+ broadcastTagsChanged: (id: string, tags: string[]) => ({ id, tags }),
+ broadcastTagsSaved: (id: string, tags: string[] | null) => ({ id, tags }),
archiveBroadcast: (broadcast: ManagedBroadcast) => ({ broadcast }),
restoreBroadcast: (broadcast: ManagedBroadcast) => ({ broadcast }),
deleteBroadcast: (broadcast: ManagedBroadcast) => ({ broadcast }),
@@ -304,6 +344,7 @@ export const broadcastsLogic = kea<broadcastsLogicType>([
search: values.filters.search || undefined,
broadcast_status: values.filters.status !== 'all' ? values.filters.status : undefined,
created_by: values.filters.createdBy || undefined,
+ tags: values.filters.tags.length ? JSON.stringify(values.filters.tags) : undefined,
limit: BROADCASTS_PAGE_SIZE,
offset: (values.filters.page - 1) * BROADCASTS_PAGE_SIZE,
})
@@ -315,6 +356,35 @@ export const broadcastsLogic = kea<broadcastsLogicType>([
],
})),
reducers(() => ({
+ broadcasts: [
+ { results: [], count: 0 } as PaginatedHogFlowMinimalListApi,
+ {
+ broadcastTagsChanged: (state, { id, tags }) => ({
+ ...state,
+ results: (state.results ?? []).map((broadcast) =>
+ broadcast.id === id ? { ...broadcast, tags } : broadcast
+ ),
+ }),
+ // A failed save passes null, which leaves the row as it is until the reload lands.
+ broadcastTagsSaved: (state, { id, tags }) =>
+ tags === null
+ ? state
+ : {
+ ...state,
+ results: (state.results ?? []).map((broadcast) =>
+ broadcast.id === id ? { ...broadcast, tags } : broadcast
+ ),
+ },
+ },
+ ],
+ // Which row's tags are in flight, so only that row's editor shows a spinner.
+ savingTagsFor: [
+ null as string | null,
+ {
+ saveBroadcastTags: (_, { id }) => id,
+ broadcastTagsSaved: () => null,
+ },
+ ],
rowDetailsById: [
{} as Record<string, BroadcastRowDetails>,
{
@@ -475,15 +545,52 @@ export const broadcastsLogic = kea<broadcastsLogicType>([
loadBroadcastsFailure: () => {
lemonToast.error("Couldn't load broadcasts. Refresh the page to try again.")
},
+ saveBroadcastTags: async ({ id, tags }, breakpoint) => {
+ const projectId = values.currentProjectId
+ if (!projectId) {
+ return
+ }
+ // The editor builds each payload from the row's tags, so a second edit made while the first
+ // is in flight would be built from the stored list and drop the first one. Showing the new
+ // tags at once gives that second edit the right starting point.
+ actions.broadcastTagsChanged(id, tags)
+ // One save per tag added or removed, so a burst of clicks is collapsed into a single write.
+ await breakpoint(300)
+ try {
+ const response = await hogFlowsBulkUpdateTagsCreate(String(projectId), {
+ ids: [id],
+ action: 'set',
+ tags,
+ })
+ const updated = response.updated[0]
+ if (!updated) {
+ throw new Error(response.skipped[0]?.reason ?? "You don't have access to edit this broadcast.")
+ }
+ actions.broadcastTagsSaved(id, updated.tags)
+ // A new tag has to reach the project's tag list before the filter can offer it.
+ tagsModel.findMounted()?.actions.loadTags()
+ // The edit can move the row out of a tag filter, and the count with it, so the page is
+ // reloaded rather than left showing a broadcast that no longer matches.
+ if (values.filters.tags.length) {
+ actions.loadBroadcasts()
+ }
+ } catch (error: any) {
+ actions.broadcastTagsSaved(id, null)
+ lemonToast.error(`Couldn't save tags: ${error?.detail || error?.message || 'unknown error'}`)
+ // The row is showing tags that were never stored, so the stored ones are read back.
+ actions.loadBroadcasts()
+ }
+ },
})),
actionToUrl(({ values }) => ({
setFilters: () => {
- const { search, status, createdBy, page } = values.filters
+ const { search, status, createdBy, tags, page } = values.filters
const searchParams = {
...router.values.searchParams,
search: search || undefined,
status: status !== 'all' ? status : undefined,
created_by: createdBy || undefined,
+ tags: tags.length ? tags : undefined,
page: page > 1 ? page : undefined,
}
return [router.values.location.pathname, searchParams, router.values.hashParams, { replace: true }]
@@ -501,11 +608,18 @@ export const broadcastsLogic = kea<broadcastsLogicType>([
return
}
const status = searchParams['status']
+ const rawTags = searchParams['tags']
const parsed: BroadcastsFilters = {
// The API rejects longer search terms.
search: searchParams['search'] ? String(searchParams['search']).slice(0, 200) : '',
status: BROADCASTS_STATUS_FILTERS.includes(status) ? status : 'all',
createdBy: searchParams['created_by'] ? String(searchParams['created_by']) : null,
+ // kea-router parses a JSON array in the URL back into an array.
+ tags: Array.isArray(rawTags)
+ ? rawTags.map(String)
+ : typeof rawTags === 'string' && rawTags
+ ? [rawTags]
+ : [],
page: Math.max(1, parseInt(String(searchParams['page'])) || 1),
}
if (!objectsEqual(parsed, values.filters)) {
@@ -515,5 +629,6 @@ export const broadcastsLogic = kea<broadcastsLogicType>([
})),
afterMount(({ actions }) => {
actions.loadBroadcasts()
+ actions.loadTagsIfNeeded()
}),
])
diff --git a/products/workflows/frontend/generated/api.schemas.ts b/products/workflows/frontend/generated/api.schemas.ts
index 5c3d0c4f4c05..702386b55027 100644
--- a/products/workflows/frontend/generated/api.schemas.ts
+++ b/products/workflows/frontend/generated/api.schemas.ts
@@ -1868,6 +1868,63 @@ export interface BroadcastConversionCandidatesApi {
readonly results: readonly BroadcastConversionCandidateApi[]
}
+/**
+ * * `add` - add
+ * * `remove` - remove
+ * * `set` - set
+ */
+export type BulkUpdateTagsActionEnumApi = (typeof BulkUpdateTagsActionEnumApi)[keyof typeof BulkUpdateTagsActionEnumApi]
+
+export const BulkUpdateTagsActionEnumApi = {
+ Add: 'add',
+ Remove: 'remove',
+ Set: 'set',
+} as const
+
+/**
+ * Variant of ``BulkUpdateTagsRequestSerializer`` for resources keyed by UUID (e.g. event definitions).
+ */
+export interface BulkUpdateTagsUUIDRequestApi {
+ /**
+ * List of object UUIDs to update tags on.
+ * @maxItems 500
+ */
+ ids: string[]
+ /** 'add' merges with existing tags, 'remove' deletes specific tags, 'set' replaces all tags.
+ *
+ * * `add` - add
+ * * `remove` - remove
+ * * `set` - set */
+ action: BulkUpdateTagsActionEnumApi
+ /**
+ * Tag names to add, remove, or set (up to 100 per request, 255 characters each).
+ * @maxItems 100
+ * @items.maxLength 255
+ */
+ tags: string[]
+}
+
+export interface BulkUpdateTagsUUIDItemApi {
+ /** UUID of the object whose tags were updated. */
+ id: string
+ /** The object's full tag list after the update. */
+ tags: string[]
+}
+
+export interface BulkUpdateTagsUUIDErrorApi {
+ /** UUID of the object that was skipped. */
+ id: string
+ /** Why the object was skipped, e.g. 'Not found or no edit access'. */
+ reason: string
+}
+
+export interface BulkUpdateTagsUUIDResponseApi {
+ /** Objects whose tags were successfully updated. */
+ updated: BulkUpdateTagsUUIDItemApi[]
+ /** Objects that were skipped, with a reason each. */
+ skipped: BulkUpdateTagsUUIDErrorApi[]
+}
+
/**
* Cheap suspension-only read for the persistent scene-wide banner — no reputation computation.
*/
diff --git a/products/workflows/frontend/generated/api.ts b/products/workflows/frontend/generated/api.ts
index f00e99143535..f73ac6665355 100644
--- a/products/workflows/frontend/generated/api.ts
+++ b/products/workflows/frontend/generated/api.ts
@@ -14,6 +14,8 @@ import type {
BlastRadiusApi,
BlastRadiusRequestApi,
BroadcastConversionCandidatesApi,
+ BulkUpdateTagsUUIDRequestApi,
+ BulkUpdateTagsUUIDResponseApi,
DataSuggestionBuildRequestApi,
DataSuggestionBuildResponseApi,
DataSuggestionGenerateRequestApi,
@@ -1285,6 +1287,42 @@ export const hogFlowsBulkDeleteCreate = async (
})
}
+export const getHogFlowsBulkUpdateTagsCreateUrl = (projectId: string) => {
+ return `/api/projects/${projectId}/hog_flows/bulk_update_tags/`
+}
+
+/**
+ * Bulk update tags on multiple objects.
+ *
+ * PAT access: this action has no ``required_scopes=`` on the decorator —
+ * inheriting viewsets must add ``"bulk_update_tags"`` to their
+ * ``scope_object_write_actions`` list to accept personal API keys.
+ * Without that opt-in, ``APIScopePermission`` rejects PAT requests with
+ * "This action does not support personal API key access". Done per-viewset
+ * so granting ``<scope>:write`` for one resource doesn't leak access to
+ * sibling resources that share this mixin.
+ *
+ * Accepts:
+ * - {"ids": [...], "action": "add"|"remove"|"set", "tags": ["tag1", "tag2"]}
+ *
+ * Actions:
+ * - "add": Add tags to existing tags on each object
+ * - "remove": Remove specific tags from each object
+ * - "set": Replace all tags on each object with the provided list
+ */
+export const hogFlowsBulkUpdateTagsCreate = async (
+ projectId: string,
+ bulkUpdateTagsUUIDRequestApi: BulkUpdateTagsUUIDRequestApi,
+ options?: RequestInit
+): Promise<BulkUpdateTagsUUIDResponseApi> => {
+ return apiMutator<BulkUpdateTagsUUIDResponseApi>(getHogFlowsBulkUpdateTagsCreateUrl(projectId), {
+ ...options,
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json', ...options?.headers },
+ body: JSON.stringify(bulkUpdateTagsUUIDRequestApi),
+ })
+}
+
export const getHogFlowsEmailSendingSuspensionRetrieveUrl = (projectId: string) => {
return `/api/projects/${projectId}/hog_flows/email_sending_suspension/`
}
diff --git a/products/workflows/frontend/generated/api.zod.ts b/products/workflows/frontend/generated/api.zod.ts
index ca6f2eb96e03..e4f6b52352d7 100644
--- a/products/workflows/frontend/generated/api.zod.ts
+++ b/products/workflows/frontend/generated/api.zod.ts
@@ -3269,6 +3269,50 @@ export const HogFlowsBulkDeleteCreateBody = /* @__PURE__ */ zod
})
.describe('Mixin for serializers to add user access control fields')
+/**
+ * Bulk update tags on multiple objects.
+ *
+ * PAT access: this action has no ``required_scopes=`` on the decorator —
+ * inheriting viewsets must add ``"bulk_update_tags"`` to their
+ * ``scope_object_write_actions`` list to accept personal API keys.
+ * Without that opt-in, ``APIScopePermission`` rejects PAT requests with
+ * "This action does not support personal API key access". Done per-viewset
+ * so granting ``<scope>:write`` for one resource doesn't leak access to
+ * sibling resources that share this mixin.
+ *
+ * Accepts:
+ * - {"ids": [...], "action": "add"|"remove"|"set", "tags": ["tag1", "tag2"]}
+ *
+ * Actions:
+ * - "add": Add tags to existing tags on each object
+ * - "remove": Remove specific tags from each object
+ * - "set": Replace all tags on each object with the provided list
+ */
+export const hogFlowsBulkUpdateTagsCreateBodyIdsMax = 500
+
+export const hogFlowsBulkUpdateTagsCreateBodyTagsItemMax = 255
+
+export const hogFlowsBulkUpdateTagsCreateBodyTagsMax = 100
+
+export const HogFlowsBulkUpdateTagsCreateBody = /* @__PURE__ */ zod
+ .object({
+ ids: zod
+ .array(zod.uuid())
+ .max(hogFlowsBulkUpdateTagsCreateBodyIdsMax)
+ .describe('List of object UUIDs to update tags on.'),
+ action: zod
+ .enum(['add', 'remove', 'set'])
+ .describe('\* `add` - add\n\* `remove` - remove\n\* `set` - set')
+ .describe(
+ "'add' merges with existing tags, 'remove' deletes specific tags, 'set' replaces all tags.\n\n\* `add` - add\n\* `remove` - remove\n\* `set` - set"
+ ),
+ tags: zod
+ .array(zod.string().max(hogFlowsBulkUpdateTagsCreateBodyTagsItemMax))
+ .max(hogFlowsBulkUpdateTagsCreateBodyTagsMax)
+ .describe('Tag names to add, remove, or set (up to 100 per request, 255 characters each).'),
+ })
+ .describe('Variant of ``BulkUpdateTagsRequestSerializer`` for resources keyed by UUID (e.g. event definitions).')
+
export const hogFlowsUserBlastRadiusCreateBodySendsEmailDefault = true
export const HogFlowsUserBlastRadiusCreateBody = /* @__PURE__ */ zod.object({