{
  "name": "DFC Demo V1 - Inbound Lookup",
  "type": "CONTACT_FLOW_MODULE",
  "sourceId": "0b48b4fc-dd52-4df7-8a26-800aeeaa1dcb",
  "content": {
    "Version": "2019-10-30",
    "StartAction": "channel",
    "Metadata": {
      "entryPointPosition": {
        "x": 20,
        "y": 20
      },
      "snapToGrid": false,
      "ActionMetadata": {
        "channel": {
          "position": {
            "x": 40,
            "y": 40
          }
        },
        "source-from-endpoint": {
          "position": {
            "x": 300,
            "y": 40
          }
        },
        "source-from-attr": {
          "position": {
            "x": 560,
            "y": 40
          }
        },
        "lookup-source": {
          "position": {
            "x": 820,
            "y": 40
          }
        },
        "check-error": {
          "position": {
            "x": 1080,
            "y": 40
          }
        },
        "stash": {
          "position": {
            "x": 1340,
            "y": 40
          }
        },
        "lookup-failed": {
          "position": {
            "x": 40,
            "y": 260
          }
        },
        "done": {
          "position": {
            "x": 300,
            "y": 260
          }
        }
      }
    },
    "Actions": [
      {
        "Identifier": "channel",
        "Parameters": {
          "ComparisonValue": "$.Channel"
        },
        "Transitions": {
          "Errors": [
            {
              "NextAction": "source-from-attr",
              "ErrorType": "NoMatchingCondition"
            }
          ],
          "Conditions": [
            {
              "NextAction": "source-from-endpoint",
              "Condition": {
                "Operator": "Equals",
                "Operands": [
                  "VOICE"
                ]
              }
            }
          ],
          "NextAction": "source-from-attr"
        },
        "Type": "Compare"
      },
      {
        "Identifier": "source-from-endpoint",
        "Parameters": {
          "Attributes": {
            "dfcSource": "$.SystemEndpoint.Address"
          }
        },
        "Transitions": {
          "Errors": [
            {
              "NextAction": "lookup-failed",
              "ErrorType": "NoMatchingError"
            }
          ],
          "Conditions": [],
          "NextAction": "lookup-source"
        },
        "Type": "UpdateContactAttributes"
      },
      {
        "Identifier": "source-from-attr",
        "Parameters": {
          "Attributes": {
            "dfcSource": "$.Attributes.dfcSource"
          }
        },
        "Transitions": {
          "Errors": [
            {
              "NextAction": "lookup-failed",
              "ErrorType": "NoMatchingError"
            }
          ],
          "Conditions": [],
          "NextAction": "lookup-source"
        },
        "Type": "UpdateContactAttributes"
      },
      {
        "Identifier": "lookup-source",
        "Parameters": {
          "LambdaFunctionARN": "arn:aws:lambda:<REGION>:<ACCOUNT_ID>:function:dfc-query-by-path-<STAGE>",
          "InvocationTimeLimitSeconds": "8",
          "LambdaInvocationAttributes": {
            "path": "/Contact Source/$.Attributes.dfcSource",
            "debug": "false"
          },
          "ResponseValidation": {
            "ResponseType": "JSON"
          }
        },
        "Transitions": {
          "Errors": [
            {
              "NextAction": "lookup-failed",
              "ErrorType": "NoMatchingError"
            }
          ],
          "Conditions": [],
          "NextAction": "check-error"
        },
        "Type": "InvokeLambdaFunction"
      },
      {
        "Identifier": "check-error",
        "Parameters": {
          "ComparisonValue": "$.External.error"
        },
        "Transitions": {
          "Errors": [
            {
              "NextAction": "stash",
              "ErrorType": "NoMatchingCondition"
            }
          ],
          "Conditions": [
            {
              "NextAction": "lookup-failed",
              "Condition": {
                "Operator": "Equals",
                "Operands": [
                  "ITEM_NOT_FOUND"
                ]
              }
            },
            {
              "NextAction": "lookup-failed",
              "Condition": {
                "Operator": "Equals",
                "Operands": [
                  "ENTITY_NOT_FOUND"
                ]
              }
            },
            {
              "NextAction": "lookup-failed",
              "Condition": {
                "Operator": "Equals",
                "Operands": [
                  "MISSING_REQUIRED_FIELDS"
                ]
              }
            },
            {
              "NextAction": "lookup-failed",
              "Condition": {
                "Operator": "Equals",
                "Operands": [
                  "INTERNAL_ERROR"
                ]
              }
            }
          ],
          "NextAction": "lookup-failed"
        },
        "Type": "Compare"
      },
      {
        "Identifier": "stash",
        "Parameters": {
          "Attributes": {
            "dfcFound": "true",
            "srcEnabled": "$.External.data.enabled",
            "expName": "$.External.data.experienceConfig.name",
            "timezone": "$.External.data.experienceConfig.timezone",
            "langSelect": "$.External.data.experienceConfig.enableLanguageSelection",
            "langCode": "$.External.data.experienceConfig.defaultLanguage.code",
            "langName": "$.External.data.experienceConfig.defaultLanguage.name",
            "voiceId": "$.External.data.experienceConfig.defaultLanguage.pollyVoiceId",
            "welcome": "$.External.data.experienceConfig.promptSet.welcome.content",
            "outOfHours": "$.External.data.experienceConfig.promptSet.outOfHours.content",
            "closureActive": "$.External.data.experienceConfig.closures.active",
            "closureReason": "$.External.data.experienceConfig.closures.reason",
            "scheduleName": "$.External.data.experienceConfig.schedule.name",
            "destName": "$.External.data.experienceConfig.routing.name",
            "queueArn": "$.External.data.experienceConfig.routing.queue.connect_resource.arn",
            "queueName": "$.External.data.experienceConfig.routing.queue.connect_resource.name"
          }
        },
        "Transitions": {
          "Errors": [
            {
              "NextAction": "lookup-failed",
              "ErrorType": "NoMatchingError"
            }
          ],
          "Conditions": [],
          "NextAction": "done"
        },
        "Type": "UpdateContactAttributes"
      },
      {
        "Identifier": "lookup-failed",
        "Parameters": {
          "Attributes": {
            "dfcFound": "false"
          }
        },
        "Transitions": {
          "Errors": [
            {
              "NextAction": "done",
              "ErrorType": "NoMatchingError"
            }
          ],
          "Conditions": [],
          "NextAction": "done"
        },
        "Type": "UpdateContactAttributes"
      },
      {
        "Identifier": "done",
        "Type": "EndFlowModuleExecution",
        "Parameters": {},
        "Transitions": {}
      }
    ],
    "Settings": {
      "InputParameters": [],
      "OutputParameters": [],
      "Transitions": [
        {
          "DisplayName": "Success",
          "ReferenceName": "Success",
          "Description": ""
        }
      ]
    }
  }
}
