Built motion from commit (unavailable).|2.5.4
[motion2.git] / server / services / routing / server / applications / dialogflow.js
index 5f9d4b1..4652176 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x27d0=['body','getMustacheRender','create','then','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','fulfillment','Message','endConversation','catch','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','info','[%s][DIALOGFLOW]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','chat','account','upperFirst','AccountId','InteractionId','interaction','created'];(function(_0x1bb058,_0x36f9fa){var _0x493b9e=function(_0xa7ecd0){while(--_0xa7ecd0){_0x1bb058['push'](_0x1bb058['shift']());}};_0x493b9e(++_0x36f9fa);}(_0x27d0,0x9f));var _0x027d=function(_0x427cd9,_0x1680e0){_0x427cd9=_0x427cd9-0x0;var _0x40f890=_0x27d0[_0x427cd9];return _0x40f890;};'use strict';var _=require(_0x027d('0x0'));var moment=require(_0x027d('0x1'));var apiai=require(_0x027d('0x2'));var md5=require(_0x027d('0x3'));var utils=require(_0x027d('0x4'));var logger=require(_0x027d('0x5'))(_0x027d('0x6'));var rpc={'chatMessage':require(_0x027d('0x7')),'openchannelMessage':require(_0x027d('0x8')),'mailMessage':require(_0x027d('0x9')),'smsMessage':require(_0x027d('0xa')),'faxMessage':require(_0x027d('0xb')),'whatsappMessage':require(_0x027d('0xc'))};exports['consequence']=function(_0x33dd70,_0x2c2ffb){return function(_0x4e957b){try{if(!_[_0x027d('0xd')](this['interaction']['UserId'])){logger[_0x027d('0xe')](_0x027d('0xf'),_0x33dd70,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x4e957b[_0x027d('0x10')]();}var _0x168497={'ContactId':this[_0x027d('0x11')]['id'],'sentAt':moment()[_0x027d('0x12')](_0x027d('0x13')),'direction':_0x027d('0x14')};var _0x31fa54=this[_0x027d('0x15')];if(_0x31fa54===_0x027d('0x16')){_0x168497['ChatWebsiteId']=this[_0x027d('0x17')]['id'];}else{_0x168497[_[_0x027d('0x18')](_0x31fa54)+_0x027d('0x19')]=this[_0x027d('0x17')]['id'];}_0x168497[_[_0x027d('0x18')](_0x31fa54)+_0x027d('0x1a')]=this['interaction']['id'];if(this[_0x027d('0x1b')][_0x027d('0x1c')]){var _0x93610e=_0x2c2ffb[0x2];if(!_['isEmpty'](_0x93610e)){_0x168497[_0x027d('0x1d')]=utils[_0x027d('0x1e')](_0x93610e,this);return rpc[_0x31fa54+'Message'][_0x027d('0x1f')](_0x168497)[_0x027d('0x20')](function(_0x3bd4f0){logger[_0x027d('0xe')](_0x027d('0xf'),_0x33dd70,_0x168497[_0x027d('0x1d')]);})['catch'](function(_0x26bb5f){logger[_0x027d('0x21')](_0x027d('0xf'),_0x33dd70,JSON[_0x027d('0x22')](_0x26bb5f));})[_0x027d('0x23')](function(){logger['info'](_0x027d('0x24'),_0x33dd70);_0x4e957b[_0x027d('0x25')]();});}else{logger[_0x027d('0xe')](_0x027d('0x26'),_0x33dd70);_0x4e957b[_0x027d('0x25')]();}}else{var _0x46ebbf=this;var _0x5e5484=apiai(_0x2c2ffb[0x0],{'language':_0x2c2ffb[0x1]||'en'});return _0x5e5484[_0x027d('0x27')](this[_0x027d('0x28')][_0x027d('0x1d')],{'sessionId':md5(this['interaction']['id'])})[_0x027d('0x20')](function(_0x87fb7d){_0x46ebbf[_0x027d('0x1d')][_0x027d('0x29')]=_0x87fb7d;_0x168497['body']=_0x87fb7d[_0x027d('0x2a')][_0x027d('0x2b')]['speech'];return rpc[_0x31fa54+_0x027d('0x2c')][_0x027d('0x1f')](_0x168497)[_0x027d('0x20')](function(_0x4a2d6a){logger[_0x027d('0xe')](_0x027d('0xf'),_0x33dd70,_0x168497[_0x027d('0x1d')]);if(_0x87fb7d[_0x027d('0x2a')]['metadata'][_0x027d('0x2d')]){_0x4e957b[_0x027d('0x10')]();}else{_0x4e957b[_0x027d('0x25')]();}})[_0x027d('0x2e')](function(_0x16197a){logger['error'](_0x027d('0xf'),_0x33dd70,JSON[_0x027d('0x22')](_0x16197a));_0x4e957b['next']();});})[_0x027d('0x2e')](function(_0x1fc408){logger[_0x027d('0x21')](_0x027d('0xf'),_0x33dd70,_0x1fc408[_0x027d('0x28')]);_0x4e957b[_0x027d('0x10')]();});}}catch(_0x5c850c){logger[_0x027d('0x21')](_0x027d('0xf'),_0x33dd70,JSON[_0x027d('0x22')](_0x5c850c));_0x4e957b[_0x027d('0x25')]();}};};
\ No newline at end of file
+var _0xac1d=['../../rpc/whatsappMessage','isNil','interaction','info','[%s][DIALOGFLOW]\x20%s','next','format','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','fulfillment','speech','metadata','endConversation','error','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage'];(function(_0x3e4c4c,_0x344e6b){var _0x1d63ba=function(_0x5a21dd){while(--_0x5a21dd){_0x3e4c4c['push'](_0x3e4c4c['shift']());}};_0x1d63ba(++_0x344e6b);}(_0xac1d,0x1c1));var _0xdac1=function(_0x484ee3,_0x1ac008){_0x484ee3=_0x484ee3-0x0;var _0x2bde09=_0xac1d[_0x484ee3];return _0x2bde09;};'use strict';var _=require(_0xdac1('0x0'));var moment=require(_0xdac1('0x1'));var apiai=require(_0xdac1('0x2'));var md5=require(_0xdac1('0x3'));var utils=require(_0xdac1('0x4'));var logger=require(_0xdac1('0x5'))(_0xdac1('0x6'));var rpc={'chatMessage':require(_0xdac1('0x7')),'openchannelMessage':require(_0xdac1('0x8')),'mailMessage':require(_0xdac1('0x9')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xdac1('0xa')),'whatsappMessage':require(_0xdac1('0xb'))};exports['consequence']=function(_0x13b522,_0x1e4a9f){return function(_0x1aecc6){try{if(!_[_0xdac1('0xc')](this[_0xdac1('0xd')]['UserId'])){logger[_0xdac1('0xe')](_0xdac1('0xf'),_0x13b522,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x1aecc6[_0xdac1('0x10')]();}var _0x3caa74={'ContactId':this['contact']['id'],'sentAt':moment()[_0xdac1('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};var _0x2924ee=this['channel'];if(_0x2924ee===_0xdac1('0x12')){_0x3caa74[_0xdac1('0x13')]=this['account']['id'];}else{_0x3caa74[_[_0xdac1('0x14')](_0x2924ee)+_0xdac1('0x15')]=this[_0xdac1('0x16')]['id'];}_0x3caa74[_['upperFirst'](_0x2924ee)+_0xdac1('0x17')]=this[_0xdac1('0xd')]['id'];if(this[_0xdac1('0xd')][_0xdac1('0x18')]){var _0x214e82=_0x1e4a9f[0x2];if(!_[_0xdac1('0x19')](_0x214e82)){_0x3caa74[_0xdac1('0x1a')]=utils[_0xdac1('0x1b')](_0x214e82,this);return rpc[_0x2924ee+_0xdac1('0x1c')][_0xdac1('0x1d')](_0x3caa74)[_0xdac1('0x1e')](function(_0x4a81d0){logger['info'](_0xdac1('0xf'),_0x13b522,_0x3caa74[_0xdac1('0x1a')]);})[_0xdac1('0x1f')](function(_0x5f2b14){logger['error'](_0xdac1('0xf'),_0x13b522,JSON[_0xdac1('0x20')](_0x5f2b14));})[_0xdac1('0x21')](function(){logger['info'](_0xdac1('0x22'),_0x13b522);_0x1aecc6[_0xdac1('0x23')]();});}else{logger['info'](_0xdac1('0x24'),_0x13b522);_0x1aecc6[_0xdac1('0x23')]();}}else{var _0x51c3d4=this;var _0x290c80=apiai(_0x1e4a9f[0x0],{'language':_0x1e4a9f[0x1]||'en'});return _0x290c80[_0xdac1('0x25')](this[_0xdac1('0x26')][_0xdac1('0x1a')],{'sessionId':md5(this['interaction']['id'])})[_0xdac1('0x1e')](function(_0x3f2d6){_0x51c3d4['body'][_0xdac1('0x27')]=_0x3f2d6;_0x3caa74[_0xdac1('0x1a')]=_0x3f2d6[_0xdac1('0x28')][_0xdac1('0x29')][_0xdac1('0x2a')];return rpc[_0x2924ee+_0xdac1('0x1c')][_0xdac1('0x1d')](_0x3caa74)[_0xdac1('0x1e')](function(_0x8acb8a){logger['info'](_0xdac1('0xf'),_0x13b522,_0x3caa74[_0xdac1('0x1a')]);if(_0x3f2d6[_0xdac1('0x28')][_0xdac1('0x2b')][_0xdac1('0x2c')]){_0x1aecc6['next']();}else{_0x1aecc6[_0xdac1('0x23')]();}})[_0xdac1('0x1f')](function(_0x517385){logger[_0xdac1('0x2d')]('[%s][DIALOGFLOW]\x20%s',_0x13b522,JSON[_0xdac1('0x20')](_0x517385));_0x1aecc6[_0xdac1('0x10')]();});})[_0xdac1('0x1f')](function(_0x1e6e87){logger[_0xdac1('0x2d')](_0xdac1('0xf'),_0x13b522,_0x1e6e87[_0xdac1('0x26')]);_0x1aecc6[_0xdac1('0x10')]();});}}catch(_0x472007){logger['error'](_0xdac1('0xf'),_0x13b522,JSON[_0xdac1('0x20')](_0x472007));_0x1aecc6[_0xdac1('0x23')]();}};};
\ No newline at end of file