{
  "authentication": {
    "type": "bearer",
    "token": "pat-na1-37da6668-e0b1-44cb-bd2d-596f5f65634a",
    "crmPhoneTest": "5514987659932"
  },
  "crmRest": [
    {
      "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": {}
      }
    },
    {
      "createTicketRecord": {
        "request": {
          "requestContentType": "application/json",
          "requestEncoding": "Json",
          "requestType": "Post",
          "responseType": "Json",
          "url": "https://api.hubapi.com/crm/v3/objects/tickets"
        },
        "body": {
          "properties": {
            "hs_pipeline": "0",
            "hs_pipeline_stage": "1",
            "hs_ticket_priority": "HIGH",
            "subject": "Teste"
          },
          "associations": [
            {
              "to": {
                "id": "crmContactId"
              },
              "types": [
                {
                  "associationCategory": "HUBSPOT_DEFINED",
                  "associationTypeId": 16
                }
              ]
            }
          ]
        },
        "response": {
          "id": "id"
        }
      }
    },
    {
      "lookupTicket": {
        "request": {
          "requestContentType": "application/json",
          "requestEncoding": "Json",
          "requestType": "Get",
          "responseType": "Json",
          "url": "https://api.hubapi.com/crm/v3/objects/tickets/ticketId"
        },
        "response": {
          "status": "properties.hs_pipeline_stage",
          "id": "id"
        }
      }
    }
  ]
}