|
22 | 22 | ) |
23 | 23 |
|
24 | 24 | _LIST_RESPONSE = inline_serializer( |
25 | | - "AmplitudeListResponse", {"list_id": serializers.UUIDField()} |
| 25 | + "AmplitudeListResponse", |
| 26 | + { |
| 27 | + "list_id": serializers.UUIDField(), |
| 28 | + "listId": serializers.UUIDField(), |
| 29 | + "response": inline_serializer( |
| 30 | + "AmplitudeListResponseEnvelope", |
| 31 | + { |
| 32 | + "list_id": serializers.UUIDField(), |
| 33 | + "listId": serializers.UUIDField(), |
| 34 | + }, |
| 35 | + ), |
| 36 | + }, |
26 | 37 | ) |
27 | 38 |
|
28 | 39 | _MIXPANEL_RESPONSE = inline_serializer( |
@@ -73,7 +84,21 @@ def create(self, request: Request) -> Response: |
73 | 84 | name=serializer.validated_data["name"], |
74 | 85 | source_type=CohortSourceType.AMPLITUDE, |
75 | 86 | ) |
76 | | - return Response({"list_id": str(cohort.uuid)}) |
| 87 | + # Amplitude's Testing tab and production sync worker read the list |
| 88 | + # ID from this body differently: the Testing tab wraps the body in a |
| 89 | + # {"response": ...} envelope before applying the configured ID path, |
| 90 | + # while the production worker appears to ignore the configured path |
| 91 | + # and read the documented default key, camelCase "listId". Carrying |
| 92 | + # the ID at every spelling and depth satisfies every parser |
| 93 | + # observed. |
| 94 | + list_id = str(cohort.uuid) |
| 95 | + return Response( |
| 96 | + { |
| 97 | + "list_id": list_id, |
| 98 | + "listId": list_id, |
| 99 | + "response": {"list_id": list_id, "listId": list_id}, |
| 100 | + } |
| 101 | + ) |
77 | 102 |
|
78 | 103 | @action(detail=True, methods=["POST"]) |
79 | 104 | def add(self, request: Request, pk: str) -> Response: |
|
0 commit comments