Skip to content

Commit

Permalink
feat: onboard new custom destination: wunderkind
Browse files Browse the repository at this point in the history
  • Loading branch information
Gauravudia committed Jun 12, 2024
1 parent a96d40b commit 09e3d0f
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 2 deletions.
36 changes: 36 additions & 0 deletions src/cdk/v2/destinations/wunderkind/procWorkflow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
bindings:
- name: EventType
path: ../../../../constants
- path: ../../bindings/jsontemplate
exportAll: true
- path: ../../../../v0/destinations/webhook/utils
- name: getHashFromArray
path: ../../../../v0/util
- name: getIntegrationsObj
path: ../../../../v0/util
- name: removeUndefinedAndNullValues
path: ../../../../v0/util

steps:
- name: checkIfProcessed
condition: .message.statusCode
template: |
$.batchMode ? .message.body.JSON : .message
onComplete: return

- name: messageType
template: |
$.context.messageType = .message.type.toLowerCase();
- name: validateInput
template: |
let messageType = $.context.messageType;
$.assert(messageType, "message Type is not present. Aborting");
$.assert(messageType in {{$.EventType.([.TRACK])}}, "message type " + messageType + " is not supported");
$.assertConfig(.destination.Config.accountID, "Account ID is not present. Aborting");
$.assertConfig(.destination.Config.instanceID, "Instance ID is not present. Aborting");
- name: buildResponseForProcessTransformation
template: |
{
payload: JSON.stringify(.message.properties),
}
31 changes: 31 additions & 0 deletions src/cdk/v2/destinations/wunderkind/rtWorkflow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
bindings:
- name: handleRtTfSingleEventError
path: ../../../../v0/util/index

steps:
- name: validateInput
template: |
$.assert(Array.isArray(^) && ^.length > 0, "Invalid event array")
- name: transform
externalWorkflow:
path: ./procWorkflow.yaml
loopOverInput: true

- name: successfulEvents
template: |
$.outputs.transform#idx.output.({
"batchedRequest": .,
"batched": false,
"destination": ^[idx].destination,
"metadata": ^[idx].metadata[],
"statusCode": 200
})[]
- name: failedEvents
template: |
$.outputs.transform#idx.error.(
$.handleRtTfSingleEventError(^[idx], .originalError ?? ., {})
)[]
- name: finalPayload
template: |
[...$.outputs.failedEvents, ...$.outputs.successfulEvents]
5 changes: 3 additions & 2 deletions src/features.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@
"BLOOMREACH": true,
"MOVABLE_INK": true,
"EMARSYS": true,
"KODDI": true
"KODDI": true,
"WUNDERKIND": true
},
"regulations": [
"BRAZE",
Expand All @@ -91,4 +92,4 @@
],
"supportSourceTransformV1": true,
"supportTransformerProxyV1": true
}
}

0 comments on commit 09e3d0f

Please sign in to comment.