careful-portugal-80404
07/13/2023, 6:57 AMcareful-portugal-80404
07/13/2023, 6:59 AMexport function transformEvent(event, metadata) {
const objectId = event.properties?.objectId;
const props = event.properties;
if (objectId) {
event.properties = {};
event.type = 'group';
event.groupId = objectId;
event.header = {
'Content-Type': 'application/json'
};
event.properties.identifiers = {
object_type_id: '1',
object_id: objectId
};
event.properties.type = 'object';
event.properties.action = 'identify';
event.properties.attributes = {
name: props.trackslug
};
return event;
}
return event;
}
However we the following error message from the API (through rudderstack) :
{
"response": "{\n \"errors\": [\n {\n \"reason\": \"invalid\",\n \"field\": \"content-type\",\n \"message\": \"must be application/json\"\n }\n ]\n}\n",
"firstAttemptedAt": "2023-07-12T18:44:00.079Z",
"content-type": "application/json; charset=utf-8"
}
Setting the content header to ""application/json" from the transformation does not work, as you can see.
What should we do?careful-portugal-80404
07/13/2023, 6:59 AMfierce-crayon-64520
07/13/2023, 10:31 AMfierce-crayon-64520
07/13/2023, 10:38 AM{
"type": "track",
"event": "annualized_revenue",
"userId": "sources",
"channel": "sources",
"context": {
"sources": {
"job_id": "2N6x1k6VlYVHgtjHYM0qviV3rKv/Syncher",
"version": "v1.23.0",
"job_run_id": "chcvr02q0o80art0edk0",
"task_run_id": "chcvr02q0o80art0edkg"
}
},
"recordId": "10",
"rudderId": "ad78b53b-2439-4923-8e70-3a43f01ba371",
"messageId": "chcvrf2q0o80art0edrg",
"properties": {
"objectId": 1234,
"gclid": "Cj0KCQjw6cKiBhD5ARIsAKXUdybqN7DV7ZFBelg7XMLZO-L1gCEXebkKQ7M73tQOdVNsxI_74J2grtIaAlRLEALw_wcB",
"gbraid": null,
"wbraid": null,
"orderId": 1108829,
"planName": "rudderstackTestingPlan",
"orderUUID": "deaf39a0-c1ff-4e0d-aa6e-770deee66e85",
"planPeriod": 0,
"currencyCode": "USD",
"conversionName": "annualized_revenue",
"conversionValue": 70,
"conversionDateTime": "2023-05-08 23:07:34+00:00"
},
"anonymousId": "deaf39a0-c1ff-4e0d-aa6e-770deee66e85"
}
Output(live events):
{
"version": "1",
"type": "REST",
"method": "POST",
"endpoint": "https://track.customer.io/api/v2/batch",
"headers": {
"Authorization": "Basic ******ODI=",
"Content-Type": "application/json"
},
"params": {},
"body": {
"JSON": {
"batch": [
{
"identifiers": {
"object_id": "1234",
"object_type_id": "1"
},
"type": "object",
"action": "identify",
"attributes": {},
"cio_relationships": [
{
"identifiers": {
"id": "sources"
}
}
]
}
]
},
"JSON_ARRAY": {},
"XML": {},
"FORM": {}
},
"files": {}
}
SS from the dashboard:big-carpenter-40436
07/18/2023, 11:14 PMcareful-portugal-80404
07/20/2023, 5:06 PM{
"userId": "64af984a24da3392928d941f",
"event": "RETL - Object Relationship - Track - Added",
"properties": {
"query_id": "845650",
"query_name": "Relation Track User",
"user_slug": "lowtape",
"objectId": "64af984a24da3392928d941f"
}
}careful-portugal-80404
07/20/2023, 5:06 PM{
"event": "RETL - Object Relationship - Track - Added",
"messageId": "3c6656b0-8330-4e29-8538-08184c1dd395",
"properties": {
"objectId": "64af984a24da3392928d941f",
"query_id": "845650",
"query_name": "Relation Track User",
"user_slug": "lowtape"
},
"rudderId": "f603f9d9-1280-4fa0-b77d-aeb04e8e87de",
"type": "track",
"userId": "64af984a24da3392928d941f"
}careful-portugal-80404
07/20/2023, 5:07 PM[
{
"eventName": "RETL - Object Relationship - Track - Added",
"eventType": "group",
"payload": {
"event": "RETL - Object Relationship - Track - Added",
"groupId": "64af984a24da3392928d941f",
"header": {
"Content-Type": "application/json"
},
"messageId": "3c6656b0-8330-4e29-8538-08184c1dd395",
"originalTimestamp": "2023-07-20T17:01:45.185Z",
"properties": {
"action": "identify",
"attributes": {},
"identifiers": {
"object_id": "64af984a24da3392928d941f",
"object_type_id": "1"
},
"type": "object"
},
"receivedAt": "2023-07-20T17:01:44.041Z",
"request_ip": "10.114.0.23",
"rudderId": "f603f9d9-1280-4fa0-b77d-aeb04e8e87de",
"sentAt": "2023-07-20T17:01:45.185Z",
"timestamp": "2023-07-20T17:01:44.040Z",
"type": "group",
"userId": "64af984a24da3392928d941f"
}
}
]careful-portugal-80404
07/20/2023, 5:08 PM{
"version": "1",
"type": "REST",
"method": "POST",
"endpoint": "https://track-eu.customer.io/api/v2/batch",
"headers": {
"Authorization": "Basic ******YzI="
},
"params": {},
"body": {
"JSON": {
"identifiers": {
"object_id": "64af984a24da3392928d941f",
"object_type_id": "1"
},
"type": "object",
"action": "identify",
"attributes": {},
"cio_relationships": [
{
"identifiers": {
"id": "64af984a24da3392928d941f"
}
}
]
},
"JSON_ARRAY": {},
"XML": {},
"FORM": {}
},
"files": {},
"userId": "64af984a24da3392928d941f",
"statusCode": 200
}fierce-crayon-64520
07/21/2023, 3:48 AMcareful-portugal-80404
07/21/2023, 7:03 AMfierce-crayon-64520
07/21/2023, 8:46 AMcareful-portugal-80404
07/21/2023, 9:04 AMfierce-crayon-64520
07/24/2023, 4:25 AMfierce-crayon-64520
07/26/2023, 1:47 PM