{
  "name": "Jsonpage - Monitoring alert to Slack or Teams and a HubSpot task",
  "flow": [
    {
      "id": 1,
      "module": "gateway:CustomWebHook",
      "version": 1,
      "parameters": {
        "hook": null,
        "maxResults": 1
      },
      "mapper": {},
      "metadata": {
        "designer": {
          "x": 0,
          "y": 0,
          "name": "Jsonpage webhook (paste its address in the Monitoring section)"
        }
      }
    },
    {
      "id": 3,
      "module": "http:ActionSendData",
      "version": 3,
      "parameters": {
        "handleErrors": false,
        "useNewZLibDeCompress": true
      },
      "mapper": {
        "url": "https://api.jsonpage.com/v2/companies/{{1.company_id}}",
        "method": "get",
        "headers": [
          {
            "name": "X-API-Key",
            "value": "PASTE_YOUR_JSONPAGE_API_KEY"
          }
        ],
        "qs": [],
        "bodyType": "",
        "contentType": "",
        "parseResponse": true,
        "serializeUrl": false,
        "shareCookies": false,
        "followRedirect": true,
        "useMtls": false,
        "rejectUnauthorized": true,
        "evaluateAllStates": false,
        "timeout": ""
      },
      "metadata": {
        "designer": {
          "x": 300,
          "y": 0,
          "name": "Company name"
        }
      }
    },
    {
      "id": 4,
      "module": "builtin:BasicRouter",
      "version": 1,
      "mapper": null,
      "metadata": {
        "designer": {
          "x": 600,
          "y": 0
        }
      },
      "routes": [
        {
          "flow": [
            {
              "id": 5,
              "module": "http:ActionSendData",
              "version": 3,
              "parameters": {
                "handleErrors": false,
                "useNewZLibDeCompress": true
              },
              "mapper": {
                "url": "PASTE_YOUR_SLACK_WEBHOOK_URL",
                "method": "post",
                "headers": [],
                "qs": [],
                "bodyType": "raw",
                "contentType": "application/json",
                "parseResponse": true,
                "serializeUrl": false,
                "shareCookies": false,
                "followRedirect": true,
                "useMtls": false,
                "rejectUnauthorized": true,
                "evaluateAllStates": false,
                "timeout": "",
                "data": "{\"text\": \"Jsonpage: {{ifempty(3.data.data.name; 1.company_id)}} ({{1.company_id}}) {{1.type}} {{1.data.before}} -> {{1.data.after}} - {{1.detected_at}}\"}"
              },
              "metadata": {
                "designer": {
                  "x": 900,
                  "y": -200,
                  "name": "Slack message (delete this route if you use Teams)"
                }
              }
            }
          ]
        },
        {
          "flow": [
            {
              "id": 6,
              "module": "http:ActionSendData",
              "version": 3,
              "parameters": {
                "handleErrors": false,
                "useNewZLibDeCompress": true
              },
              "mapper": {
                "url": "PASTE_YOUR_TEAMS_WORKFLOW_WEBHOOK_URL",
                "method": "post",
                "headers": [],
                "qs": [],
                "bodyType": "raw",
                "contentType": "application/json",
                "parseResponse": true,
                "serializeUrl": false,
                "shareCookies": false,
                "followRedirect": true,
                "useMtls": false,
                "rejectUnauthorized": true,
                "evaluateAllStates": false,
                "timeout": "",
                "data": "{\"type\": \"message\", \"attachments\": [{\"contentType\": \"application/vnd.microsoft.card.adaptive\", \"content\": {\"$schema\": \"http://adaptivecards.io/schemas/adaptive-card.json\", \"type\": \"AdaptiveCard\", \"version\": \"1.4\", \"body\": [{\"type\": \"TextBlock\", \"text\": \"Jsonpage: {{ifempty(3.data.data.name; 1.company_id)}} ({{1.company_id}}) {{1.type}} {{1.data.before}} -> {{1.data.after}} - {{1.detected_at}}\", \"wrap\": true}]}}]}"
              },
              "metadata": {
                "designer": {
                  "x": 900,
                  "y": 0,
                  "name": "Teams message (delete this route if you use Slack)"
                }
              }
            }
          ]
        },
        {
          "flow": [
            {
              "id": 7,
              "module": "http:ActionSendData",
              "version": 3,
              "parameters": {
                "handleErrors": false,
                "useNewZLibDeCompress": true
              },
              "mapper": {
                "url": "https://api.hubapi.com/crm/v3/objects/tasks",
                "method": "post",
                "headers": [
                  {
                    "name": "Authorization",
                    "value": "Bearer PASTE_YOUR_HUBSPOT_PRIVATE_APP_TOKEN"
                  }
                ],
                "qs": [],
                "bodyType": "raw",
                "contentType": "application/json",
                "parseResponse": true,
                "serializeUrl": false,
                "shareCookies": false,
                "followRedirect": true,
                "useMtls": false,
                "rejectUnauthorized": true,
                "evaluateAllStates": false,
                "timeout": "",
                "data": "{\"properties\": {\"hs_timestamp\": \"{{formatDate(now; \\\"YYYY-MM-DDTHH:mm:ss.SSS\\\")}}Z\", \"hs_task_subject\": \"Check {{ifempty(3.data.data.name; 1.company_id)}}: {{1.type}}\", \"hs_task_body\": \"Jsonpage: {{ifempty(3.data.data.name; 1.company_id)}} ({{1.company_id}}) {{1.type}} {{1.data.before}} -> {{1.data.after}} - {{1.detected_at}}\", \"hs_task_status\": \"NOT_STARTED\", \"hs_task_priority\": \"HIGH\"}}"
              },
              "metadata": {
                "designer": {
                  "x": 900,
                  "y": 200,
                  "name": "HubSpot task"
                }
              },
              "filter": {
                "name": "Not a test event",
                "conditions": [
                  [
                    {
                      "a": "{{1.type}}",
                      "o": "text:notequal",
                      "b": "test"
                    }
                  ]
                ]
              }
            }
          ]
        }
      ]
    }
  ],
  "metadata": {
    "instant": false,
    "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"
  }
}
