Skip to main content

Webhook Analytics Integration

info

This feature is in development.

You can integrate Flagsmith with your own data warehouse using our Webhook integration. The integration automatically sends the flag states for identified users as a webhook, to a URL you specify, for cohort analysis, A/B testing and more. The process is as follows:

Integration Setup

  1. Write an endpoint that accepts the JSON schema defined below
  2. Add the integration in Flagsmith, providing your URL created in the step above
  3. All API calls generated by the Flagsmith SDK to the Get Identity Flags endpoint will send the a full set of flag evaluations, traits and segments for that particular user to your webhook URL.

Webhook JSON Schema

Flagsmith will send a POST request to the Webhook url you provide, with the following payload in the body:

{
"flags": [
{
"id": 35528,
"feature": {
"id": 1804,
"name": "hero",
"created_date": "2019-11-18T20:09:14.776177Z",
"description": "Determines what the hero image is",
"initial_value": "https://s3-us-west-2.amazonaws.com/com.uppercut.hero-images/assets/0466/comps/466_03314.jpg",
"default_enabled": false,
"type": "STANDARD"
},
"feature_state_value": "https://s3-us-west-2.amazonaws.com/com.uppercut.hero-images/assets/0466/comps/466_03314.jpg",
"enabled": true,
"environment": 6154,
"identity": null,
"feature_segment": null
},
{
"id": 35530,
"feature": {
"id": 6149,
"name": "font_size",
"created_date": "2020-12-05T14:12:53.786706Z",
"description": null,
"initial_value": "12",
"default_enabled": false,
"type": "STANDARD"
},
"feature_state_value": 14,
"enabled": true,
"environment": 6154,
"identity": null,
"feature_segment": null
}
],
"traits": {
"accepted_ts_cs": true,
"dark_mode": false
},
"segments": {
"power_users": {
"id": 152,
"member": true
},
"beta_testers": {
"id": 55,
"member": false
}
}
}

Use Case

Once the integration has been set up, you can start segmenting your data warehouse users based on the flags that they saw and the Segments that they are a member of. This allows you to enrich the data within your warehouse through Flagsmith.