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

fix: multiple event mappings in ortto #3324

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 1 addition & 4 deletions src/cdk/v2/destinations/ortto/procWorkflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,8 @@ steps:
steps:
- name: getTrimmedEvent
template: |
let customEvent = "";
const event = .message.event;
.destination.Config.orttoEventsMapping@order.(
customEvent = event === .rsEventName ? .orttoEventName : null;
)
const customEvent = .destination.Config.orttoEventsMapping.{.rsEventName === event}.orttoEventName;
$.assert(customEvent, "Event names is not mapped");
"act:cm:"+customEvent.trim().toLowerCase().replace(new RegExp('\\s+', 'g'),'-');

Expand Down
205 changes: 205 additions & 0 deletions test/integrations/destinations/ortto/processor/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1452,4 +1452,209 @@ export const data = [
},
},
},
{
name: 'ortto',
description: 'Track call for testing multiple event mappings filter logic',
feature: 'processor',
module: 'destination',
version: 'v0',
input: {
request: {
body: [
{
destination: {
DestinationDefinition: {
Config: {
cdkV2Enabled: true,
},
},
ID: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq',
Name: 'ORTTO',
Config: {
privateApiKey: 'pvKey',
instanceRegion: 'other',
orttoEventsMapping: [
{
rsEventName: 'player.set.loved',
orttoEventName: 'Loved a set',
eventProperties: [
{
rudderProperty: 'set.id',
orttoProperty: 'Set ID',
type: 'text',
},
{
rudderProperty: 'set.title',
orttoProperty: 'Set title',
type: 'text',
},
{
rudderProperty: 'set.artist',
orttoProperty: 'Artist name',
type: 'text',
},
],
},
{
rsEventName: 'player.set.liked',
orttoEventName: 'Liked a set',
eventProperties: [
{
rudderProperty: 'set.id',
orttoProperty: 'Set ID',
type: 'text',
},
{
rudderProperty: 'set.title',
orttoProperty: 'Set title',
type: 'text',
},
{
rudderProperty: 'set.artist',
orttoProperty: 'Artist name',
type: 'text',
},
],
},
{
rsEventName: 'player.set.played',
orttoEventName: 'Played a set',
eventProperties: [
{
rudderProperty: 'set.id',
orttoProperty: 'Set ID',
type: 'text',
},
{
rudderProperty: 'set.title',
orttoProperty: 'Set title',
type: 'text',
},
{
rudderProperty: 'set.artist',
orttoProperty: 'Artist name',
type: 'text',
},
],
},
],
orttoPersonAttributes: [
{
rudderTraits: 'id',
orttoAttribute: 'External ID',
type: 'text',
},
],
},
Enabled: true,
Transformations: [],
},
metadata: { destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', jobId: 2 },
message: {
type: 'track',
event: 'player.set.liked',
sentAt: '2024-04-29T06:45:59.576Z',
userId: 'XxXxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx',
channel: 'mobile',
context: {
locale: 'en-MU',
traits: {
email: '[email protected]',
userId: 'XxXxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx',
anonymousId: 'dd14b53d-bfb8-48a9-a46f-e3d1351d1dd8',
},
library: {
name: 'rudder-ios-library',
version: '1.26.3',
},
network: {
wifi: true,
cellular: false,
},
timezone: 'Africa/Johannesburg',
},
rudderId: '83cb2d47-9c08-4ce3-86cc-44d8486b337a',
messageId: '2d9525a7-2a55-4d31-9c34-78788a5cbb59',
timestamp: '2024-04-29T06:45:52.611Z',
properties: {
email: '[email protected]',
'set.id': '537d8682-4b37-4f12-8452-3f57091c2a54',
userId: 'XxXxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx',
'set.title': 'Burn Man_Master',
'set.artist': 'John Doe',
environment: 'test',
'set.artists.0.name': 'John Doe',
},
receivedAt: '2024-04-29T06:45:59.779Z',
request_ip: '206.0.75.23',
anonymousId: 'dd14b53d-bfb8-48a9-a46f-e3d1351d1dd8',
integrations: {
All: true,
},
originalTimestamp: '2024-04-29T06:45:52.408Z',
},
},
],
method: 'POST',
},
pathSuffix: '',
},
output: {
response: {
status: 200,
body: [
{
metadata: {
destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq',
jobId: 2,
},
output: {
body: {
FORM: {},
JSON_ARRAY: {},
XML: {},
JSON: {
activities: [
{
fields: {
'str::email': '[email protected]',
'geo::city': {},
'geo::country': {},
'geo::region': {},
'str::ei': 'XxXxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx',
'str::language': 'en-MU',
'bol::gdpr': true,
'bol::p': false,
'bol::sp': false,
},
activity_id: 'act:cm:liked-a-set',
attributes: {
'str:cm:set-id': '537d8682-4b37-4f12-8452-3f57091c2a54',
'str:cm:set-title': 'Burn Man_Master',
'str:cm:artist-name': 'John Doe',
},
location: {},
},
],
merge_by: ['str::ei', 'str::email'],
},
},
endpoint: 'https://api.ap3api.com/v1/activities/create',
files: {},
headers: {
'Content-Type': 'application/json',
'X-Api-Key': 'pvKey',
},
method: 'POST',
params: {},
type: 'REST',
userId: '',
version: '1',
},
statusCode: 200,
},
],
},
},
},
];
Loading