Built motion from commit (unavailable).|2.5.6
[motion2.git] / server / api / whatsappMessage / whatsappMessage.model.js
index 7b151f6..a82a271 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x014f=['WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','create','body','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','messageId','FULLTEXT','models','get','direction','toLowerCase','out','isNil','WhatsappInteraction','then','update','createdAt','catch','error','secret','WhatsappAccount','find'];(function(_0xbbf4,_0x3035c5){var _0x54fd3a=function(_0x3e0bcc){while(--_0x3e0bcc){_0xbbf4['push'](_0xbbf4['shift']());}};_0x54fd3a(++_0x3035c5);}(_0x014f,0xab));var _0xf014=function(_0x2b4348,_0x58c328){_0x2b4348=_0x2b4348-0x0;var _0x2f7ab3=_0x014f[_0x2b4348];return _0x2f7ab3;};'use strict';var _=require(_0xf014('0x0'));var util=require(_0xf014('0x1'));var logger=require(_0xf014('0x2'))(_0xf014('0x3'));var moment=require('moment');var BPromise=require(_0xf014('0x4'));var rp=require(_0xf014('0x5'));var fs=require('fs');var path=require(_0xf014('0x6'));var rimraf=require('rimraf');var config=require(_0xf014('0x7'));var attributes=require(_0xf014('0x8'));module[_0xf014('0x9')]=function(_0x30f0bf,_0xd8ed37){return _0x30f0bf[_0xf014('0xa')](_0xf014('0xb'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0xf014('0xc'),'fields':['messageId']},{'name':'fti_whatsapp_messages','fields':['body'],'type':_0xf014('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5341ab,_0x282d89,_0x5e4fd4){var _0x11b9be=_0x30f0bf[_0xf014('0xe')];var _0x399d2e=_0x5341ab[_0xf014('0xf')]({'plain':!![]});if(_0x399d2e['direction']['toLowerCase']()==='in'||_0x399d2e[_0xf014('0x10')][_0xf014('0x11')]()===_0xf014('0x12')&&!_0x399d2e['secret']&&!_[_0xf014('0x13')](_0x399d2e['UserId'])){_0x11b9be[_0xf014('0x14')]['findOne']({'where':{'id':_0x399d2e['WhatsappInteractionId']}})[_0xf014('0x15')](function(_0x26c4ea){if(_0x26c4ea){_0x26c4ea[_0xf014('0x16')]({'lastMsgAt':_0x399d2e[_0xf014('0x17')],'lastMsgDirection':_0x399d2e['direction'][_0xf014('0x11')]()});}})[_0xf014('0x18')](function(_0x2abf8a){console[_0xf014('0x19')](_0x2abf8a);});}if(_0x399d2e[_0xf014('0x10')]===_0xf014('0x12')&&!_0x399d2e[_0xf014('0x1a')]){var _0x383b80;_0x11b9be[_0xf014('0x1b')][_0xf014('0x1c')]({'where':{'id':_0x399d2e[_0xf014('0x1d')]},'raw':!![]})['then'](function(_0x127e91){_0x383b80=_0x127e91;if(_0x383b80&&_0x383b80[_0xf014('0x1e')]){switch(_0x383b80['type']){case _0xf014('0x1f'):var _0x1a9ac3=require(_0xf014('0x1f'));if(_0x383b80[_0xf014('0x20')]&&_0x383b80[_0xf014('0x21')]&&_0x383b80[_0xf014('0x22')]){var _0x1e6067=new _0x1a9ac3(_0x383b80['accountSid'],_0x383b80['authToken']);_0x1e6067[_0xf014('0x23')][_0xf014('0x24')]({'body':_0x399d2e[_0xf014('0x25')],'to':_0xf014('0x26')+_0x399d2e[_0xf014('0x22')],'from':'whatsapp:'+_0x383b80[_0xf014('0x22')],'statusCallback':_0x383b80[_0xf014('0x27')]+_0xf014('0x28')+_0x399d2e['id']+_0xf014('0x29')+_0x383b80[_0xf014('0x2a')]})['then'](function(_0x50450c){if(_0x50450c[_0xf014('0x2b')]){return _0x5341ab[_0xf014('0x16')]({'messageId':_0x50450c[_0xf014('0x2b')]});}})['catch'](function(_0x55e5f0){logger[_0xf014('0x19')](_0xf014('0x2c'),_0xf014('0x2d'),'twilio',util[_0xf014('0x2e')](_0x55e5f0,{'showHidden':![],'depth':null}));});}else{logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio',_0xf014('0x2f'));}break;}}})[_0xf014('0x30')](function(){_0x5e4fd4();});}else{_0x5e4fd4();}}},'charset':'utf8mb4','collate':_0xf014('0x31')});};
\ No newline at end of file
+var _0xb043=['models','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','then','createdAt','catch','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','update','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappMessage.attributes','exports','define','whatsapp_messages','messageId','body','FULLTEXT'];(function(_0x47b279,_0x4ca54f){var _0x4d899a=function(_0x1d8edc){while(--_0x1d8edc){_0x47b279['push'](_0x47b279['shift']());}};_0x4d899a(++_0x4ca54f);}(_0xb043,0x142));var _0x3b04=function(_0x17b0d4,_0x377add){_0x17b0d4=_0x17b0d4-0x0;var _0x2d02c7=_0xb043[_0x17b0d4];return _0x2d02c7;};'use strict';var _=require('lodash');var util=require(_0x3b04('0x0'));var logger=require('../../config/logger')(_0x3b04('0x1'));var moment=require(_0x3b04('0x2'));var BPromise=require(_0x3b04('0x3'));var rp=require(_0x3b04('0x4'));var fs=require('fs');var path=require(_0x3b04('0x5'));var rimraf=require('rimraf');var config=require(_0x3b04('0x6'));var attributes=require(_0x3b04('0x7'));module[_0x3b04('0x8')]=function(_0x29a49a,_0x52af89){return _0x29a49a[_0x3b04('0x9')]('WhatsappMessage',attributes,{'tableName':_0x3b04('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x3b04('0xb')]},{'name':'fti_whatsapp_messages','fields':[_0x3b04('0xc')],'type':_0x3b04('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5caa38,_0x1d2de0,_0x5c70b3){var _0x1e0943=_0x29a49a[_0x3b04('0xe')];var _0x296b88=_0x5caa38[_0x3b04('0xf')]({'plain':!![]});if(_0x296b88[_0x3b04('0x10')][_0x3b04('0x11')]()==='in'||_0x296b88[_0x3b04('0x10')][_0x3b04('0x11')]()===_0x3b04('0x12')&&!_0x296b88[_0x3b04('0x13')]&&!_[_0x3b04('0x14')](_0x296b88[_0x3b04('0x15')])){_0x1e0943[_0x3b04('0x16')]['findOne']({'where':{'id':_0x296b88['WhatsappInteractionId']}})[_0x3b04('0x17')](function(_0x21e161){if(_0x21e161){_0x21e161['update']({'lastMsgAt':_0x296b88[_0x3b04('0x18')],'lastMsgDirection':_0x296b88['direction'][_0x3b04('0x11')]()});}})[_0x3b04('0x19')](function(_0x6d5e74){console[_0x3b04('0x1a')](_0x6d5e74);});}if(_0x296b88[_0x3b04('0x10')]===_0x3b04('0x12')&&!_0x296b88[_0x3b04('0x13')]){var _0x1cb9a4;_0x1e0943[_0x3b04('0x1b')][_0x3b04('0x1c')]({'where':{'id':_0x296b88[_0x3b04('0x1d')]},'raw':!![]})[_0x3b04('0x17')](function(_0x499876){_0x1cb9a4=_0x499876;if(_0x1cb9a4&&_0x1cb9a4[_0x3b04('0x1e')]){switch(_0x1cb9a4[_0x3b04('0x1e')]){case _0x3b04('0x1f'):var _0x252ef9=require(_0x3b04('0x1f'));if(_0x1cb9a4[_0x3b04('0x20')]&&_0x1cb9a4['authToken']&&_0x1cb9a4[_0x3b04('0x21')]){var _0x54cd95=new _0x252ef9(_0x1cb9a4['accountSid'],_0x1cb9a4['authToken']);_0x54cd95[_0x3b04('0x22')][_0x3b04('0x23')]({'body':_0x296b88[_0x3b04('0xc')],'to':'whatsapp:'+_0x296b88[_0x3b04('0x21')],'from':_0x3b04('0x24')+_0x1cb9a4[_0x3b04('0x21')],'statusCallback':_0x1cb9a4[_0x3b04('0x25')]+_0x3b04('0x26')+_0x296b88['id']+_0x3b04('0x27')+_0x1cb9a4[_0x3b04('0x28')]})[_0x3b04('0x17')](function(_0x21bf48){if(_0x21bf48[_0x3b04('0x29')]){return _0x5caa38[_0x3b04('0x2a')]({'messageId':_0x21bf48[_0x3b04('0x29')]});}})['catch'](function(_0x3748ca){logger['error'](_0x3b04('0x2b'),'afterCreate',_0x3b04('0x1f'),util[_0x3b04('0x2c')](_0x3748ca,{'showHidden':![],'depth':null}));});}else{logger[_0x3b04('0x1a')](_0x3b04('0x2b'),'afterCreate',_0x3b04('0x1f'),_0x3b04('0x2d'));}break;}}})[_0x3b04('0x2e')](function(){_0x5c70b3();});}else{_0x5c70b3();}}},'charset':'utf8mb4','collate':_0x3b04('0x2f')});};
\ No newline at end of file