Flagsmith / Flagsmith/flagsmith

Add `identity_override_ids` Field to Webhook Payload for Managing Identity-Specific Flag Overrides

Open
#4,787 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
6.6k
Forks
567
Avg merge
1d 13h
Merged PRs (30d)
121

Description

### Is your feature request related to a problem? Please describe.

Hello,

**Description**:
We use Flagsmith in a microservices architecture with real-time feature flag updates managed through webhooks. However, we face challenges differentiating between global flag updates and updates that affect only specific identities with overrides.

### Problem Statement
Currently, the webhook payload does not provide enough information to determine:
1. Whether a flag update is a global change that should apply universally or a specific override for certain identities.
2. Which identities have specific overrides on a given flag when a global update occurs.

**Example Scenarios**:
A feature flag (`FlagA`) has identity-specific overrides (e.g., disabled for one identity and enabled globally). When `FlagA` is updated in the dashboard at the global level, the webhook event sets `identity_identifier` to `null`, which does not indicate if `FlagA` has identity-specific overrides.

In this scenario, there’s ambiguity in determining if the flag has identity overrides without directly querying Flagsmith again. It would be beneficial to know if the current update impacts all identities universally or if it excludes identities with overrides.

### Describe the solution you'd like.

### Proposed Solution
- Add a new field `identity_override_ids` to the webhook payload, which provides a list of all `identity_identifier` values that have specific overrides for the updated flag.
- **Usage**:
- When `identity_identifier` is `null`, `identity_override_ids` provides a list of all identities with overrides, allowing services to determine if they should apply the global update or ignore it if their identity is in the list.
- When `identity_identifier` is not `null`, it indicates that the update is for that specific identity, and other identities can ignore the event.

#### Example of Proposed Webhook Payload Enhancement
```json
{
"feature_segment": null,
"feature_state_value": "Test",
"identity": null,
"identity_identifier": null
"identity_override_ids": ["IdentityX", "IdentityY"]
}
```

### Describe alternatives you've considered

- **Querying Flagsmith to Retrieve Override Information**: One alternative is to make an additional API call to Flagsmith after receiving a webhook to check for any identity-specific overrides on the updated flag. However, this approach increases latency and API call overhead, especially in a microservices environment with multiple webhook recipients.

- **Using Tags to Identify Microservices**: Another option is to incorporate tags to manage microservice-specific flags. If Flagsmith's .NET SDK could support retrieving flags with tags and if tags were included in the webhook payload, this would allow us to filter and retrieve only the flags relevant to a specific microservice, reducing unnecessary data and ensuring accurate flag configuration for each service.

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.