UNPKG

5.27 kBJavaScriptView Raw
1const createChasitorRequestBody = ({ organizationId, deploymentId, buttonId, sessionId, trackingId, userAgent, language, screenResolution, visitorName, visitorEmail, visitorHistory, visitorCPF }) => ({
2 organizationId,
3 deploymentId,
4 buttonId,
5 sessionId,
6 visitorName: visitorName || 'Robot Visitor',
7 emailBOT: visitorEmail || "a@a.com",
8 customerName: visitorName || 'Robot Visitor',
9 customerCPF: visitorCPF,
10 Description: visitorHistory,
11 contaRico: visitorCPF,
12 trackingId: trackingId || '',
13 userAgent: userAgent || '',
14 language: language || 'en_US',
15 screenResolution: screenResolution || '640x480',
16 prechatDetails: [
17 {
18 "label": "caseSubject",
19 "value": "Contato por Chat",
20 "entityMaps": [],
21 "transcriptFields": [],
22 "displayToAgent": "true",
23 "doKnowledgeSearch": false
24 },
25 {
26 "label": "caseOrigin",
27 "value": "Chat Facebook",
28 "entityMaps": [],
29 "transcriptFields": [],
30 "displayToAgent": "true",
31 "doKnowledgeSearch": false
32 },
33 {
34 "label": "CaseRecordType",
35 "value": "01237000000Ri5YAAS",
36 "entityMaps": [],
37 "transcriptFields": [],
38 "displayToAgent": "true",
39 "doKnowledgeSearch": false
40 },
41 {
42 "label": "contaRico",
43 "value": "",
44 "entityMaps": [],
45 "transcriptFields": [],
46 "displayToAgent": "true",
47 "doKnowledgeSearch": false
48 },
49 {
50 "label": "CaseType",
51 "value": "Externo",
52 "entityMaps": [],
53 "transcriptFields": [],
54 "displayToAgent": "true",
55 "doKnowledgeSearch": false
56 },
57 {
58 "label": "emailBOT",
59 "value": visitorEmail,
60 "entityMaps": [],
61 "transcriptFields": [],
62 "displayToAgent": "true",
63 "doKnowledgeSearch": false
64 },
65 {
66 "label": "customerCPF",
67 "value": visitorCPF,
68 "entityMaps": [],
69 "transcriptFields": [],
70 "displayToAgent": "true",
71 "doKnowledgeSearch": false
72 },
73 {
74 "label": "descricaoBOT",
75 "value": visitorHistory,
76 "entityMaps": [],
77 "transcriptFields": [
78 "Transcricao_BOT__c"
79 ],
80 "displayToAgent": "true",
81 "doKnowledgeSearch": false
82 },
83 {
84 "label": "AccountRecordType",
85 "value": "01237000000RgoCAAS",
86 "entityMaps": [],
87 "transcriptFields": [],
88 "displayToAgent": "true",
89 "doKnowledgeSearch": false
90 },
91 {
92 "label": "customerName",
93 "value": visitorName,
94 "entityMaps": [],
95 "transcriptFields": [],
96 "displayToAgent": "true",
97 "doKnowledgeSearch": false
98 },
99 {
100 "label": "ContactRecordType",
101 "value": "01237000000RgsxAAC",
102 "entityMaps": [],
103 "transcriptFields": [],
104 "displayToAgent": "true",
105 "doKnowledgeSearch": false
106 },
107 {
108 "label": "eContaRico",
109 "value": "true",
110 "entityMaps": [],
111 "transcriptFields": [],
112 "displayToAgent": "true",
113 "doKnowledgeSearch": false
114 }
115 ],
116 "buttonOverrides": [],
117 "receiveQueueUpdates": true,
118 "prechatEntities": [
119 {
120 "entityName": "Account",
121 "showOnCreate": "false",
122 "linkToEntityName": null,
123 "linkToEntityField": null,
124 "saveToTranscript": null,
125 "entityFieldsMaps": [
126
127 ]
128 },
129 {
130 "entityName": "Contact",
131 "showOnCreate": "false",
132 "linkToEntityName": null,
133 "linkToEntityField": null,
134 "saveToTranscript": "ContactId",
135 "entityFieldsMaps": [
136 {
137 "fieldName": "RecordTypeId",
138 "label": "ContactRecordType",
139 "doFind": "true",
140 "isExactMatch": "true",
141 "doCreate": "false"
142 },
143 {
144 "fieldName": "Email",
145 "label": "emailBOT",
146 "doFind": "true",
147 "isExactMatch": "true",
148 "doCreate": "false"
149 }
150 ]
151 },
152 {
153 "entityName": "Case",
154 "showOnCreate": "false",
155 "linkToEntityName": null,
156 "linkToEntityField": null,
157 "saveToTranscript": "Case",
158 "entityFieldsMaps": [
159 {
160 "fieldName": "contaLiveAgent__c",
161 "label": "contaRico",
162 "doFind": "false",
163 "isExactMatch": "false",
164 "doCreate": "true"
165 },
166 {
167 "fieldName": "Tipo_de_caso_E_I__c",
168 "label": "CaseType",
169 "doFind": "false",
170 "isExactMatch": "false",
171 "doCreate": "true"
172 },
173 {
174 "fieldName": "Origin",
175 "label": "caseOrigin",
176 "doFind": "false",
177 "isExactMatch": "false",
178 "doCreate": "true"
179 },
180 {
181 "fieldName": "Subject",
182 "label": "caseSubject",
183 "doFind": "false",
184 "isExactMatch": "false",
185 "doCreate": "true"
186 },
187 {
188 "fieldName": "Description",
189 "label": "descricaoBOT",
190 "doFind": "false",
191 "isExactMatch": "false",
192 "doCreate": "true"
193 },
194 {
195 "fieldName": "RecordTypeId",
196 "label": "CaseRecordType",
197 "doFind": "false",
198 "isExactMatch": "false",
199 "doCreate": "true"
200 }
201 ]
202 }
203 ],
204 isPost: true
205});
206
207
208
209module.exports = { createChasitorRequestBody };