Adding telemetry and testharness code
This commit is contained in:
15
Integrations/Proxy Scripts/latency_span.js
Normal file
15
Integrations/Proxy Scripts/latency_span.js
Normal file
@@ -0,0 +1,15 @@
|
||||
const conversationId = req.body.conversationId;
|
||||
const startTime = req.body.startTime;
|
||||
|
||||
(async () => {
|
||||
try {
|
||||
const span = await latencySpan().startSpan(conversationId, startTime);
|
||||
|
||||
res.send(span);
|
||||
} catch (error) {
|
||||
console.log(error.message);
|
||||
res.send({
|
||||
error: error.message,
|
||||
});
|
||||
}
|
||||
})();
|
||||
24
Integrations/Proxy Scripts/salesforce_mock.js
Normal file
24
Integrations/Proxy Scripts/salesforce_mock.js
Normal file
@@ -0,0 +1,24 @@
|
||||
(async () => {
|
||||
const caseId = "003abc000123xyzabc";
|
||||
|
||||
try {
|
||||
console.log({ URL: req.url, body: req.body });
|
||||
if (req.url.endsWith("token")) {
|
||||
res.json({ access_token: "TOKEN" });
|
||||
} else if (req.url.endsWith(caseId)) {
|
||||
res.json({
|
||||
id: caseId,
|
||||
CaseNumber: 1024,
|
||||
});
|
||||
} else {
|
||||
// create a case
|
||||
res.json({ id: caseId });
|
||||
}
|
||||
} catch (error) {
|
||||
res.json({
|
||||
error: {
|
||||
message: error.message,
|
||||
},
|
||||
});
|
||||
}
|
||||
})();
|
||||
Reference in New Issue
Block a user