Built motion from commit 3e059bc2.|2.5.32
[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 _0x2709=['freshsales','servicenow','exec','data1','toLowerCase','find','Configurations','data3','routeId','outbound','EVENT\x20UNKNOWN','log','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20account\x20#%s\x20not\x20found','data2','lodash','./zendesk','./salesforce','./freshdesk','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','sugarcrm','freshdesk','zoho','desk','dynamics365'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0x2709,0x189));var _0x9270=function(_0x37f8d1,_0x54d94c){_0x37f8d1=_0x37f8d1-0x0;var _0x109fa9=_0x2709[_0x37f8d1];return _0x109fa9;};'use strict';var _=require(_0x9270('0x0'));var util=require('util');var zendesk=require(_0x9270('0x1'));var salesforce=require(_0x9270('0x2'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x9270('0x3'));var zoho=require('./zoho');var desk=require(_0x9270('0x4'));var vtiger=require(_0x9270('0x5'));var servicenow=require(_0x9270('0x6'));var dynamics365=require(_0x9270('0x7'));var freshsales=require(_0x9270('0x8'));var integrations=[_0x9270('0x9'),'salesforce',_0x9270('0xa'),_0x9270('0xb'),_0x9270('0xc'),_0x9270('0xd'),'vtiger',_0x9270('0xe'),_0x9270('0xf'),_0x9270('0x10')];exports[_0x9270('0x11')]=function(_0x623907,_0x78d773,_0x46ead1,_0x9a0421,_0x41a8a4,_0x3c6123){if(_0x46ead1){if(_['includes'](integrations,_0x623907[_0x9270('0x12')][_0x9270('0x13')]())){try{var _0x25ac50=null;var _0x4c59ed='';var _0x55da96=_0x46ead1[_0x623907[_0x9270('0x12')][_0x9270('0x13')]()];if(_0x55da96){var _0x2a3c41=_0x55da96[_0x623907['data2']];if(_0x2a3c41){var _0x427aba=_[_0x9270('0x14')](_0x2a3c41[_0x9270('0x15')],{'id':parseInt(_0x623907[_0x9270('0x16')],0xa)});if(_0x427aba){if(_0x9a0421){if(_0x41a8a4&&_0x78d773['queue']){_0x4c59ed='queue';}else if(_0x78d773[_0x9270('0x17')]){_0x4c59ed=_0x9270('0x18');}else{console['log'](_0x9270('0x19'),_0x78d773);}}else{_0x4c59ed='unmanaged';}switch(_0x623907[_0x9270('0x12')][_0x9270('0x13')]()){case _0x9270('0x9'):zendesk[_0x4c59ed](_0x623907,_0x78d773,_0x427aba,_0x9a0421,_0x41a8a4,_0x2a3c41,_0x3c6123);break;case'salesforce':salesforce[_0x4c59ed](_0x623907,_0x78d773,_0x427aba,_0x9a0421,_0x41a8a4,_0x2a3c41,_0x3c6123);break;case'sugarcrm':sugarcrm[_0x4c59ed](_0x623907,_0x78d773,_0x427aba,_0x9a0421,_0x41a8a4,_0x2a3c41,_0x3c6123);break;case _0x9270('0xb'):freshdesk[_0x4c59ed](_0x623907,_0x78d773,_0x427aba,_0x9a0421,_0x41a8a4,_0x2a3c41,_0x3c6123);break;case _0x9270('0xc'):zoho[_0x4c59ed](_0x623907,_0x78d773,_0x427aba,_0x9a0421,_0x41a8a4,_0x2a3c41,_0x3c6123);break;case _0x9270('0xd'):desk[_0x4c59ed](_0x623907,_0x78d773,_0x427aba,_0x9a0421,_0x41a8a4,_0x2a3c41,_0x3c6123);break;case'vtiger':vtiger[_0x4c59ed](_0x623907,_0x78d773,_0x427aba,_0x9a0421,_0x41a8a4,_0x2a3c41,_0x3c6123);break;case _0x9270('0xf'):freshsales['cs'](_0x623907,_0x78d773,_0x427aba,_0x9a0421,_0x41a8a4,_0x2a3c41,_0x3c6123,_0x4c59ed);break;case _0x9270('0x10'):servicenow['cs'](_0x623907,_0x78d773,_0x427aba,_0x9a0421,_0x41a8a4,_0x2a3c41,_0x3c6123,_0x4c59ed);break;case _0x9270('0xe'):dynamics365['cs'](_0x623907,_0x78d773,_0x427aba,_0x9a0421,_0x41a8a4,_0x2a3c41,_0x3c6123,_0x4c59ed);break;default:console[_0x9270('0x1a')](_0x9270('0x1b'));}}else{_0x25ac50=require(_0x9270('0x1c'))(_0x623907['data1'][_0x9270('0x13')]());_0x25ac50[_0x9270('0x1d')](_0x9270('0x1e'),util[_0x9270('0x1f')]('%s\x20configuration\x20#%s\x20not\x20found',_0x623907[_0x9270('0x12')][_0x9270('0x13')](),_0x623907[_0x9270('0x16')]));}}else{_0x25ac50=require(_0x9270('0x1c'))(_0x623907[_0x9270('0x12')]['toLowerCase']());_0x25ac50[_0x9270('0x1d')](_0x9270('0x1e'),util['format'](_0x9270('0x20'),_0x623907[_0x9270('0x12')][_0x9270('0x13')](),_0x623907[_0x9270('0x21')]));}}else{}}catch(_0x35e372){console[_0x9270('0x1d')](_0x35e372);}}}};