{
    "authentication":{
       "type":"bearer",
       "token":"pat-na1-e83c1bfa-1a58-498b-8027-f6fdbb9f237d",
       "crmPhoneTest":"5514987659932",
       "crmAccountId":"23636141"
    },
    "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 - Chamada entrante",
                         "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 - Chamada entrante",
                         "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"
                      }
                   }
                }
             ]
          }
       },
       {
          "createTicketRecord":{
             "request":{
                "requestContentType":"application/json",
                "requestEncoding":"Json",
                "requestType":"Post",
                "responseType":"Json",
                "url":"https://api.hubapi.com/crm/v3/objects/tickets"
             },
             "body":{
                "properties":{
                   "hs_pipeline":"24955700",
                   "hs_pipeline_stage":"57851009",
                   "hs_ticket_priority":"HIGH",
                   "subject":"Ticket criado a partir da URA"
                },
                "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"
             }
          }
       }
    ]
  }