Handle cohort updates from Amplitude webhooks in Segment batch format.
Each item in the batch has traits indicating property updates.
Expected payload format:
{
"batch": [{
"type": "identify",
"traits": {
"[Amplitude] {cohort_name}: {cohort_id}": true
},
"userId": "user123",
"context": {
"integration": {
"name": "Amplitude Cohort Sync",
"version": "1.0.0"
}
}
}]
}
Trait name format: "[Amplitude] {cohort_name}: {cohort_id}"
Trait value: boolean indicating cohort membership
Invalid users in the payload will be skipped and logged, but won't fail the entire request
as long as at least one user is valid.
See: https://amplitude.com/docs/partners/create-a-cohort-syncing-integration