{
  "name": "Crisphive — website form to confirmed job",
  "flow": [
    {
      "id": 1,
      "module": "gateway:CustomWebHook",
      "version": 1,
      "parameters": {
        "hook": null,
        "maxResults": 1
      },
      "mapper": {},
      "metadata": {
        "designer": {
          "x": 0,
          "y": 0
        }
      }
    },
    {
      "id": 2,
      "module": "http:ActionSendData",
      "version": 3,
      "parameters": {
        "handleErrors": false,
        "useNewZLibDeCompress": true
      },
      "mapper": {
        "url": "https://api.crisphive.com/v1/job-requests/book-and-confirm",
        "method": "post",
        "serializeUrl": false,
        "headers": [
          {
            "name": "Authorization",
            "value": "Bearer chsk_test_PASTE_YOUR_KEY_HERE"
          }
        ],
        "qs": [],
        "bodyType": "raw",
        "contentType": "application/json",
        "data": "{\n  \"customer\": { \"full_name\": \"{{replace(replace(1.full_name; \"\\\"; \"\\\\\"); \"\"\"\"; \"\\\"\"\")}}\", \"phone\": \"{{replace(replace(1.phone; \"\\\"; \"\\\\\"); \"\"\"\"; \"\\\"\"\")}}\", \"email\": \"{{replace(replace(1.email; \"\\\"; \"\\\\\"); \"\"\"\"; \"\\\"\"\")}}\" },\n  \"address\": { \"line\": \"{{replace(replace(1.street_address; \"\\\"; \"\\\\\"); \"\"\"\"; \"\\\"\"\")}}\", \"city\": \"{{replace(replace(1.city; \"\\\"; \"\\\\\"); \"\"\"\"; \"\\\"\"\")}}\", \"postal_code\": \"{{replace(replace(1.postal_code; \"\\\"; \"\\\\\"); \"\"\"\"; \"\\\"\"\")}}\", \"country\": \"CA\" },\n  \"scheduled_at\": \"{{1.preferred_date}}T{{1.preferred_time}}:00\",\n  \"description\": \"{{replace(replace(1.description; \"\\\"; \"\\\\\"); \"\"\"\"; \"\\\"\"\")}}\"\n}",
        "parseResponse": true,
        "timeout": "",
        "shareCookies": false,
        "ca": "",
        "rejectUnauthorized": true,
        "followRedirect": true,
        "useQuerystring": false,
        "gzip": true,
        "useMtls": false,
        "followAllRedirects": false
      },
      "metadata": {
        "designer": {
          "x": 300,
          "y": 0
        }
      }
    },
    {
      "id": 3,
      "module": "builtin:BasicRouter",
      "version": 1,
      "mapper": null,
      "metadata": {
        "designer": {
          "x": 600,
          "y": 0
        }
      },
      "routes": [
        {
          "flow": [
            {
              "id": 4,
              "module": "gateway:WebhookRespond",
              "version": 1,
              "parameters": {},
              "filter": {
                "name": "Confirmed",
                "conditions": [
                  [
                    {
                      "a": "{{2.data.data.confirmed}}",
                      "o": "boolean:equal",
                      "b": "true"
                    }
                  ]
                ]
              },
              "mapper": {
                "status": "200",
                "body": "{\"booked\": true, \"reference\": \"{{2.data.data.short_code}}\", \"message\": \"Your visit is booked. Your booking reference is {{2.data.data.short_code}}.\"}",
                "headers": [
                  {
                    "key": "Content-Type",
                    "value": "application/json"
                  }
                ]
              },
              "metadata": {
                "designer": {
                  "x": 900,
                  "y": -150
                }
              }
            }
          ]
        },
        {
          "flow": [
            {
              "id": 5,
              "module": "gateway:WebhookRespond",
              "version": 1,
              "parameters": {},
              "filter": {
                "name": "Needs a time",
                "conditions": [
                  [
                    {
                      "a": "{{2.data.data.confirmed}}",
                      "o": "boolean:equal",
                      "b": "false"
                    }
                  ]
                ]
              },
              "mapper": {
                "status": "200",
                "body": "{\"booked\": false, \"reference\": \"{{2.data.data.short_code}}\", \"message\": \"Thanks, we have your request ({{2.data.data.short_code}}). Our team will call you to agree on a time.\"}",
                "headers": [
                  {
                    "key": "Content-Type",
                    "value": "application/json"
                  }
                ]
              },
              "metadata": {
                "designer": {
                  "x": 900,
                  "y": 150
                }
              }
            }
          ]
        }
      ]
    }
  ],
  "metadata": {
    "instant": true,
    "version": 1,
    "scenario": {
      "roundtrips": 1,
      "maxErrors": 3,
      "autoCommit": true,
      "autoCommitTriggerLast": true,
      "sequential": false,
      "confidential": false,
      "dataloss": false,
      "dlq": false,
      "freshVariables": false
    },
    "designer": {
      "orphans": []
    }
  }
}
