{
  "name": "Queue missed Volai calls for callback",
  "flow": [
    {
      "id": 1,
      "module": "volai-rdcnaj:watchEvents",
      "version": 1,
      "parameters": {},
      "mapper": {},
      "metadata": {
        "designer": { "x": 0, "y": 0 }
      }
    },
    {
      "id": 2,
      "module": "datastore:ExistRecord",
      "version": 1,
      "parameters": {},
      "filter": {
        "name": "Missed incoming call with a callback number",
        "conditions": [[
          { "a": "{{1.event}}", "o": "text:equal", "b": "call.missed" },
          { "a": "{{1.data.direction}}", "o": "text:equal", "b": "in" },
          { "a": "{{1.data.id}}", "o": "exist" },
          { "a": "{{1.data.from}}", "o": "text:pattern", "b": "^\\+[1-9][0-9]{6,14}$" }
        ]]
      },
      "mapper": { "key": "{{1.data.id}}" },
      "metadata": {
        "designer": { "x": 300, "y": 0 }
      }
    },
    {
      "id": 3,
      "module": "datastore:AddRecord",
      "version": 1,
      "parameters": {},
      "filter": {
        "name": "Call is not already in the callback queue",
        "conditions": [[
          { "a": "{{2.exist}}", "o": "boolean:equal", "b": "false" }
        ]]
      },
      "mapper": {
        "key": "{{1.data.id}}",
        "overwrite": false,
        "data": {
          "eventId": "{{1.event_id}}",
          "caller": "{{1.data.from}}",
          "calledNumber": "{{1.data.to}}",
          "detectedAt": "{{1.ts}}",
          "status": "pending"
        }
      },
      "metadata": {
        "designer": { "x": 600, "y": 0 }
      }
    }
  ],
  "metadata": {
    "instant": true,
    "version": 1,
    "scenario": {
      "roundtrips": 1,
      "maxErrors": 3,
      "autoCommit": true,
      "autoCommitTriggerLast": true,
      "sequential": true,
      "confidential": true,
      "dataloss": false,
      "dlq": false,
      "freshVariables": false
    },
    "designer": { "orphans": [] },
    "zone": "eu1.make.com"
  }
}
