From bd3d192d2cc88129da1f8493874ef5d4ac6d3970 Mon Sep 17 00:00:00 2001 From: mihir-4116 Date: Fri, 2 Feb 2024 19:44:55 +0530 Subject: [PATCH] fix: minor errors --- src/cdk/v2/destinations/intercom/procWorkflow.yaml | 7 ++----- src/cdk/v2/destinations/intercom/v1Workflow.yaml | 9 +++++---- src/cdk/v2/destinations/intercom/v2Workflow.yaml | 6 +++--- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/cdk/v2/destinations/intercom/procWorkflow.yaml b/src/cdk/v2/destinations/intercom/procWorkflow.yaml index 408ca28806..25363d7d5c 100644 --- a/src/cdk/v2/destinations/intercom/procWorkflow.yaml +++ b/src/cdk/v2/destinations/intercom/procWorkflow.yaml @@ -44,7 +44,6 @@ steps: template: | $.addExternalIdToTraits(.message); $.context.payload = $.getFieldValueFromMessage(.message, "traits") - - name: trackWorkflow condition: $.outputs.messageType === {{$.EventType.TRACK}} @@ -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'; @@ -112,7 +110,6 @@ steps: value: $.outputs.rETLPayload - name: groupTransformPayload value: $.outputs.rETLPayload || $.outputs.groupTransformPayload - - name: finalPayload template: | $.context = $.outputs.versionWorkflows.v1 ?? $.outputs.versionWorkflows.v2 diff --git a/src/cdk/v2/destinations/intercom/v1Workflow.yaml b/src/cdk/v2/destinations/intercom/v1Workflow.yaml index 1eabdc00d8..54d82c628e 100644 --- a/src/cdk/v2/destinations/intercom/v1Workflow.yaml +++ b/src/cdk/v2/destinations/intercom/v1Workflow.yaml @@ -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}} diff --git a/src/cdk/v2/destinations/intercom/v2Workflow.yaml b/src/cdk/v2/destinations/intercom/v2Workflow.yaml index 8bcbcd9be0..573e3cdcd4 100644 --- a/src/cdk/v2/destinations/intercom/v2Workflow.yaml +++ b/src/cdk/v2/destinations/intercom/v2Workflow.yaml @@ -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}}