Hi!, I have a one connection where Hightouch is a ...
# support
c
Hi!, I have a one connection where Hightouch is a source and Customer.io is a destination. (Hightouch -> Rudderstack (with transformation) -> Customer.io) It works well for basic events, however Customerio released a new feature (Objects) and I can't make them work with that setup More infos in the thread 👇
We've setup the following transformation that should allow to create objects (following the documentation):
Copy code
export 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) :
Copy code
{
  "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?
f
Can you share the payload you are sending?
I have tried with the following event with the transformation you shared above Input:
Copy code
{
  "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):
Copy code
{
  "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:
b
Hi @careful-portugal-80404 👋 ! I'm a Product Manager here at RudderStack and your note caught my eye as I'm quite curious to learn more about how you're using us in conjunction with Hightouch. Would you mind sharing a bit more about why you're currently using Hightouch as a source to RudderStack to CustomerIO? I'd love to set up some time with you (if you're open to it) to chat more about this and any other thoughts you had about our product - but understand if you're busy as well. Do let me know, and thanks!
c
Hello @fierce-crayon-64520 sorry for the late reply. Here is an example decomposed at every step: This is coming from Hightouch
Copy code
{
  "userId": "64af984a24da3392928d941f",
  "event": "RETL - Object Relationship - Track - Added",
  "properties": {
    "query_id": "845650",
    "query_name": "Relation Track User",
    "user_slug": "lowtape",
    "objectId": "64af984a24da3392928d941f"
  }
}
Received in Rudderstack (before transformation):
Copy code
{
  "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"
}
After the transformation:
Copy code
[
    {
        "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"
        }
    }
]
And finally the payload sent to Customer.io:
Copy code
{
  "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
}
f
Are you still seeing the error you previously shared?
c
@fierce-crayon-64520 yes I see the same error
f
Can you share your workspace details? WorkspaceId, destinationId etc?
c
@fierce-crayon-64520 WorkspaceId: 2DG31geITYGe1dZJIEcCMW3HmkW DestinationId: 2DkTqbwH78cHiLWNYgkdiOMiakH
f
Hey, @careful-portugal-80404 can you also let me know how are you using Rudderstack? Is it a free tier version or you have deployed it by yourself? If you have deployed it what transformer and server version are you using?
@careful-portugal-80404 any update on this?