Skip to content

Commit aa79ef9

Browse files
committed
update docs and sample data
1 parent e477377 commit aa79ef9

2 files changed

Lines changed: 30 additions & 1 deletion

File tree

api/webhooks/webhooks.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
from core.signing import sign_payload
1919
from environments.models import Environment, Webhook
2020
from features.models import Feature
21+
from features.multivariate.models import (
22+
MultivariateFeatureOption,
23+
MultivariateFeatureStateValue,
24+
)
2125
from organisations.models import OrganisationWebhook
2226
from projects.models import ( # type: ignore[attr-defined]
2327
Organisation,
@@ -328,6 +332,19 @@ def generate_environment_sample_webhook_data() -> dict[str, Any]:
328332
),
329333
)
330334

335+
mv_option = MultivariateFeatureOption(
336+
id=1,
337+
feature=feature,
338+
default_percentage_allocation=50,
339+
type="unicode",
340+
string_value="variant_a",
341+
)
342+
mv_state_value = MultivariateFeatureStateValue(
343+
id=1,
344+
multivariate_feature_option=mv_option,
345+
percentage_allocation=50,
346+
)
347+
331348
data = {
332349
"changed_by": "user@domain.com",
333350
"timestamp": "2021-06-18T07:50:26.595298Z",
@@ -338,6 +355,7 @@ def generate_environment_sample_webhook_data() -> dict[str, Any]:
338355
value="feature_state_value",
339356
identity_id=1,
340357
identity_identifier="test_identity",
358+
multivariate_feature_state_values=[mv_state_value],
341359
),
342360
"previous_state": Webhook.generate_webhook_feature_state_data(
343361
feature=feature,
@@ -346,6 +364,7 @@ def generate_environment_sample_webhook_data() -> dict[str, Any]:
346364
value="old_feature_state_value",
347365
identity_id=1,
348366
identity_identifier="test_identity",
367+
multivariate_feature_state_values=[mv_state_value],
349368
),
350369
}
351370

docs/docs/administration-and-security/platform-configuration/environment-settings.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,17 @@ Flagsmith will send a `POST` request to your webhook URL with the following payl
7575
"feature_segment": null,
7676
"feature_state_value": "<strong>\nYou are using the develop environment.\n</strong>",
7777
"identity": null,
78-
"identity_identifier": null
78+
"identity_identifier": null,
79+
"multivariate_feature_state_values": [
80+
{
81+
"id": 1,
82+
"multivariate_feature_option": {
83+
"id": 10,
84+
"value": "variant_a"
85+
},
86+
"percentage_allocation": 50
87+
}
88+
]
7989
},
8090
"previous_state": {
8191
"enabled": false,

0 commit comments

Comments
 (0)