Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: onboard bluecore integration #3061

Merged
merged 32 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
e35fb4e
feat: initial commit
shrouti1507 Feb 6, 2024
a4c6a05
feat: finalising track calls
shrouti1507 Feb 6, 2024
6dcb60b
chore: small commit
shrouti1507 Feb 6, 2024
6b5797d
Merge branch 'develop' into feat.newDestBlueCore
shrouti1507 Feb 9, 2024
acabc11
fix: adding identify call
shrouti1507 Feb 9, 2024
8656239
fix: adding product array support
shrouti1507 Feb 9, 2024
03868f1
fix: adding unit test cases
shrouti1507 Feb 12, 2024
0c885d0
fix: adding check for action field value other than identify
shrouti1507 Feb 12, 2024
ed01e14
fix: adding test cases for identify response builder
shrouti1507 Feb 12, 2024
50a71dc
fix: adding support for cdkv2
shrouti1507 Feb 12, 2024
bd29ece
fix: adding component test case part 1
shrouti1507 Feb 12, 2024
d999698
fix: adding component test case part 2
shrouti1507 Feb 13, 2024
d34fd69
fix: complete bluecore via CDK v2
shrouti1507 Feb 13, 2024
ef71643
fix: removing the JS code and only have cdk
shrouti1507 Feb 13, 2024
393b289
Merge branch 'develop' into feat.newDestBlueCore
shrouti1507 Feb 13, 2024
f8e0953
fix: adding support for externalID feature in distinct id
shrouti1507 Feb 14, 2024
e13abae
Merge branch 'develop' into feat.newDestBlueCore
shrouti1507 Feb 14, 2024
9e97f4c
fix: making email mandatory for optin and unsubscribe events
shrouti1507 Feb 14, 2024
2fb5cba
fix: merging common properties to a single config json
shrouti1507 Feb 15, 2024
6d0c971
Apply suggestions from code review
shrouti1507 Feb 15, 2024
0996df4
fix: using lodash for deep merge
shrouti1507 Feb 15, 2024
6b86e73
fix: addressed review comments
shrouti1507 Feb 16, 2024
dedb0fa
refactor: bluecore workflow steps for track
koladilip Feb 19, 2024
9d6e7b6
refactor: bluecore workflow steps for track
koladilip Feb 19, 2024
423768b
refactor: bluecore workflow steps for track
koladilip Feb 19, 2024
46b6e40
Merge branch 'develop' into feat.newDestBlueCore
shrouti1507 Feb 19, 2024
5c22376
refactor: populateAccurateDistinctId
koladilip Feb 19, 2024
cf738d3
Merge branch 'feat.newDestBlueCore' of github.com:rudderlabs/rudder-t…
koladilip Feb 19, 2024
ec1fca6
Merge branch 'develop' into feat.newDestBlueCore
shrouti1507 Feb 19, 2024
a0e943a
Apply suggestions from code review
shrouti1507 Feb 19, 2024
cbe580e
Apply suggestions from code review
shrouti1507 Feb 19, 2024
dfe13bb
fix: review comments addressed
shrouti1507 Feb 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions src/cdk/v2/destinations/bluecore/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
const { getMappingConfig } = require('../../../../v0/util');

const BASE_URL = 'https://api.bluecore.com/api/track/mobile/v1';

const CONFIG_CATEGORIES = {
IDENTIFY: {
name: 'bluecoreIdentifyConfig',
type: 'identify',
},
TRACK: {
name: 'bluecoreTrackConfig',
type: 'track',
},
};

const EVENT_NAME_MAPPING = [
{
src: ['product viewed'],
dest: 'viewed_product',
},
{
src: ['products searched'],
dest: 'search',
},
{
src: ['product added'],
dest: 'add_to_cart',
},
{
src: ['product removed'],
dest: 'remove_from_cart',
},
{
src: ['product added to wishlist'],
dest: 'wishlist',
},
{
src: ['order completed'],
dest: 'purchase',
},
];

const BLUECORE_EXCLUSION_FIELDS = ['query','order_id','total']

const MAPPING_CONFIG = getMappingConfig(CONFIG_CATEGORIES, __dirname);
module.exports = {
CONFIG_CATEGORIES,
MAPPING_CONFIG,
EVENT_NAME_MAPPING,
BASE_URL,
BLUECORE_EXCLUSION_FIELDS
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
[
{
"destKey": "properties.distinct_id",
shrouti1507 marked this conversation as resolved.
Show resolved Hide resolved
"sourceKeys": ["traits.email", "context.traits.email", "userId", "anonymousId"],
"required": true
},
{
"destKey": "properties.customer.name",
"sourceKeys": "name",
"required": false,
"sourceFromGenericMap": true
},
{
"destKey": "properties.customer.first_name",
"sourceKeys": "firstName",
"required": false,
"sourceFromGenericMap": true
},
{
"destKey": "properties.customer.last_name",
"sourceKeys": "lastName",
"required": false,
"sourceFromGenericMap": true
},
{
"destKey": "properties.customer.age",
"sourceKeys": ["context.traits.age", "traits.age"],
"required": false
},
{
"destKey": "event",
"sourceKeys": ["traits.action", "context.traits.action"],
"required": false
},
{
"destKey": "properties.customer.sex",
"sourceKeys": ["traits.gender", "context.traits.gender", "traits.sex", "context.traits.sex"],
"required": false
},
{
"destKey": "properties.customer.address",
"sourceKeys": "address",
"required": false,
"sourceFromGenericMap": true
},
{
"destKey": "properties.customer.email",
"sourceKeys": "email",
"required": false,
"sourceFromGenericMap": true
},
{
"destKey": "properties.client",
"sourceKeys": "context.app.version",
"required": false
},
{
"destKey": "properties.device",
"sourceKeys": "context.device.model",
"required": false
}
]
77 changes: 77 additions & 0 deletions src/cdk/v2/destinations/bluecore/data/bluecoreTrackConfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
[
anantjain45823 marked this conversation as resolved.
Show resolved Hide resolved
{
"destKey": "properties.distinct_id",
"sourceKeys": ["userId", "anonymousId", "email"],
shrouti1507 marked this conversation as resolved.
Show resolved Hide resolved
shrouti1507 marked this conversation as resolved.
Show resolved Hide resolved
"required": false
},
{
"destKey": "properties.customer.name",
"sourceKeys": "name",
"required": false,
"sourceFromGenericMap": true
},
{
"destKey": "properties.customer.first_name",
"sourceKeys": "firstName",
"required": false,
"sourceFromGenericMap": true
},
{
"destKey": "properties.customer.last_name",
"sourceKeys": "lastName",
"required": false,
"sourceFromGenericMap": true
},
{
"destKey": "properties.customer.age",
"sourceKeys": ["context.traits.age", "traits.age"],
"required": false
},
{
"destKey": "properties.customer.sex",
"sourceKeys": ["traits.gender", "context.traits.gender", "traits.sex", "context.traits.sex"],
"required": false
},
{
"destKey": "properties.customer.address",
"sourceKeys": "address",
"required": false,
"sourceFromGenericMap": true
},
{
"destKey": "properties.customer.email",
"sourceKeys": "email",
"required": false,
"sourceFromGenericMap": true
},
{
"destKey": "properties.search_term",
"sourceKeys": "properties.query",
"required": false
},
{
"destKey": "properties.order_id",
"sourceKeys": "properties.order_id",
"required": false
},
{
"destKey": "properties.total",
"sourceKeys": "properties.total",
"required": false
},
{
"destKey": "properties.client",
"sourceKeys": "context.app.version",
"required": false
},
{
"destKey": "properties.device",
"sourceKeys": "context.device.model",
"required": false
},
{
"destKey": "properties.products",
"sourceKeys": ["properties.products"],
"required": false
}
]
67 changes: 67 additions & 0 deletions src/cdk/v2/destinations/bluecore/procWorkflow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
bindings:
- name: EventType
path: ../../../../constants
- path: ../../bindings/jsontemplate
- name: defaultRequestConfig
path: ../../../../v0/util
- name: removeUndefinedNullValuesAndEmptyObjectArray
path: ../../../../v0/util
- name: removeUndefinedAndNullValues
path: ../../../../v0/util
- path: ./utils
- path: lodash
name: cloneDeep

steps:
- name: messageType
template: |
.message.type.toLowerCase();
- name: validateInput
template: |
let messageType = $.outputs.messageType;
$.assert(messageType, "message Type is not present. Aborting");
$.assert(messageType in {{$.EventType.([.TRACK, .IDENTIFY])}}, "message type " + messageType + " is not supported");
$.assertConfig(.destination.Config.bluecoreNamespace, "[BLUECORE] bluecore account namespace required for Authentication.");
koladilip marked this conversation as resolved.
Show resolved Hide resolved
- name: prepareIdentifyPayload
condition: $.outputs.messageType === {{$.EventType.IDENTIFY}}
template: |
const payload = $.constructProperties(.message);
payload.token = .destination.Config.bluecoreNamespace;
$.verifyPayload(payload, .message);
payload.event = payload.event ?? 'customer_patch';
$.context.payloads = [$.removeUndefinedAndNullValues(payload)];
- name: validateInputForTrack
description: Additional validation for Track events
condition: $.outputs.messageType === {{$.EventType.TRACK}}
template: |
$.assert(.message.event, "event_name could not be mapped. Aborting.")
- name: deduceEventNames
condition: $.outputs.messageType === {{$.EventType.TRACK}}
template: |
$.context.deducedEventNameArray = $.deduceTrackEventName(.message.event,.destination.Config)
- name: prepareTrackPayload
condition: $.outputs.messageType === {{$.EventType.TRACK}}
template: |
const payload = $.constructProperties(.message);
$.context.payloads = $.context.deducedEventNameArray@eventName.(
const newPayload = $.cloneDeep(payload);
const temporaryProductArray = newPayload.properties.products ?? $.createProductForStandardEcommEvent(^.message, eventName);
newPayload.properties.products = $.addProductArray(temporaryProductArray);
newPayload.event = eventName;
newPayload.token = ^.destination.Config.bluecoreNamespace;
$.verifyPayload(newPayload, ^.message);
$.removeUndefinedNullValuesAndEmptyObjectArray(newPayload)
)[];

- name: buildResponse
template: |
$.context.payloads.(
const response = $.defaultRequestConfig();
response.body.JSON = .;
response.method = "POST";
response.endpoint = "https://api.bluecore.com/api/track/mobile/v1";
response.headers = {
"Content-Type": "application/json"
};
response
)
Loading
Loading