Skip to content

Commit

Permalink
fix(customerio): added validations to convert integer to string (#2017)
Browse files Browse the repository at this point in the history
* fix(customerio): added validations to convert integer to string

* chore: code review changes
  • Loading branch information
mihir-4116 committed Mar 28, 2023
1 parent a45396e commit f50b128
Show file tree
Hide file tree
Showing 3 changed files with 171 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/v0/destinations/customerio/data/customerIoGroup.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,27 @@
"destKey": "object_id",
"sourceKeys": "groupId",
"sourceFromGenericMap": true,
"metadata": {
"type": "toString"
},
"required": true
},
{
"destKey": "object_type_id",
"sourceKeys": "traits.objectTypeId",
"metadata": {
"defaultValue": "1"
"defaultValue": "1",
"type": "toString"
},
"required": false
},
{
"destKey": "userId",
"sourceKeys": "userIdOnly",
"sourceFromGenericMap": true,
"metadata": {
"type": "toString"
},
"required": false
},
{
Expand Down
112 changes: 111 additions & 1 deletion test/__tests__/data/customerio_input.json
Original file line number Diff line number Diff line change
Expand Up @@ -4153,5 +4153,115 @@
"Transformations": [],
"IsProcessorEnabled": true
}
}
},
{
"description": "successful group call with userId and groupId as an integer",
"message": {
"type": "group",
"header": {
"content-type": "application/json; charset=utf-8"
},
"sentAt": "2023-03-28T09:36:49.882Z",
"traits": {
"city": "Frankfurt",
"name": "rudder test",
"state": "Hessen",
"isFake": true,
"address": "Solmsstraße 83",
"country": "DE",
"website": "http://www.rudderstack.com",
"industry": "Waste and recycling",
"postcode": "60486",
"whiteLabel": "rudderlabs",
"maxNbJobBoards": 2,
"organisationId": 306,
"pricingPackage": "packageExpert",
"dateProTrialEnd": "2022-08-31T00:00:00+00:00",
"isProTrialActive": true,
"datetimeRegistration": "2020-07-01T10:23:41+00:00",
"isPersonnelServiceProvider": false
},
"userId": 432,
"channel": "server",
"context": {
"library": {
"name": "rudder-analytics-php",
"version": "2.0.1",
"consumer": "LibCurl"
}
},
"groupId": 306,
"rudderId": "f5b46a12-2dab-4e24-a127-7316eed414fc",
"messageId": "7032394c-e813-4737-bf52-622dbcefe849",
"timestamp": "2020-07-01T10:23:41.000Z",
"receivedAt": "2023-03-28T09:36:48.296Z",
"request_ip": "18.195.235.225",
"originalTimestamp": "2023-03-28T09:36:49.882Z"
},
"destination": {
"ID": "23Mi76khsFhY7bh9ZyRcvR3pHDt",
"Name": "Customer IO Dev",
"DestinationDefinition": {
"ID": "23MgSlHXsPLsiH7SbW7IzCP32fn",
"Name": "CUSTOMERIO",
"DisplayName": "Customer IO",
"Config": {
"destConfig": {
"defaultConfig": [
"apiKey",
"siteID",
"datacenterEU",
"deviceTokenEventName"
],
"web": [
"useNativeSDK",
"blackListedEvents",
"whiteListedEvents"
]
},
"excludeKeys": [],
"includeKeys": [
"apiKey",
"siteID",
"datacenterEU",
"blackListedEvents",
"whiteListedEvents"
],
"saveDestinationResponse": true,
"secretKeys": [],
"supportedMessageTypes": [
"identify",
"page",
"screen",
"track"
],
"supportedSourceTypes": [
"android",
"ios",
"web",
"unity",
"amp",
"cloud",
"warehouse",
"reactnative",
"flutter",
"cordova"
],
"supportsVisualMapper": true,
"transformAt": "processor",
"transformAtV1": "processor"
},
"ResponseRules": {}
},
"Config": {
"apiKey": "ef32c3f60fb98f39ef35",
"datacenterEU": false,
"deviceTokenEventName": "device_token_registered",
"siteID": "c0efdbd20b9fbe24a7e2"
},
"Enabled": true,
"Transformations": [],
"IsProcessorEnabled": true
}
}
]
52 changes: 52 additions & 0 deletions test/__tests__/data/customerio_output.json
Original file line number Diff line number Diff line change
Expand Up @@ -1293,5 +1293,57 @@
"files": {},
"userId": "user@1",
"statusCode": 200
},
{
"version": "1",
"type": "REST",
"method": "POST",
"endpoint": "https://track.customer.io/api/v2/batch",
"headers": {
"Authorization": "Basic YzBlZmRiZDIwYjlmYmUyNGE3ZTI6ZWYzMmMzZjYwZmI5OGYzOWVmMzU="
},
"params": {},
"body": {
"XML": {},
"FORM": {},
"JSON": {
"type": "object",
"action": "identify",
"attributes": {
"city": "Frankfurt",
"name": "rudder test",
"state": "Hessen",
"isFake": true,
"address": "Solmsstraße 83",
"country": "DE",
"website": "http://www.rudderstack.com",
"industry": "Waste and recycling",
"postcode": "60486",
"whiteLabel": "rudderlabs",
"maxNbJobBoards": 2,
"organisationId": 306,
"pricingPackage": "packageExpert",
"dateProTrialEnd": "2022-08-31T00:00:00+00:00",
"isProTrialActive": true,
"datetimeRegistration": "2020-07-01T10:23:41+00:00",
"isPersonnelServiceProvider": false
},
"identifiers": {
"object_id": "306",
"object_type_id": "1"
},
"cio_relationships": [
{
"identifiers": {
"id": "432"
}
}
]
},
"JSON_ARRAY": {}
},
"files": {},
"userId": 432,
"statusCode": 200
}
]

0 comments on commit f50b128

Please sign in to comment.