229b0c3baecaec073797ebc863282cecb23824a8
[motion2.git] / server / services / ami / trigger / integration / index.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0xf521=['%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger','format','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./sugarcrm','./freshdesk','./zoho','./vtiger','./servicenow','./dynamics365','./freshsales','salesforce','sugarcrm','freshdesk','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','log','unmanaged','zendesk','desk','unknown\x20integration','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf521,0x19b));var _0x1f52=function(_0x5ab5bd,_0x12c446){_0x5ab5bd=_0x5ab5bd-0x0;var _0x3dddd8=_0xf521[_0x5ab5bd];return _0x3dddd8;};'use strict';var _=require(_0x1f52('0x0'));var util=require(_0x1f52('0x1'));var zendesk=require(_0x1f52('0x2'));var salesforce=require('./salesforce');var sugarcrm=require(_0x1f52('0x3'));var freshdesk=require(_0x1f52('0x4'));var zoho=require(_0x1f52('0x5'));var desk=require('./desk');var vtiger=require(_0x1f52('0x6'));var servicenow=require(_0x1f52('0x7'));var dynamics365=require(_0x1f52('0x8'));var freshsales=require(_0x1f52('0x9'));var integrations=['zendesk',_0x1f52('0xa'),_0x1f52('0xb'),_0x1f52('0xc'),'zoho','desk',_0x1f52('0xd'),_0x1f52('0xe'),_0x1f52('0xf'),_0x1f52('0x10')];exports[_0x1f52('0x11')]=function(_0x12ca4b,_0x4baf15,_0x833d90,_0x332eb8,_0x75ee05,_0x48a427){if(_0x833d90){if(_[_0x1f52('0x12')](integrations,_0x12ca4b[_0x1f52('0x13')]['toLowerCase']())){try{var _0x2ed4a8=null;var _0x5ac5c7='';var _0x3b92e1=_0x833d90[_0x12ca4b[_0x1f52('0x13')][_0x1f52('0x14')]()];if(_0x3b92e1){var _0x569b92=_0x3b92e1[_0x12ca4b[_0x1f52('0x15')]];if(_0x569b92){var _0x14041b=_[_0x1f52('0x16')](_0x569b92[_0x1f52('0x17')],{'id':parseInt(_0x12ca4b[_0x1f52('0x18')],0xa)});if(_0x14041b){if(_0x332eb8){if(_0x75ee05&&_0x4baf15[_0x1f52('0x19')]){_0x5ac5c7=_0x1f52('0x19');}else if(_0x4baf15[_0x1f52('0x1a')]){_0x5ac5c7='outbound';}else{console[_0x1f52('0x1b')]('EVENT\x20UNKNOWN',_0x4baf15);}}else{_0x5ac5c7=_0x1f52('0x1c');}switch(_0x12ca4b[_0x1f52('0x13')]['toLowerCase']()){case _0x1f52('0x1d'):zendesk[_0x5ac5c7](_0x12ca4b,_0x4baf15,_0x14041b,_0x332eb8,_0x75ee05,_0x569b92,_0x48a427);break;case _0x1f52('0xa'):salesforce[_0x5ac5c7](_0x12ca4b,_0x4baf15,_0x14041b,_0x332eb8,_0x75ee05,_0x569b92,_0x48a427);break;case _0x1f52('0xb'):sugarcrm[_0x5ac5c7](_0x12ca4b,_0x4baf15,_0x14041b,_0x332eb8,_0x75ee05,_0x569b92,_0x48a427);break;case _0x1f52('0xc'):freshdesk[_0x5ac5c7](_0x12ca4b,_0x4baf15,_0x14041b,_0x332eb8,_0x75ee05,_0x569b92,_0x48a427);break;case'zoho':zoho[_0x5ac5c7](_0x12ca4b,_0x4baf15,_0x14041b,_0x332eb8,_0x75ee05,_0x569b92,_0x48a427);break;case _0x1f52('0x1e'):desk[_0x5ac5c7](_0x12ca4b,_0x4baf15,_0x14041b,_0x332eb8,_0x75ee05,_0x569b92,_0x48a427);break;case _0x1f52('0xd'):vtiger[_0x5ac5c7](_0x12ca4b,_0x4baf15,_0x14041b,_0x332eb8,_0x75ee05,_0x569b92,_0x48a427);break;case'freshsales':freshsales['cs'](_0x12ca4b,_0x4baf15,_0x14041b,_0x332eb8,_0x75ee05,_0x569b92,_0x48a427,_0x5ac5c7);break;case'servicenow':servicenow['cs'](_0x12ca4b,_0x4baf15,_0x14041b,_0x332eb8,_0x75ee05,_0x569b92,_0x48a427,_0x5ac5c7);break;case _0x1f52('0xe'):dynamics365['cs'](_0x12ca4b,_0x4baf15,_0x14041b,_0x332eb8,_0x75ee05,_0x569b92,_0x48a427,_0x5ac5c7);break;default:console[_0x1f52('0x1b')](_0x1f52('0x1f'));}}else{_0x2ed4a8=require('../../../../config/logger')(_0x12ca4b['data1'][_0x1f52('0x14')]());_0x2ed4a8[_0x1f52('0x20')]('[EXEC]',util['format'](_0x1f52('0x21'),_0x12ca4b[_0x1f52('0x13')][_0x1f52('0x14')](),_0x12ca4b[_0x1f52('0x18')]));}}else{_0x2ed4a8=require(_0x1f52('0x22'))(_0x12ca4b[_0x1f52('0x13')][_0x1f52('0x14')]());_0x2ed4a8[_0x1f52('0x20')]('[EXEC]',util[_0x1f52('0x23')](_0x1f52('0x24'),_0x12ca4b[_0x1f52('0x13')]['toLowerCase'](),_0x12ca4b['data2']));}}else{}}catch(_0x4db481){console['error'](_0x4db481);}}}};