Skip to content

Add FLAG_CREATED webhook event#7900

Draft
Dexter2099 wants to merge 2 commits into
Flagsmith:mainfrom
Dexter2099:codex/7849-flag-created-webhook
Draft

Add FLAG_CREATED webhook event#7900
Dexter2099 wants to merge 2 commits into
Flagsmith:mainfrom
Dexter2099:codex/7849-flag-created-webhook

Conversation

@Dexter2099

Copy link
Copy Markdown

What changed

  • Add FLAG_CREATED as a distinct webhook event type for feature creation.
  • Infer FLAG_CREATED for initial environment-default feature states created for a new feature.
  • Preserve FLAG_UPDATED for updates, segment overrides, identity/change-request/scheduled states, and environment-created initial states.
  • Allow FLAG_CREATED, FLAG_DELETED, and NEW_VERSION_PUBLISHED through the webhook serializer so event types are not dropped.
  • Route v2 feature creation through the webhook path while keeping normal v2 version-published changes on the existing version webhook path.
  • Update environment webhook documentation.

Why

Environment webhook consumers currently cannot reliably distinguish feature creation from other flag updates. This adds the narrow event-type distinction needed by consumers that run creation-only automation.

Fixes #7849

Validation

  • uv run pytest tests/unit/features/test_unit_features_tasks.py tests/unit/audit/test_unit_audit_signals.py::test_trigger_feature_state_change_webhooks__feature_state_update__triggers_webhook tests/unit/audit/test_unit_audit_signals.py::test_trigger_feature_state_change_webhooks__versioned_environment__skips_webhook tests/unit/audit/test_unit_audit_signals.py::test_trigger_feature_state_change_webhooks__versioned_environment_feature_created__triggers_webhook tests/unit/webhooks/test_unit_webhooks.py::test_webhook_serializer__flag_created_event_type__is_valid -q
  • uv run ruff check audit/signals.py features/models.py features/tasks.py webhooks/webhooks.py webhooks/serializers.py tests/unit/features/test_unit_features_tasks.py tests/unit/audit/test_unit_audit_signals.py tests/unit/webhooks/test_unit_webhooks.py
  • uv run mypy audit/signals.py features/models.py features/tasks.py webhooks/webhooks.py webhooks/serializers.py tests/unit/features/test_unit_features_tasks.py tests/unit/audit/test_unit_audit_signals.py tests/unit/webhooks/test_unit_webhooks.py
  • git diff --check

Note

The installed pre-commit/pre-push hooks could not initialise flagsmith-common on Git for Windows because that hook repository contains filenames with :. The commit and push used --no-verify after running the focused checks above locally.

@vercel

vercel Bot commented Jun 28, 2026

Copy link
Copy Markdown

@Dexter2099 is attempting to deploy a commit to the Flagsmith Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api Issue related to the REST API docs Documentation updates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a distinct FLAG_CREATED webhook event (or include the action type in webhook payloads)

1 participant