Built motion from commit (unavailable).|2.4.0
[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 _0xeb25=['servicenow','dynamics365','exec','includes','data1','toLowerCase','data2','find','queue','routeId','EVENT\x20UNKNOWN','salesforce','vtiger','log','unknown\x20integration','../../../../config/logger','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','data3','format','lodash','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./dynamics365','zendesk','sugarcrm','freshdesk','zoho'];(function(_0x4f1da5,_0x4ced17){var _0xe972a8=function(_0x278ba3){while(--_0x278ba3){_0x4f1da5['push'](_0x4f1da5['shift']());}};_0xe972a8(++_0x4ced17);}(_0xeb25,0xe1));var _0x5eb2=function(_0x366733,_0x44a293){_0x366733=_0x366733-0x0;var _0x12fbc3=_0xeb25[_0x366733];return _0x12fbc3;};'use strict';var _=require(_0x5eb2('0x0'));var util=require('util');var zendesk=require(_0x5eb2('0x1'));var salesforce=require(_0x5eb2('0x2'));var sugarcrm=require(_0x5eb2('0x3'));var freshdesk=require(_0x5eb2('0x4'));var zoho=require(_0x5eb2('0x5'));var desk=require(_0x5eb2('0x6'));var vtiger=require(_0x5eb2('0x7'));var servicenow=require('./servicenow');var dynamics365=require(_0x5eb2('0x8'));var integrations=[_0x5eb2('0x9'),'salesforce',_0x5eb2('0xa'),_0x5eb2('0xb'),_0x5eb2('0xc'),'desk','vtiger',_0x5eb2('0xd'),_0x5eb2('0xe')];exports[_0x5eb2('0xf')]=function(_0x9cb961,_0x882c7c,_0x45dc7f,_0x3bf989,_0x256c78,_0x183337){if(_0x45dc7f){if(_[_0x5eb2('0x10')](integrations,_0x9cb961[_0x5eb2('0x11')][_0x5eb2('0x12')]())){try{var _0x5039b9=null;var _0x2547a0='';var _0x131cb0=_0x45dc7f[_0x9cb961[_0x5eb2('0x11')][_0x5eb2('0x12')]()];if(_0x131cb0){var _0x4a4211=_0x131cb0[_0x9cb961[_0x5eb2('0x13')]];if(_0x4a4211){var _0x1e04c9=_[_0x5eb2('0x14')](_0x4a4211['Configurations'],{'id':parseInt(_0x9cb961['data3'],0xa)});if(_0x1e04c9){if(_0x3bf989){if(_0x256c78&&_0x882c7c[_0x5eb2('0x15')]){_0x2547a0=_0x5eb2('0x15');}else if(_0x882c7c[_0x5eb2('0x16')]){_0x2547a0='outbound';}else{console['log'](_0x5eb2('0x17'),_0x882c7c);}}else{_0x2547a0='abandoned';}switch(_0x9cb961[_0x5eb2('0x11')]['toLowerCase']()){case _0x5eb2('0x9'):zendesk[_0x2547a0](_0x9cb961,_0x882c7c,_0x1e04c9,_0x3bf989,_0x256c78,_0x4a4211,_0x183337);break;case _0x5eb2('0x18'):salesforce[_0x2547a0](_0x9cb961,_0x882c7c,_0x1e04c9,_0x3bf989,_0x256c78,_0x4a4211,_0x183337);break;case _0x5eb2('0xa'):sugarcrm[_0x2547a0](_0x9cb961,_0x882c7c,_0x1e04c9,_0x3bf989,_0x256c78,_0x4a4211,_0x183337);break;case _0x5eb2('0xb'):freshdesk[_0x2547a0](_0x9cb961,_0x882c7c,_0x1e04c9,_0x3bf989,_0x256c78,_0x4a4211,_0x183337);break;case _0x5eb2('0xc'):zoho[_0x2547a0](_0x9cb961,_0x882c7c,_0x1e04c9,_0x3bf989,_0x256c78,_0x4a4211,_0x183337);break;case'desk':desk[_0x2547a0](_0x9cb961,_0x882c7c,_0x1e04c9,_0x3bf989,_0x256c78,_0x4a4211,_0x183337);break;case _0x5eb2('0x19'):vtiger[_0x2547a0](_0x9cb961,_0x882c7c,_0x1e04c9,_0x3bf989,_0x256c78,_0x4a4211,_0x183337);break;case _0x5eb2('0xd'):servicenow['cs'](_0x9cb961,_0x882c7c,_0x1e04c9,_0x3bf989,_0x256c78,_0x4a4211,_0x183337,_0x2547a0);break;case'dynamics365':dynamics365['cs'](_0x9cb961,_0x882c7c,_0x1e04c9,_0x3bf989,_0x256c78,_0x4a4211,_0x183337,_0x2547a0);break;default:console[_0x5eb2('0x1a')](_0x5eb2('0x1b'));}}else{_0x5039b9=require(_0x5eb2('0x1c'))(_0x9cb961['data1'][_0x5eb2('0x12')]());_0x5039b9[_0x5eb2('0x1d')](_0x5eb2('0x1e'),util['format'](_0x5eb2('0x1f'),_0x9cb961[_0x5eb2('0x11')][_0x5eb2('0x12')](),_0x9cb961[_0x5eb2('0x20')]));}}else{_0x5039b9=require(_0x5eb2('0x1c'))(_0x9cb961[_0x5eb2('0x11')][_0x5eb2('0x12')]());_0x5039b9['error'](_0x5eb2('0x1e'),util[_0x5eb2('0x21')]('%s\x20account\x20#%s\x20not\x20found',_0x9cb961[_0x5eb2('0x11')][_0x5eb2('0x12')](),_0x9cb961['data2']));}}else{}}catch(_0x2cf17a){console['error'](_0x2cf17a);}}}};