Skip to content

Commit

Permalink
Fix issue in Smarti-Adapter for Livechat
Browse files Browse the repository at this point in the history
  • Loading branch information
mrsimpson committed Apr 3, 2018
1 parent 3340357 commit f87e594
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/assistify-ai/server/SmartiProxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class SmartiProxy {
try {
SystemLogger.debug('Sending request to Smarti', method, 'to', url, 'body', JSON.stringify(body));
const response = HTTP.call(method, url, {data: body, headers: header});
if (response.statusCode === 200 || response.statusCode === 201) {
if (response.statusCode < 400) {
return response.data || response.content; //.data if it's a json-response
} else {
SystemLogger.debug('Got unexpected result from Smarti', method, 'to', url, 'response', JSON.stringify(response));
Expand Down
6 changes: 4 additions & 2 deletions packages/assistify-ai/server/lib/SmartiAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ export class SmartiAdapter {
// The "support_area" in Smarti is an optional property. A historic conversation belonging to the same support_are increases relevance
let supportArea = room.parentRoomId || room.topic || room.expertise;
if (!supportArea) {
if (helpRequest && helpRequest.supportArea) {
if (room.t === '') {
supportArea = 'livechat';
} else if (helpRequest && helpRequest.supportArea) {
supportArea = helpRequest.supportArea;
} else {
supportArea = room.name;
Expand All @@ -113,7 +115,7 @@ export class SmartiAdapter {
'channel_id': [message.rid]
},
'user': {
'id': room.u._id
'id': room.u ? room.u._id : room.v._id
},
'messages': [requestBodyMessage],
'context': {
Expand Down

0 comments on commit f87e594

Please sign in to comment.