feat: Add frontend to visualize CRM contact insertion tests

feat/hitphone-socket-integration
adriano 2024-04-15 17:07:25 -03:00
parent 2bf8609714
commit 050d711abc
21 changed files with 864 additions and 8 deletions

View File

@ -0,0 +1,106 @@
{
"authentication": {
"type": "basic",
"userName": "bWEWHgp8FZJmiprOU62M",
"passWord": "X",
"crmPhoneTest":"5516988310022"
},
"crmRest": [
{
"createContactRecord": {
"request": {
"requestContentType": "application/json",
"requestEncoding": "Json",
"requestType": "Post",
"responseType": "Json",
"url": "https://thaline.freshdesk.com/api/v2/contacts"
},
"body": {
"name": "crmFirstName",
"email": "crmEmail",
"phone": "crmPhone"
},
"response": {
"id": "id"
}
}
},
{
"lookupContactByPhone": {
"request": {
"requestContentType": "application/json",
"requestEncoding": "Json",
"requestType": "Get",
"responseType": "Json",
"url": "https://thaline.freshdesk.com/api/v2/contacts?phone=crmPhone"
},
"response": {
"phone": "phone",
"id": "id"
}
}
},
{
"callJournaling": {
"request": {
"requestContentType": "application/json",
"requestEncoding": "Json",
"requestType": "Post",
"responseType": "Json",
"url": "https://thaline.freshdesk.com/api/v2/tickets"
},
"calls": [
{
"inboundAnsweredCall": {
"phone": { "_prop": "crmPhone", "_type": "string" },
"description": "Ligação recebida",
"requester_id": { "_prop": "crmContactId", "_type": "number" },
"subject": "Cliente ligou",
"type": "Question",
"status": 2,
"priority": 1,
"source": 3
}
},
{
"inboundMissedCall": {
"phone": { "_prop": "crmPhone", "_type": "string" },
"description": "Ligação Perdida",
"requester_id": { "_prop": "crmContactId", "_type": "number" },
"subject": "Cliente ligou",
"type": "Question",
"status": 2,
"priority": 1,
"source": 3
}
},
{
"outboundAnsweredCall": {
"phone": { "_prop": "crmPhone", "_type": "string" },
"description": "Ligação para cliente",
"requester_id": { "_prop": "crmContactId", "_type": "number" },
"subject": "Ligação atendida",
"type": "Question",
"status": 2,
"priority": 1,
"source": 3
}
},
{
"outboundUnansweredCall": {
"phone": { "_prop": "crmPhone", "_type": "string" },
"description": "Ligação para cliente perdida",
"requester_id": { "_prop": "crmContactId", "_type": "number" },
"subject": "Ligação para cliente",
"type": "Question",
"status": 2,
"priority": 1,
"source": 3
}
}
],
"response": {}
}
}
]
}

View File

@ -0,0 +1,96 @@
{
"authentication":{
"type": "bearer",
"token": "pat-na1-7aca13dd-9ba5-48db-bf35-570844d31abb",
"crmPhoneTest": "5511988334455"
},
"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"
}
}
}
],
"response":{
}
}
}
]
}

View File

@ -0,0 +1,216 @@
{
"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": {}
}
}
]
}

View File

@ -0,0 +1,103 @@
{
"authentication": {
"type": "api_token",
"token": "1c97c52596abc18d3f727df3a620b5ef3f4f7d29",
"crmPhoneTest": "5511988334455"
},
"crmRest": [
{
"createContactRecord": {
"request": {
"requestContentType": "application/json",
"requestEncoding": "Json",
"requestType": "Post",
"responseType": "Json",
"url": "https://api.pipedrive.com/v1/persons"
},
"body": {
"name": "crmFirstName",
"phone": [
{
"value": "crmPhone",
"primary": true,
"label": "mobile"
}
]
},
"response": {
"id": "data.id"
}
}
},
{
"lookupContactByPhone": {
"request": {
"requestContentType": "application/json",
"requestEncoding": "Json",
"requestType": "Get",
"responseType": "Json",
"url": "https://api.pipedrive.com/v1/persons/search?term=crmPhone"
},
"response": {
"phone": "data.items.item.phones[0]",
"id": "data.item.id"
}
}
},
{
"callJournaling": {
"request": {
"requestContentType": "application/json",
"requestEncoding": "Json",
"requestType": "Post",
"responseType": "Json",
"url": "https://api.hubapi.com/engagements/v1/engagements"
},
"calls": [
{
"inboundAnsweredCall": {
"subject": "Ligação recebida",
"type": "Call",
"person_id": "crmContactId",
"done": "1",
"deal_id": "2",
"note": "Ligação recebida +crmPhone"
}
},
{
"inboundMissedCall": {
"subject": "Ligação perdida",
"type": "Call",
"person_id": "crmContactId",
"done": "0",
"deal_id": "2",
"note": "Ligação perdida +crmPhone"
}
},
{
"outboundAnsweredCall": {
"subject": "Ligação realizada",
"type": "Call",
"person_id": "crmContactId",
"done": "1",
"deal_id": "2",
"note": "Ligação realizada para +crmPhone"
}
},
{
"outboundUnansweredCall": {
"subject": "Ligação realizada perdida",
"type": "Call",
"person_id": "crmContactId",
"done": "0",
"deal_id": "2",
"note": "Ligação realizada para +crmPhone"
}
}
],
"response": {}
}
}
]
}

View File

@ -0,0 +1,176 @@
{
"authentication": {
"type": "oauth2",
"crmClientId": "1000.DCMOEV7VHQ4YJ729VFLLV1HPLGD4PG",
"crmClientSecret": "9d1afc9c16708ac798b6884ed5895a19a7f8b389b6",
"crmScopes": "ZohoCRM.modules.accounts.all,ZohoCRM.modules.leads.all,ZohoCRM.modules.contacts.all,ZohoCRM.modules.calls.all",
"crmPhoneTest": "5516920242024"
},
"crmRest": [
{
"authorizationEndpoint": {
"request": {
"requestContentType": "empty",
"requestEncoding": "empty",
"requestType": "Get",
"responseType": "empty",
"url": "https://accounts.zoho.com/oauth/v2/auth?scope=crmScopes&client_id=crmClientId&response_type=code&access_type=offline&redirect_uri=crmRedirectURI"
},
"body": {},
"response": {}
}
},
{
"tokenEndpoint": {
"request": {
"requestContentType": "none",
"requestEncoding": "Json",
"requestType": "Post",
"responseType": "Json",
"url": "https://accounts.zoho.com/oauth/v2/token"
},
"body": {},
"response": {}
}
},
{
"createContactRecord": {
"request": {
"requestContentType": "application/json",
"requestEncoding": "Json",
"requestType": "Post",
"responseType": "Json",
"url": "https://www.zohoapis.com/crm/v5/Contacts"
},
"body": {
"data": [
{
"Phone": "crmPhone",
"Last_Name": "crmLastName"
}
]
},
"response": {
"id": "data.details.id"
}
}
},
{
"lookupContactByPhone": {
"request": {
"requestContentType": "application/json",
"requestEncoding": "Json",
"requestType": "Get",
"responseType": "Json",
"url": "https://www.zohoapis.com/crm/v5/Contacts/search?phone=crmPhone"
},
"response": {
"phone": "data.Phone",
"id": "data.id"
}
}
},
{
"callJournaling": {
"request": {
"requestContentType": "application/json",
"requestEncoding": "Json",
"requestType": "Post",
"responseType": "Json",
"url": "https://www.zohoapis.com/crm/v5/Calls"
},
"calls": [
{
"inboundAnsweredCall": {
"data": [
{
"Who_Id": {
"id": "crmContactId"
},
"Description": "Ligação recebida",
"Call_Start_Time": {
"_prop": "crmCallDateTime",
"_type": "string",
"_format": "ISO8601"
},
"Subject": "Ligação",
"Call_Type": "Inbound",
"Outbound_Call_Status": "Completed",
"Call_Duration": {
"_prop": "crmCallDuration",
"_format": "hh:mm",
"_type": "string"
},
"Call_Purpose": "Administrative"
}
]
}
},
{
"inboundMissedCall": {
"data": [
{
"Who_Id": {
"id": "crmContactId"
},
"Description": "Inbound missed call",
"Call_Start_Time": {
"_prop": "crmCallDateTime",
"_type": "string",
"_format": "ISO8601"
},
"Subject": "Ligação perdida",
"Call_Type": "Inbound",
"Call_Purpose": "Administrative"
}
]
}
},
{
"outboundAnsweredCall": {
"data": [
{
"Who_Id": {
"id": "crmContactId"
},
"Description": "Outbound answered call",
"Call_Start_Time": {
"_prop": "crmCallDateTime",
"_type": "string",
"_format": "ISO8601"
},
"Subject": "Ligação realizada",
"Call_Type": "Outbound",
"Outbound_Call_Status": "Completed",
"Call_Duration": "crmCallDuration",
"Call_Purpose": "Administrative"
}
]
}
},
{
"outboundUnansweredCall": {
"data": [
{
"Who_Id": {
"id": "crmContactId"
},
"Description": "Outbound missed call",
"Call_Start_Time": {
"_prop": "crmCallDateTime",
"_type": "string",
"_format": "ISO8601"
},
"Subject": "Ligação perdida",
"Call_Type": "Outbound",
"Call_Purpose": "Administrative"
}
]
}
}
],
"response": {}
}
}
]
}

View File

@ -12,7 +12,7 @@ async function requestConfigHeader(url, crmPhone, requestType, requestContentTyp
}
}
if (data) {
if (data) {
commonConfig = { ...commonConfig, data }
}
@ -43,6 +43,14 @@ async function requestConfigHeader(url, crmPhone, requestType, requestContentTyp
}
}
}
else if (type === 'api_token') {
config = {
...commonConfig,
headers: {
...commonConfig.headers,
}
}
}
return config
}

View File

@ -0,0 +1,13 @@
{
"files": {
"main.css": "/static/css/main.ae60ab08.css",
"main.js": "/static/js/main.f5640aba.js",
"index.html": "/index.html",
"main.ae60ab08.css.map": "/static/css/main.ae60ab08.css.map",
"main.f5640aba.js.map": "/static/js/main.f5640aba.js.map"
},
"entrypoints": [
"static/css/main.ae60ab08.css",
"static/js/main.f5640aba.js"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@ -0,0 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>React App</title><script defer="defer" src="/static/js/main.f5640aba.js"></script><link href="/static/css/main.ae60ab08.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

View File

@ -0,0 +1,25 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}

View File

@ -0,0 +1,3 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,61 @@
/*
object-assign
(c) Sindre Sorhus
@license MIT
*/
/*!
Copyright (c) 2015 Jed Watson.
Based on code that is Copyright 2013-2015, Facebook, Inc.
All rights reserved.
*/
/*!
* Adapted from jQuery UI core
*
* http://jqueryui.com
*
* Copyright 2014 jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://api.jqueryui.com/category/ui-core/
*/
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
/** @license React v0.20.2
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/** @license React v17.0.2
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/** @license React v17.0.2
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/** @license React v17.0.2
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

File diff suppressed because one or more lines are too long

View File

@ -15,6 +15,8 @@
"@testing-library/react": "^12.1.3",
"@testing-library/user-event": "^13.5.0",
"axios": "^1.3.5",
"dotenv": "^16.3.1",
"express": "^4.18.2",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-modal": "^3.16.1",
@ -7050,11 +7052,14 @@
}
},
"node_modules/dotenv": {
"version": "10.0.0",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz",
"integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==",
"version": "16.3.1",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.3.1.tgz",
"integrity": "sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==",
"engines": {
"node": ">=10"
"node": ">=12"
},
"funding": {
"url": "https://github.com/motdotla/dotenv?sponsor=1"
}
},
"node_modules/dotenv-expand": {
@ -14930,6 +14935,14 @@
}
}
},
"node_modules/react-scripts/node_modules/dotenv": {
"version": "10.0.0",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz",
"integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==",
"engines": {
"node": ">=10"
}
},
"node_modules/read-cache": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz",
@ -22896,9 +22909,9 @@
}
},
"dotenv": {
"version": "10.0.0",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz",
"integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q=="
"version": "16.3.1",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.3.1.tgz",
"integrity": "sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ=="
},
"dotenv-expand": {
"version": "5.1.0",
@ -28525,6 +28538,13 @@
"webpack-dev-server": "^4.6.0",
"webpack-manifest-plugin": "^4.0.2",
"workbox-webpack-plugin": "^6.4.1"
},
"dependencies": {
"dotenv": {
"version": "10.0.0",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz",
"integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q=="
}
}
},
"read-cache": {

View File

@ -10,6 +10,8 @@
"@testing-library/react": "^12.1.3",
"@testing-library/user-event": "^13.5.0",
"axios": "^1.3.5",
"dotenv": "^16.3.1",
"express": "^4.18.2",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-modal": "^3.16.1",

19
frontend/server.js 100644
View File

@ -0,0 +1,19 @@
const express =require('express')
const path = require('path')
require('dotenv').config()
const app = express()
const PORT = process.env.REACT_APP_PORT || 6003
console.log('FRONTEND PORT: ', PORT)
app.use(express.static(path.join(process.cwd(), 'build')))
app.get('*', (req, res) => {
res.sendFile(path.join(process.cwd(), 'build', 'index.html'))
})
app.listen(PORT, () => {
console.log(`Server is running on port ${PORT}`)
})