Skip to content

Commit

Permalink
Merge branch 'refactor.version-workflows' of github.com:rudderlabs/ru…
Browse files Browse the repository at this point in the history
…dder-transformer into refactor.version-workflows
  • Loading branch information
koladilip committed Feb 2, 2024
2 parents b897d9d + bd3d192 commit 7ec5d04
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
7 changes: 2 additions & 5 deletions src/cdk/v2/destinations/intercom/procWorkflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ steps:
template: |
$.addExternalIdToTraits(.message);
$.context.payload = $.getFieldValueFromMessage(.message, "traits")
- name: trackWorkflow
condition: $.outputs.messageType === {{$.EventType.TRACK}}
Expand All @@ -65,11 +64,10 @@ steps:
$.outputs.apiVersion !== "v1" ? payload.created_at = $.toSeconds(timestamp);
$.outputs.apiVersion === "v1" ? payload.created = $.toSeconds(timestamp);
!(payload.user_id) && .destination.Config.sendAnonymousId ? payload.user_id = .message.anonymousId;
$context.payload = payload;
$.context.payload = payload;
- name: finalPayload
template: |
$context.payload = $.addMetadataToPayload($context.payload);
$.context.payload = $.addMetadataToPayload($.context.payload);
$.assert($.context.payload.event_name, "Event name is required for track call");
$.assert($.context.payload.user_id || $.context.payload.email, "Either email or userId is required for Track call");
$.context.requestMethod = 'POST';
Expand Down Expand Up @@ -112,7 +110,6 @@ steps:
value: $.outputs.rETLPayload
- name: groupTransformPayload
value: $.outputs.rETLPayload || $.outputs.groupTransformPayload

- name: finalPayload
template: |
const finalOutput = $.outputs.versionWorkflows.v1 ?? $.outputs.versionWorkflows.v2
Expand Down
9 changes: 5 additions & 4 deletions src/cdk/v2/destinations/intercom/v1Workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ bindings:

steps:
- name: messageType
template: .message.type.toLowerCase()
template: |
.message.type.toLowerCase()
- name: searchContact
condition: $.outputs.messageType in [{{$.EventType.IDENTIFY}}, {{$.EventType.GROUP}}]
template: |
await $.searchContact(.message, .destination)
condition: $.outputs.messageType in {{$.EventType.([.IDENTIFY, .GROUP])}}
template: |
await $.searchContact(.message, .destination)
- name: identifyWorkflow
condition: $.outputs.messageType === {{$.EventType.IDENTIFY}}
Expand Down
6 changes: 3 additions & 3 deletions src/cdk/v2/destinations/intercom/v2Workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ steps:
template: .message.type.toLowerCase()

- name: searchContact
condition: $.outputs.messageType in [{{$.EventType.IDENTIFY}}, {{$.EventType.GROUP}}]
template: |
await $.searchContact(.message, .destination)
condition: $.outputs.messageType in [{{$.EventType.IDENTIFY}}, {{$.EventType.GROUP}}]
template: |
await $.searchContact(.message, .destination)
- name: identifyWorkflow
condition: $.outputs.messageType === {{$.EventType.IDENTIFY}}
Expand Down

0 comments on commit 7ec5d04

Please sign in to comment.