{
  "authentication": {
    "type": "oauth2",
    "crmClientId": "8b290b22-5fd9-40d0-97ae-f5f500ad46f1",
    "crmClientSecret": "7a5c9d7c-83aa-4268-9073-9f70721c00ae",
    "crmScopes": "crm.objects.contacts.write crm.objects.contacts.read",
    "crmPhoneTest": "5511988334455"
  },
  "crmRest": [
    {
      "authorizationEndpoint": {
        "request": {
          "requestContentType": "empty",
          "requestEncoding": "empty",
          "requestType": "Get",
          "responseType": "empty",
          "url": "https://app.hubspot.com/oauth/authorize?client_id=crmClientId&scope=crmScopes&redirect_uri=crmRedirectURI"
        },
        "body": {},
        "response": {}
      }
    },
    {
      "tokenEndpoint": {
        "request": {
          "requestContentType": "application/x-www-form-urlencoded",
          "requestEncoding": "Json",
          "requestType": "Post",
          "responseType": "Json",
          "url": "https://api.hubapi.com/oauth/v1/token"
        },
        "body": { 
        },
        "response": {
        }
      }
    },
    {
      "createContactRecord": {
        "request": {
          "requestContentType": "application/json",
          "requestEncoding": "Json",
          "requestType": "Post",
          "responseType": "Json",
          "url": "https://api.hubapi.com/contacts/v1/contact"
        },
        "body": {
          "properties": [
            {
              "property": "phone",
              "value": "crmPhone"
            }
          ]
        },
        "response": {
          "id": "vid"
        }
      }
    },
    {
      "lookupContactByPhone": {
        "request": {
          "requestContentType": "application/json",
          "requestEncoding": "Json",
          "requestType": "Get",
          "responseType": "Json",
          "url": "https://api.hubapi.com/contacts/v1/search/query?q=crmPhone"
        },
        "response": {
          "phone": "contacts.properties.phone.value",
          "id": "contacts.vid"
        }
      }
    },
    {
      "callJournaling": {
        "request": {
          "requestContentType": "application/json",
          "requestEncoding": "Json",
          "requestType": "Post",
          "responseType": "Json",
          "url": "https://api.hubapi.com/engagements/v1/engagements"
        },
        "calls": [
          {
            "inboundAnsweredCall": {
              "engagement": {
                "active": true,
                "type": "CALL"
              },
              "associations": {
                "contactIds": [
                  {
                    "_prop": "crmContactId",
                    "_type": "number"
                  }
                ]
              },
              "metadata": {
                "toNumber": {
                  "_prop": "crmAgent",
                  "_type": "string"
                },
                "fromNumber": {
                  "_prop": "crmPhone",
                  "_type": "string"
                },
                "status": "COMPLETED",
                "durationMilliseconds": {
                  "_prop": "crmCallDuration",
                  "_type": "number",
                  "_format": "milliseconds"
                },
                "body": "Ligação recebida - inbound call",
                "disposition": "f240bbac-87c9-4f6e-bf70-924b57d47db7"
              }
            }
          },
          {
            "inboundMissedCall": {
              "engagement": {
                "active": true,
                "type": "CALL"
              },
              "associations": {
                "contactIds": [
                  {
                    "_prop": "crmContactId",
                    "_type": "number"
                  }
                ]
              },
              "metadata": {
                "toNumber": {
                  "_prop": "crmAgent",
                  "_type": "string"
                },
                "fromNumber": {
                  "_prop": "crmPhone",
                  "_type": "string"
                },
                "status": "COMPLETED",
                "body": "Ligação perdida - inbound call",
                "disposition": "f240bbac-87c9-4f6e-bf70-924b57d47db7"
              }
            }
          },
          {
            "outboundAnsweredCall": {
              "engagement": {
                "active": true,
                "type": "CALL"
              },
              "associations": {
                "contactIds": [
                  {
                    "_prop": "crmContactId",
                    "_type": "number"
                  }
                ]
              },
              "metadata": {
                "fromNumber": {
                  "_prop": "crmPhone",
                  "_type": "string"
                },
                "toNumber": {
                  "_prop": "crmAgent",
                  "_type": "string"
                },
                "status": "COMPLETED",
                "durationMilliseconds": {
                  "_prop": "crmCallDuration",
                  "_type": "number",
                  "_format": "milliseconds"
                },
                "body": "Ligação atendida - outbound call",
                "disposition": "f240bbac-87c9-4f6e-bf70-924b57d47db7"
              }
            }
          },
          {
            "outboundUnansweredCall": {
              "engagement": {
                "active": true,
                "type": "CALL"
              },
              "associations": {
                "contactIds": [
                  {
                    "_prop": "crmContactId",
                    "_type": "number"
                  }
                ]
              },
              "metadata": {
                "fromNumber": {
                  "_prop": "crmAgent",
                  "_type": "string"
                },
                "toNumber": {
                  "_prop": "crmPhone",
                  "_type": "string"
                },
                "status": "COMPLETED",
                "body": "Ligação perdida - oubound call",
                "disposition": "f240bbac-87c9-4f6e-bf70-924b57d47db7"
              }
            }
          }
        ],
        "response": {}
      }
    }
  ]
}
