Built motion from commit da617fac.|2.6.6
[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 _0x0bca=['error','format','%s\x20configuration\x20#%s\x20not\x20found','data3','[EXEC]','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','sugarcrm','freshdesk','zoho','desk','dynamics365','freshsales','servicenow','exec','includes','toLowerCase','data2','find','Configurations','queue','routeId','outbound','EVENT\x20UNKNOWN','unmanaged','data1','zendesk','vtiger','log','unknown\x20integration'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0bca,0x10f));var _0xa0bc=function(_0x304a4d,_0xb50bb){_0x304a4d=_0x304a4d-0x0;var _0x3ee9d2=_0x0bca[_0x304a4d];return _0x3ee9d2;};'use strict';var _=require('lodash');var util=require('util');var zendesk=require(_0xa0bc('0x0'));var salesforce=require(_0xa0bc('0x1'));var sugarcrm=require(_0xa0bc('0x2'));var freshdesk=require(_0xa0bc('0x3'));var zoho=require(_0xa0bc('0x4'));var desk=require(_0xa0bc('0x5'));var vtiger=require(_0xa0bc('0x6'));var servicenow=require(_0xa0bc('0x7'));var dynamics365=require(_0xa0bc('0x8'));var freshsales=require(_0xa0bc('0x9'));var integrations=['zendesk','salesforce',_0xa0bc('0xa'),_0xa0bc('0xb'),_0xa0bc('0xc'),_0xa0bc('0xd'),'vtiger',_0xa0bc('0xe'),_0xa0bc('0xf'),_0xa0bc('0x10')];exports[_0xa0bc('0x11')]=function(_0x2043bb,_0x433156,_0x278dc0,_0x2f2bbd,_0xab1810,_0x32d837){if(_0x278dc0){if(_[_0xa0bc('0x12')](integrations,_0x2043bb['data1']['toLowerCase']())){try{var _0x4e0bcf=null;var _0x4cf5fb='';var _0x4d7ac1=_0x278dc0[_0x2043bb['data1'][_0xa0bc('0x13')]()];if(_0x4d7ac1){var _0x3206e6=_0x4d7ac1[_0x2043bb[_0xa0bc('0x14')]];if(_0x3206e6){var _0x1b47b2=_[_0xa0bc('0x15')](_0x3206e6[_0xa0bc('0x16')],{'id':parseInt(_0x2043bb['data3'],0xa)});if(_0x1b47b2){if(_0x2f2bbd){if(_0xab1810&&_0x433156[_0xa0bc('0x17')]){_0x4cf5fb='queue';}else if(_0x433156[_0xa0bc('0x18')]){_0x4cf5fb=_0xa0bc('0x19');}else{console['log'](_0xa0bc('0x1a'),_0x433156);}}else{_0x4cf5fb=_0xa0bc('0x1b');}switch(_0x2043bb[_0xa0bc('0x1c')][_0xa0bc('0x13')]()){case _0xa0bc('0x1d'):zendesk[_0x4cf5fb](_0x2043bb,_0x433156,_0x1b47b2,_0x2f2bbd,_0xab1810,_0x3206e6,_0x32d837);break;case'salesforce':salesforce[_0x4cf5fb](_0x2043bb,_0x433156,_0x1b47b2,_0x2f2bbd,_0xab1810,_0x3206e6,_0x32d837);break;case _0xa0bc('0xa'):sugarcrm[_0x4cf5fb](_0x2043bb,_0x433156,_0x1b47b2,_0x2f2bbd,_0xab1810,_0x3206e6,_0x32d837);break;case _0xa0bc('0xb'):freshdesk[_0x4cf5fb](_0x2043bb,_0x433156,_0x1b47b2,_0x2f2bbd,_0xab1810,_0x3206e6,_0x32d837);break;case _0xa0bc('0xc'):zoho[_0x4cf5fb](_0x2043bb,_0x433156,_0x1b47b2,_0x2f2bbd,_0xab1810,_0x3206e6,_0x32d837);break;case _0xa0bc('0xd'):desk[_0x4cf5fb](_0x2043bb,_0x433156,_0x1b47b2,_0x2f2bbd,_0xab1810,_0x3206e6,_0x32d837);break;case _0xa0bc('0x1e'):vtiger[_0x4cf5fb](_0x2043bb,_0x433156,_0x1b47b2,_0x2f2bbd,_0xab1810,_0x3206e6,_0x32d837);break;case'freshsales':freshsales['cs'](_0x2043bb,_0x433156,_0x1b47b2,_0x2f2bbd,_0xab1810,_0x3206e6,_0x32d837,_0x4cf5fb);break;case _0xa0bc('0x10'):servicenow['cs'](_0x2043bb,_0x433156,_0x1b47b2,_0x2f2bbd,_0xab1810,_0x3206e6,_0x32d837,_0x4cf5fb);break;case _0xa0bc('0xe'):dynamics365['cs'](_0x2043bb,_0x433156,_0x1b47b2,_0x2f2bbd,_0xab1810,_0x3206e6,_0x32d837,_0x4cf5fb);break;default:console[_0xa0bc('0x1f')](_0xa0bc('0x20'));}}else{_0x4e0bcf=require('../../../../config/logger')(_0x2043bb[_0xa0bc('0x1c')]['toLowerCase']());_0x4e0bcf[_0xa0bc('0x21')]('[EXEC]',util[_0xa0bc('0x22')](_0xa0bc('0x23'),_0x2043bb[_0xa0bc('0x1c')][_0xa0bc('0x13')](),_0x2043bb[_0xa0bc('0x24')]));}}else{_0x4e0bcf=require('../../../../config/logger')(_0x2043bb[_0xa0bc('0x1c')][_0xa0bc('0x13')]());_0x4e0bcf[_0xa0bc('0x21')](_0xa0bc('0x25'),util[_0xa0bc('0x22')]('%s\x20account\x20#%s\x20not\x20found',_0x2043bb['data1'][_0xa0bc('0x13')](),_0x2043bb[_0xa0bc('0x14')]));}}else{}}catch(_0x4bb425){console[_0xa0bc('0x21')](_0x4bb425);}}}};