{
  "name": "SmileCloud – Facebook Lead Ads → ליד",
  "flow": [
    {
      "id": 1,
      "module": "facebook-lead-ads:NewLeadMultiple",
      "version": 2,
      "metadata": {
        "designer": {
          "x": 0,
          "y": 0,
          "name": "New Lead"
        }
      }
    },
    {
      "id": 2,
      "module": "facebook-lead-ads:GetLeadDetails",
      "version": 2,
      "filter": null,
      "mapper": {
        "leadId": "{{1.id}}"
      },
      "metadata": {
        "designer": {
          "x": 300,
          "y": 0,
          "name": "Get Lead Details"
        }
      }
    },
    {
      "id": 3,
      "module": "http:MakeRequest",
      "version": 4,
      "parameters": {
        "tlsType": "",
        "authenticationType": "noAuth"
      },
      "mapper": {
        "url": "https://api.smile-app.co.il/v1/leads",
        "method": "post",
        "headers": [
          {
            "name": "Authorization",
            "value": "Bearer sk_live_PASTE_YOUR_CLINIC_KEY_HERE"
          }
        ],
        "timeout": "40",
        "contentType": "json",
        "inputMethod": "jsonString",
        "shareCookies": false,
        "parseResponse": true,
        "allowRedirects": true,
        "stopOnHttpError": true,
        "jsonStringBodyContent": "{\n  \"first_name\": \"{{first(split(2.full_name; \\\" \\\"))}}\",\n  \"last_name\": \"{{join(slice(split(2.full_name; \\\" \\\"); 1); \\\" \\\")}}\",\n  \"phone\": \"{{2.phone_number}}\",\n  \"email\": \"{{2.email}}\",\n  \"source\": \"facebook\",\n  \"external_id\": \"{{2.id}}\",\n  \"note\": \"Facebook Lead Ad form: {{2.form_name}}\",\n  \"attribution\": {\n    \"utm_source\": \"{{2.platform}}\",\n    \"utm_medium\": \"lead_ad\",\n    \"campaign_name\": \"{{2.campaign_name}}\",\n    \"ad_headline\": \"{{2.ad_name}}\",\n    \"ad_id\": \"{{2.ad_id}}\",\n    \"form_name\": \"{{2.form_name}}\"\n  }\n}",
        "requestCompressedContent": true
      },
      "metadata": {
        "designer": {
          "x": 600,
          "y": 0,
          "name": "Send to SmileCloud"
        },
        "restore": {
          "expect": {
            "method": {
              "mode": "chose",
              "label": "POST"
            },
            "headers": {
              "mode": "chose",
              "items": [
                null
              ]
            },
            "contentType": {
              "label": "application/jsonEnter data in the JSON format, as a string or using a data structure."
            },
            "inputMethod": {
              "label": "JSON stringEnter the JSON body as a raw text string. If values contain JSON reserved characters, you must escape them manually."
            },
            "shareCookies": {
              "mode": "chose"
            },
            "parseResponse": {
              "mode": "chose"
            },
            "allowRedirects": {
              "mode": "chose"
            },
            "paginationType": {
              "label": "Empty"
            },
            "queryParameters": {
              "mode": "chose"
            },
            "stopOnHttpError": {
              "mode": "chose"
            },
            "requestCompressedContent": {
              "mode": "chose"
            }
          },
          "parameters": {
            "tlsType": {
              "label": "Empty"
            },
            "authenticationType": {
              "label": "No authenticationUse when no credentials are required for the request."
            }
          }
        },
        "parameters": [
          {
            "name": "authenticationType",
            "type": "select",
            "label": "Authentication type",
            "required": true,
            "validate": {
              "enum": [
                "noAuth",
                "apiKeyConnection",
                "basicAuthConnection",
                "oAuth",
                "apiKey",
                "basicAuth"
              ]
            }
          },
          {
            "name": "tlsType",
            "type": "select",
            "label": "Transport layer security (TLS)",
            "validate": {
              "enum": [
                "mTls",
                "tls"
              ]
            }
          },
          {
            "name": "proxyKeychain",
            "type": "keychain:proxy",
            "label": "Proxy"
          }
        ],
        "expect": [
          {
            "name": "url",
            "type": "url",
            "label": "URL",
            "required": true
          },
          {
            "name": "method",
            "type": "select",
            "label": "Method",
            "required": true,
            "validate": {
              "enum": [
                "get",
                "head",
                "post",
                "put",
                "patch",
                "delete",
                "options"
              ]
            }
          },
          {
            "name": "headers",
            "spec": {
              "name": "value",
              "spec": [
                {
                  "name": "name",
                  "type": "text",
                  "label": "Name",
                  "required": true,
                  "validate": {
                    "pattern": "^[-!#$%&'*+.^_`|~0-9A-Za-z]+$"
                  }
                },
                {
                  "name": "value",
                  "type": "text",
                  "label": "Value"
                }
              ],
              "type": "collection",
              "label": "Header"
            },
            "type": "array",
            "label": "Headers"
          },
          {
            "name": "queryParameters",
            "spec": {
              "name": "value",
              "spec": [
                {
                  "name": "name",
                  "type": "text",
                  "label": "Name",
                  "required": true
                },
                {
                  "name": "value",
                  "type": "text",
                  "label": "Value"
                }
              ],
              "type": "collection",
              "label": "Parameter"
            },
            "type": "array",
            "label": "Query parameters"
          },
          {
            "name": "contentType",
            "type": "select",
            "label": "Body content type",
            "validate": {
              "enum": [
                "json",
                "multipart",
                "urlEncoded",
                "custom"
              ]
            }
          },
          {
            "name": "parseResponse",
            "type": "boolean",
            "label": "Parse response",
            "required": true
          },
          {
            "name": "stopOnHttpError",
            "type": "boolean",
            "label": "Return error if HTTP request fails",
            "required": true
          },
          {
            "name": "timeout",
            "type": "uinteger",
            "label": "Timeout",
            "validate": {
              "max": 300,
              "min": 1
            }
          },
          {
            "name": "allowRedirects",
            "type": "boolean",
            "label": "Allow redirects",
            "required": true
          },
          {
            "name": "shareCookies",
            "type": "boolean",
            "label": "Share cookies with other HTTP modules",
            "required": true
          },
          {
            "name": "requestCompressedContent",
            "type": "boolean",
            "label": "Request compressed content",
            "required": true
          },
          {
            "name": "inputMethod",
            "type": "select",
            "label": "Body input method",
            "required": true,
            "validate": {
              "enum": [
                "dataStructure",
                "jsonString"
              ]
            }
          },
          {
            "name": "jsonStringBodyContent",
            "type": "text",
            "label": "Body content",
            "required": true
          },
          {
            "name": "paginationType",
            "type": "select",
            "label": "Pagination type",
            "validate": {
              "enum": [
                "offsetBased",
                "pageBased",
                "urlBased",
                "tokenBased"
              ]
            }
          }
        ],
        "interface": [
          {
            "name": "data",
            "type": "any",
            "label": "Data"
          },
          {
            "name": "statusCode",
            "type": "number",
            "label": "Status Code"
          },
          {
            "name": "headers",
            "spec": [
              {
                "name": "content-length",
                "type": "text",
                "label": "Content-Length"
              },
              {
                "name": "content-encoding",
                "type": "text",
                "label": "Content-Encoding"
              },
              {
                "name": "content-type",
                "type": "text",
                "label": "Content-Type"
              },
              {
                "name": "server",
                "type": "text",
                "label": "Server"
              },
              {
                "name": "cache-control",
                "type": "text",
                "label": "Cache-Control"
              },
              {
                "name": "set-cookie",
                "spec": {
                  "type": "text"
                },
                "type": "array",
                "label": "Set-Cookie"
              }
            ],
            "type": "collection",
            "label": "Headers"
          }
        ]
      }
    }
  ],
  "metadata": {
    "instant": true,
    "version": 1,
    "scenario": {
      "roundtrips": 1,
      "maxErrors": 3,
      "autoCommit": true,
      "autoCommitTriggerLast": true,
      "sequential": false,
      "slots": null,
      "confidential": false,
      "dataloss": false,
      "dlq": false,
      "freshVariables": false
    },
    "designer": {
      "orphans": []
    },
    "zone": "eu1.make.com"
  }
}