Built motion from commit 3c2ce842.|2.6.31
[motion2.git] / server / api / smsMessage / smsMessage.model.js
index c7feaa8..0185783 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0d9f=['csc','crypto','apiKey','login','keys','sort','createHash','md5','digest','hex','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','finally','utf8mb4_unicode_ci','util','../../config/logger','api','moment','path','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','then','createdAt','catch','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token=','sid','update','inspect','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','login?username=','&password=','password','GET','split','POST','user_key','total_sent','internal_order_id','deliveryReport','read','skebby','Missing\x20parameters:\x20username,\x20password','connectel','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','senderString','%s:%s','https://rest.clicksend.com/v3/sms/send','format','Basic\x20%s','toString','base64','http_code','data','head','message_id','clickSend','plivo','authId','token','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20'];(function(_0x317c1f,_0x3047b8){var _0x402d73=function(_0x167e00){while(--_0x167e00){_0x317c1f['push'](_0x317c1f['shift']());}};_0x402d73(++_0x3047b8);}(_0x0d9f,0x96));var _0xf0d9=function(_0x4b784d,_0x5efb2f){_0x4b784d=_0x4b784d-0x0;var _0x2cdeaf=_0x0d9f[_0x4b784d];return _0x2cdeaf;};'use strict';var _=require('lodash');var util=require(_0xf0d9('0x0'));var logger=require(_0xf0d9('0x1'))(_0xf0d9('0x2'));var moment=require(_0xf0d9('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf0d9('0x4'));var rimraf=require('rimraf');var config=require(_0xf0d9('0x5'));var attributes=require(_0xf0d9('0x6'));module[_0xf0d9('0x7')]=function(_0x3d4e03,_0x2f9f91){return _0x3d4e03[_0xf0d9('0x8')](_0xf0d9('0x9'),attributes,{'tableName':_0xf0d9('0xa'),'paranoid':![],'indexes':[{'name':_0xf0d9('0xb'),'fields':['messageId']},{'name':_0xf0d9('0xc'),'fields':[_0xf0d9('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1a8b1d,_0xc7c91c,_0x79588e){var _0x41cd62=_0x3d4e03['models'];var _0x34ec08=_0x1a8b1d[_0xf0d9('0xe')]({'plain':!![]});if(_0x34ec08[_0xf0d9('0xf')][_0xf0d9('0x10')]()==='in'||_0x34ec08[_0xf0d9('0xf')][_0xf0d9('0x10')]()===_0xf0d9('0x11')&&!_0x34ec08[_0xf0d9('0x12')]&&!_[_0xf0d9('0x13')](_0x34ec08[_0xf0d9('0x14')])&&!_[_0xf0d9('0x13')](_0x34ec08[_0xf0d9('0x15')])){_0x41cd62['SmsInteraction']['findOne']({'where':{'id':_0x34ec08['SmsInteractionId']}})[_0xf0d9('0x16')](function(_0x380252){if(_0x380252){_0x380252['update']({'lastMsgAt':_0x34ec08[_0xf0d9('0x17')],'lastMsgDirection':_0x34ec08[_0xf0d9('0xf')][_0xf0d9('0x10')]()});}})[_0xf0d9('0x18')](function(_0x50ab7f){console['error'](_0x50ab7f);});}if(_0x34ec08[_0xf0d9('0xf')]==='out'&&!_0x34ec08[_0xf0d9('0x12')]){var _0x4456da;_0x41cd62[_0xf0d9('0x19')][_0xf0d9('0x1a')]({'where':{'id':_0x34ec08[_0xf0d9('0x1b')]},'raw':!![]})[_0xf0d9('0x16')](function(_0x369524){_0x4456da=_0x369524;if(_0x4456da&&_0x4456da['type']){switch(_0x4456da[_0xf0d9('0x1c')]){case _0xf0d9('0x1d'):var _0x27ef2d=require('twilio');if(_0x4456da[_0xf0d9('0x1e')]&&_0x4456da[_0xf0d9('0x1f')]&&_0x4456da[_0xf0d9('0x20')]){var _0x1a7d75=new _0x27ef2d(_0x4456da[_0xf0d9('0x1e')],_0x4456da['authToken']);_0x1a7d75[_0xf0d9('0x21')][_0xf0d9('0x22')]({'body':_0x34ec08[_0xf0d9('0xd')],'to':_0x34ec08[_0xf0d9('0x20')],'from':_0x4456da[_0xf0d9('0x20')],'statusCallback':_0x4456da[_0xf0d9('0x23')]+_0xf0d9('0x24')+_0x34ec08['id']+_0xf0d9('0x25')+_0x4456da['token']})[_0xf0d9('0x16')](function(_0x47fc84){if(_0x47fc84[_0xf0d9('0x26')]){return _0x1a8b1d[_0xf0d9('0x27')]({'messageId':_0x47fc84[_0xf0d9('0x26')]});}})[_0xf0d9('0x18')](function(_0x215746){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xf0d9('0x1d'),util[_0xf0d9('0x28')](_0x215746,{'showHidden':![],'depth':null}));});}else{logger[_0xf0d9('0x29')](_0xf0d9('0x2a'),_0xf0d9('0x2b'),_0xf0d9('0x1d'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case'skebby':var _0x166800=_0xf0d9('0x2c');if(_0x4456da[_0xf0d9('0x2d')]&&_0x4456da['password']){var _0x5b664c={'recipient':[_0x34ec08[_0xf0d9('0x20')]],'message':_0x34ec08[_0xf0d9('0xd')],'message_type':_0x4456da['smsMethod']};if(_0x4456da['smsMethod']&&_0x4456da[_0xf0d9('0x2e')]!=='SI'){_0x5b664c['sender']=_0x4456da[_0xf0d9('0x20')];}var _0x583b36={'url':_0x166800+_0xf0d9('0x2f')+_0x4456da[_0xf0d9('0x2d')]+_0xf0d9('0x30')+_0x4456da[_0xf0d9('0x31')],'method':_0xf0d9('0x32')};rp(_0x583b36)[_0xf0d9('0x16')](function(_0x40ba3a){var _0x2b6bab=_0x40ba3a[_0xf0d9('0x33')](';');var _0x2e6773={'user_key':_0x2b6bab[0x0],'session_key':_0x2b6bab[0x1]};_0x583b36={'url':_0x166800+'sms','method':_0xf0d9('0x34'),'headers':{'user_key':_0x2e6773[_0xf0d9('0x35')],'Session_key':_0x2e6773['session_key']},'json':!![],'body':_0x5b664c};return rp(_0x583b36);})[_0xf0d9('0x16')](function(_0x2de65d){if(_0x2de65d[_0xf0d9('0x36')]>=0x1){var _0x266841={'messageId':_0x2de65d[_0xf0d9('0x37')]};if(_0x4456da[_0xf0d9('0x2e')]!=='GP'||!_0x4456da[_0xf0d9('0x38')]){_0x266841[_0xf0d9('0x39')]=!![];}return _0x1a8b1d[_0xf0d9('0x27')](_0x266841);}else{return logger['error'](_0xf0d9('0x2a'),_0xf0d9('0x2b'),_0xf0d9('0x3a'),util['inspect'](_0x2de65d,{'showHidden':![],'depth':null}));}})[_0xf0d9('0x18')](function(_0x47808b){return logger[_0xf0d9('0x29')](_0xf0d9('0x2a'),_0xf0d9('0x2b'),_0xf0d9('0x3a'),util[_0xf0d9('0x28')](_0x47808b,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf0d9('0x2a'),_0xf0d9('0x2b'),_0xf0d9('0x3a'),_0xf0d9('0x3b'));}break;case _0xf0d9('0x3c'):if(_0x4456da['authToken']){var _0x41920b={'recipient':_0x34ec08[_0xf0d9('0x20')],'message':_0x34ec08['body'],'sender':_0x4456da['senderString']||_0x4456da[_0xf0d9('0x20')],'authorization':_0x4456da[_0xf0d9('0x1f')]};var _0xc7c91c={'method':'POST','uri':_0xf0d9('0x3d'),'body':_0x41920b,'json':!![]};rp(_0xc7c91c)[_0xf0d9('0x16')](function(_0x1cf360){var _0x37320a={'messageId':_0x1cf360[_0xf0d9('0x3e')]};if(!_0x4456da[_0xf0d9('0x38')]){_0x37320a['read']=!![];}return _0x1a8b1d[_0xf0d9('0x27')](_0x37320a);})[_0xf0d9('0x18')](function(_0x1ca5c1){logger[_0xf0d9('0x29')](_0xf0d9('0x2a'),_0xf0d9('0x2b'),_0xf0d9('0x3c'),util[_0xf0d9('0x28')](_0x1ca5c1,{'showHidden':![],'depth':null}));});}else{logger[_0xf0d9('0x29')](_0xf0d9('0x2a'),'afterCreate','connectel',_0xf0d9('0x3f'));}break;case'clicksend':if(_0x4456da[_0xf0d9('0x2d')]&&_0x4456da[_0xf0d9('0x31')]){var _0x41920b={'messages':[{'source':'xCALLY\x20Motion','to':_0x34ec08[_0xf0d9('0x20')],'body':_0x34ec08['body'],'from':_0x4456da[_0xf0d9('0x40')]||_0x4456da[_0xf0d9('0x20')]}]};var _0x56cb50=util['format'](_0xf0d9('0x41'),_0x4456da[_0xf0d9('0x2d')],_0x4456da[_0xf0d9('0x31')]);var _0xc7c91c={'method':_0xf0d9('0x34'),'uri':_0xf0d9('0x42'),'body':_0x41920b,'headers':{'Authorization':util[_0xf0d9('0x43')](_0xf0d9('0x44'),new Buffer(_0x56cb50)[_0xf0d9('0x45')](_0xf0d9('0x46')))},'json':!![]};rp(_0xc7c91c)[_0xf0d9('0x16')](function(_0x22afc0){if(_0x22afc0['http_code']>=0xc8&&_0x22afc0[_0xf0d9('0x47')]<=0xce){if(_0x22afc0[_0xf0d9('0x48')]&&_0x22afc0['data']['queued_count']>0x0){var _0x5117a9=_[_0xf0d9('0x49')](_0x22afc0[_0xf0d9('0x48')]['messages']);var _0x1ea496={'messageId':_0x5117a9[_0xf0d9('0x4a')]};if(!_0x4456da['deliveryReport']){_0x1ea496[_0xf0d9('0x39')]=!![];}return _0x1a8b1d[_0xf0d9('0x27')](_0x1ea496);}else{logger[_0xf0d9('0x29')](_0xf0d9('0x2a'),_0xf0d9('0x2b'),_0xf0d9('0x4b'),util[_0xf0d9('0x28')](_0x22afc0,{'showHidden':![],'depth':null}));}}else{logger[_0xf0d9('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf0d9('0x2b'),_0xf0d9('0x4b'),util[_0xf0d9('0x28')](_0x22afc0,{'showHidden':![],'depth':null}));}})[_0xf0d9('0x18')](function(_0x351958){logger[_0xf0d9('0x29')](_0xf0d9('0x2a'),'afterCreate','clickSend',util[_0xf0d9('0x28')](_0x351958,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf0d9('0x2a'),_0xf0d9('0x2b'),_0xf0d9('0x4b'),_0xf0d9('0x3b'));}break;case _0xf0d9('0x4c'):if(_0x4456da[_0xf0d9('0x4d')]&&_0x4456da[_0xf0d9('0x1f')]){var _0x41920b={'dst':_0x34ec08[_0xf0d9('0x20')],'text':_0x34ec08[_0xf0d9('0xd')],'src':_0x4456da[_0xf0d9('0x40')]||_0x4456da[_0xf0d9('0x20')],'url':_0x4456da['remote']+_0xf0d9('0x24')+_0x34ec08['id']+_0xf0d9('0x25')+_0x4456da[_0xf0d9('0x4e')]};var _0x56cb50=util[_0xf0d9('0x43')]('%s:%s',_0x4456da['authId'],_0x4456da[_0xf0d9('0x1f')]);var _0xc7c91c={'method':'POST','uri':util[_0xf0d9('0x43')](_0xf0d9('0x4f'),_0x4456da['authId']),'body':_0x41920b,'headers':{'Authorization':util[_0xf0d9('0x43')](_0xf0d9('0x44'),new Buffer(_0x56cb50)[_0xf0d9('0x45')](_0xf0d9('0x46')))},'json':!![]};rp(_0xc7c91c)[_0xf0d9('0x16')](function(_0x2e8728){var _0x111959={'messageId':_0x2e8728[_0xf0d9('0x50')][0x0]};return _0x1a8b1d[_0xf0d9('0x27')](_0x111959);})[_0xf0d9('0x18')](function(_0x1c6743){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf0d9('0x2b'),_0xf0d9('0x4c'),util[_0xf0d9('0x28')](_0x1c6743,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf0d9('0x2b'),_0xf0d9('0x4c'),_0xf0d9('0x51'));}break;case _0xf0d9('0x52'):if(_0x4456da[_0xf0d9('0x2d')]&&_0x4456da[_0xf0d9('0x31')]){if(_0x4456da[_0xf0d9('0x53')]){var _0x47ccdd={'method':_0xf0d9('0x34'),'uri':_0x4456da['baseUrl']+_0xf0d9('0x54'),'body':{'username':_0x4456da['username'],'password':_0x4456da[_0xf0d9('0x31')]},'json':!![]};return rp(_0x47ccdd)['then'](function(_0x56eafd){var _0x1f8c76={'method':'POST','uri':_0x4456da[_0xf0d9('0x53')]+_0xf0d9('0x55'),'body':{'messages':[{'from':_0x4456da['phone'],'destinations':[{'to':_0x34ec08['phone']}],'text':_0x34ec08[_0xf0d9('0xd')],'notifyUrl':_0x4456da[_0xf0d9('0x23')]+_0xf0d9('0x24')+_0x34ec08['id']+_0xf0d9('0x25')+_0x4456da['token'],'notifyContentType':_0xf0d9('0x56'),'callbackData':_0x4456da[_0xf0d9('0x20')]+';'+_0x34ec08[_0xf0d9('0xd')]}]},'headers':{'Authorization':_0xf0d9('0x57')+_0x56eafd[_0xf0d9('0x4e')]},'json':!![]};return rp(_0x1f8c76)[_0xf0d9('0x16')](function(_0x1b7d2c){if(_0x1b7d2c['messages']){var _0x4214ea={'messageId':_0x1b7d2c['messages'][0x0][_0xf0d9('0xb')]};if(!_0x4456da[_0xf0d9('0x38')]){_0x4214ea[_0xf0d9('0x39')]=!![];}return _0x1a8b1d[_0xf0d9('0x27')](_0x4214ea);}else{return logger[_0xf0d9('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xf0d9('0x52'),util[_0xf0d9('0x28')](_0x1b7d2c,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x509c26){return logger[_0xf0d9('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf0d9('0x2b'),_0xf0d9('0x52'),util[_0xf0d9('0x28')](_0x509c26,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf0d9('0x2a'),_0xf0d9('0x2b'),'infobip','Missing\x20parameters:\x20base_url');}}else{logger[_0xf0d9('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf0d9('0x2b'),'infobip',_0xf0d9('0x3b'));}break;case _0xf0d9('0x58'):var _0x3955f9=require(_0xf0d9('0x59'));if(_0x4456da[_0xf0d9('0x5a')]){var _0x20d421={};_0x20d421[_0xf0d9('0x5b')]=_0x4456da[_0xf0d9('0x2d')];_0x20d421[_0xf0d9('0x20')]=_0x34ec08[_0xf0d9('0x20')];_0x20d421['sender']=_0x4456da[_0xf0d9('0x20')];_0x20d421['text']=_0x34ec08[_0xf0d9('0xd')];_0x20d421['timestamp']=+new Date();var _0x290f81='';var _0x4455d3='';var _0x34e181=Object[_0xf0d9('0x5c')](_0x20d421);_0x34e181[_0xf0d9('0x5d')]();for(var _0x305b6e=0x0;_0x305b6e<_0x34e181['length'];_0x305b6e++){if(_0x290f81!=''){_0x290f81+='&';}_0x290f81+=_0x34e181[_0x305b6e]+'='+encodeURIComponent(_0x20d421[_0x34e181[_0x305b6e]]);_0x4455d3+=_0x20d421[_0x34e181[_0x305b6e]];}_0x4455d3+=_0x4456da[_0xf0d9('0x5a')];_0x4455d3=_0x3955f9[_0xf0d9('0x5e')](_0xf0d9('0x5f'))[_0xf0d9('0x27')](_0x4455d3)[_0xf0d9('0x60')](_0xf0d9('0x61'));if(_0x290f81!==''){_0x290f81+='&';}_0x290f81+='signature='+_0x4455d3;var _0x583b36={'method':_0xf0d9('0x32'),'uri':_0x4456da[_0xf0d9('0x53')]+_0xf0d9('0x62')+_0x290f81,'json':!![]};return rp(_0x583b36)[_0xf0d9('0x16')](function(_0xd11523){var _0xa4e394=Object[_0xf0d9('0x5c')](_0xd11523);if(_0xd11523[_0xa4e394[0x0]][_0xf0d9('0x29')]&&parseInt(_0xd11523[_0xa4e394[0x0]][_0xf0d9('0x29')])===0x0){var _0x34703d={'messageId':_0xd11523[_0xa4e394[0x0]][_0xf0d9('0x63')]};if(!_0x4456da[_0xf0d9('0x38')]){_0x34703d[_0xf0d9('0x39')]=!![];}return _0x1a8b1d[_0xf0d9('0x27')](_0x34703d);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf0d9('0x2b'),_0xf0d9('0x58'),util['inspect'](_0xd11523[_0xf0d9('0x29')],{'showHidden':![],'depth':null}));}})[_0xf0d9('0x18')](function(_0x4d0175){return logger[_0xf0d9('0x29')](_0xf0d9('0x2a'),_0xf0d9('0x2b'),_0xf0d9('0x58'),util[_0xf0d9('0x28')](_0x4d0175,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf0d9('0x2a'),_0xf0d9('0x2b'),_0xf0d9('0x58'),_0xf0d9('0x64'));}break;case _0xf0d9('0x65'):if(_0x4456da[_0xf0d9('0x5a')]){var _0x31bd1c={'method':_0xf0d9('0x34'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x4456da['apiKey']},'body':{'content':_0x34ec08[_0xf0d9('0xd')],'to':[_0x34ec08[_0xf0d9('0x20')]],'from':_0x4456da[_0xf0d9('0x20')],'binary':![],'clientMessageId':_0xf0d9('0x66'),'charset':_0xf0d9('0x67')},'json':!![]};rp(_0x31bd1c)[_0xf0d9('0x16')](function(_0x2a6439){if(!_0x2a6439[_0xf0d9('0x29')]){var _0x16b31b={'messageId':_0x2a6439[_0xf0d9('0x21')][0x0][_0xf0d9('0x68')]};if(!_0x4456da[_0xf0d9('0x38')]){_0x16b31b[_0xf0d9('0x39')]=!![];}return _0x1a8b1d[_0xf0d9('0x27')](_0x16b31b);}else{return logger[_0xf0d9('0x29')](_0xf0d9('0x2a'),_0xf0d9('0x2b'),_0xf0d9('0x65'),util[_0xf0d9('0x28')](_0x2a6439[_0xf0d9('0x29')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x312c6b){return logger[_0xf0d9('0x29')](_0xf0d9('0x2a'),'afterCreate','clickatell',util[_0xf0d9('0x28')](_0x312c6b,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xf0d9('0x65'),_0xf0d9('0x64'));}break;case _0xf0d9('0x69'):if(_0x4456da[_0xf0d9('0x2d')]&&_0x4456da[_0xf0d9('0x31')]){var _0x56cb50=util['format']('%s:%s',_0x4456da[_0xf0d9('0x2d')],_0x4456da[_0xf0d9('0x31')]);var _0xc7c91c={'method':_0xf0d9('0x34'),'uri':_0xf0d9('0x6a')+_0x4456da[_0xf0d9('0x6b')]+_0xf0d9('0x6c'),'body':{'to':[_0x34ec08[_0xf0d9('0x20')]],'text':_0x34ec08['body'],'from':_0x4456da[_0xf0d9('0x20')],'applicationId':_0x4456da[_0xf0d9('0x6d')]},'headers':{'Authorization':util[_0xf0d9('0x43')]('Basic\x20%s',new Buffer(_0x56cb50)[_0xf0d9('0x45')](_0xf0d9('0x46')))},'json':!![]};rp(_0xc7c91c)[_0xf0d9('0x16')](function(_0x1a2bb6){if(_0x1a2bb6['id']){var _0x13a053={'messageId':_0x1a2bb6['id']};return _0x1a8b1d[_0xf0d9('0x27')](_0x13a053);}else{logger[_0xf0d9('0x29')](_0xf0d9('0x2a'),_0xf0d9('0x2b'),'bandwidth',util[_0xf0d9('0x28')](_0x1a2bb6,{'showHidden':![],'depth':null}));}})[_0xf0d9('0x18')](function(_0x2c3218){logger[_0xf0d9('0x29')](_0xf0d9('0x2a'),_0xf0d9('0x2b'),'bandwidth',util[_0xf0d9('0x28')](_0x2c3218,{'showHidden':![],'depth':null}));});}else{logger[_0xf0d9('0x29')](_0xf0d9('0x2a'),'afterCreate',_0xf0d9('0x69'),_0xf0d9('0x3b'));}break;case _0xf0d9('0x6e'):if(_0x4456da[_0xf0d9('0x5a')]){var _0x26d5e7={};var _0x583b36={'method':'POST','uri':_0xf0d9('0x6f'),'headers':{'Authorization':_0xf0d9('0x70')+_0x4456da[_0xf0d9('0x5a')],'Content-Type':_0xf0d9('0x56')},'body':{'from':_0x4456da[_0xf0d9('0x20')],'to':_0x34ec08[_0xf0d9('0x20')],'text':_0x34ec08[_0xf0d9('0xd')]},'json':!![]};return rp(_0x583b36)[_0xf0d9('0x16')](function(_0x12a9fd){if(_0x12a9fd['code']==0xca){_0x26d5e7[_0xf0d9('0x71')]=_0x12a9fd;var _0x34d242={'method':_0xf0d9('0x34'),'uri':_0xf0d9('0x72'),'headers':{'Authorization':_0xf0d9('0x70')+_0x4456da[_0xf0d9('0x5a')],'Content-Type':_0xf0d9('0x56')},'body':{'refid':_0x26d5e7['message'][_0xf0d9('0x73')]},'json':!![]};return rp(_0x34d242)[_0xf0d9('0x16')](function(_0x220cb4){_0x26d5e7[_0xf0d9('0x74')]=_0x220cb4;var _0x352bd2={'messageId':_0x26d5e7['message']['refid'],'read':!![]};return _0x1a8b1d[_0xf0d9('0x27')](_0x352bd2);});}else{return logger[_0xf0d9('0x29')](_0xf0d9('0x2a'),_0xf0d9('0x2b'),_0xf0d9('0x6e'),util[_0xf0d9('0x28')](_0x12a9fd,{'showHidden':![],'depth':null}));}})[_0xf0d9('0x18')](function(_0x338518){return logger[_0xf0d9('0x29')](_0xf0d9('0x2a'),_0xf0d9('0x2b'),_0xf0d9('0x6e'),util[_0xf0d9('0x28')](_0x338518,{'showHidden':![],'depth':null}));});}else{return logger[_0xf0d9('0x29')](_0xf0d9('0x2a'),'afterCreate',_0xf0d9('0x6e'),'Token\x20not\x20received');}break;}}})[_0xf0d9('0x75')](function(){_0x79588e();});}else{_0x79588e();}}},'charset':'utf8mb4','collate':_0xf0d9('0x76')});};
\ No newline at end of file
+var _0xa586=['clicksend','https://rest.clicksend.com/v3/sms/send','format','toString','base64','http_code','head','data','message_id','clickSend','plivo','authId','/api/sms/messages/','%s:%s','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','csc','crypto','apiKey','login','timestamp','keys','sort','length','createHash','md5','digest','hex','signature=','/external/get/send.php?','id_sms','clickatell','https://platform.clickatell.com/messages','uuid','bandwidth','accountId','/messages','applicationId','Missing\x20parameters:\x20username,\x20password','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','refid','status','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','update','createdAt','catch','error','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','remote','/status?token=','token','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','password','body','sender','login?username=','&password=','GET','split','sms','POST','user_key','session_key','internal_order_id','smsMethod','deliveryReport','read','skebby','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken'];(function(_0x49748c,_0x3d2005){var _0xedf6b6=function(_0x11628d){while(--_0x11628d){_0x49748c['push'](_0x49748c['shift']());}};_0xedf6b6(++_0x3d2005);}(_0xa586,0xb6));var _0x6a58=function(_0xae01dd,_0xbd8a3c){_0xae01dd=_0xae01dd-0x0;var _0x8c26df=_0xa586[_0xae01dd];return _0x8c26df;};'use strict';var _=require(_0x6a58('0x0'));var util=require(_0x6a58('0x1'));var logger=require(_0x6a58('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6a58('0x3'));var rimraf=require(_0x6a58('0x4'));var config=require(_0x6a58('0x5'));var attributes=require(_0x6a58('0x6'));module[_0x6a58('0x7')]=function(_0xa9e288,_0x3a9a9e){return _0xa9e288[_0x6a58('0x8')](_0x6a58('0x9'),attributes,{'tableName':_0x6a58('0xa'),'paranoid':![],'indexes':[{'name':_0x6a58('0xb'),'fields':['messageId']},{'name':'fti_sms_messages','fields':['body'],'type':_0x6a58('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1117ef,_0x3a29ff,_0x27caae){var _0xb164a4=_0xa9e288[_0x6a58('0xd')];var _0x437942=_0x1117ef[_0x6a58('0xe')]({'plain':!![]});if(_0x437942['direction'][_0x6a58('0xf')]()==='in'||_0x437942[_0x6a58('0x10')][_0x6a58('0xf')]()===_0x6a58('0x11')&&!_0x437942[_0x6a58('0x12')]&&!_[_0x6a58('0x13')](_0x437942[_0x6a58('0x14')])&&!_[_0x6a58('0x13')](_0x437942[_0x6a58('0x15')])){_0xb164a4[_0x6a58('0x16')][_0x6a58('0x17')]({'where':{'id':_0x437942[_0x6a58('0x15')]}})[_0x6a58('0x18')](function(_0xc70c0e){if(_0xc70c0e){_0xc70c0e[_0x6a58('0x19')]({'lastMsgAt':_0x437942[_0x6a58('0x1a')],'lastMsgDirection':_0x437942['direction'][_0x6a58('0xf')]()});}})[_0x6a58('0x1b')](function(_0x3d11c4){console[_0x6a58('0x1c')](_0x3d11c4);});}if(_0x437942[_0x6a58('0x10')]===_0x6a58('0x11')&&!_0x437942[_0x6a58('0x12')]){var _0x34de22;_0xb164a4['SmsAccount'][_0x6a58('0x1d')]({'where':{'id':_0x437942[_0x6a58('0x1e')]},'raw':!![]})[_0x6a58('0x18')](function(_0x4176a8){_0x34de22=_0x4176a8;if(_0x34de22&&_0x34de22['type']){switch(_0x34de22[_0x6a58('0x1f')]){case _0x6a58('0x20'):var _0x21a5f6=require(_0x6a58('0x20'));if(_0x34de22[_0x6a58('0x21')]&&_0x34de22[_0x6a58('0x22')]&&_0x34de22[_0x6a58('0x23')]){var _0x575ab4=new _0x21a5f6(_0x34de22[_0x6a58('0x21')],_0x34de22[_0x6a58('0x22')]);_0x575ab4[_0x6a58('0x24')][_0x6a58('0x25')]({'body':_0x437942['body'],'to':_0x437942[_0x6a58('0x23')],'from':_0x34de22[_0x6a58('0x23')],'statusCallback':_0x34de22[_0x6a58('0x26')]+'/api/sms/messages/'+_0x437942['id']+_0x6a58('0x27')+_0x34de22[_0x6a58('0x28')]})[_0x6a58('0x18')](function(_0x5f184a){if(_0x5f184a['sid']){return _0x1117ef[_0x6a58('0x19')]({'messageId':_0x5f184a['sid']});}})['catch'](function(_0x5c53e2){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6a58('0x29'),_0x6a58('0x20'),util[_0x6a58('0x2a')](_0x5c53e2,{'showHidden':![],'depth':null}));});}else{logger[_0x6a58('0x1c')](_0x6a58('0x2b'),'afterCreate','twilio',_0x6a58('0x2c'));}break;case'skebby':var _0x261c38=_0x6a58('0x2d');if(_0x34de22[_0x6a58('0x2e')]&&_0x34de22[_0x6a58('0x2f')]){var _0x31f592={'recipient':[_0x437942['phone']],'message':_0x437942[_0x6a58('0x30')],'message_type':_0x34de22['smsMethod']};if(_0x34de22['smsMethod']&&_0x34de22['smsMethod']!=='SI'){_0x31f592[_0x6a58('0x31')]=_0x34de22[_0x6a58('0x23')];}var _0x2e70ba={'url':_0x261c38+_0x6a58('0x32')+_0x34de22[_0x6a58('0x2e')]+_0x6a58('0x33')+_0x34de22[_0x6a58('0x2f')],'method':_0x6a58('0x34')};rp(_0x2e70ba)[_0x6a58('0x18')](function(_0xbbc061){var _0x5ce3e6=_0xbbc061[_0x6a58('0x35')](';');var _0x5e6521={'user_key':_0x5ce3e6[0x0],'session_key':_0x5ce3e6[0x1]};_0x2e70ba={'url':_0x261c38+_0x6a58('0x36'),'method':_0x6a58('0x37'),'headers':{'user_key':_0x5e6521[_0x6a58('0x38')],'Session_key':_0x5e6521[_0x6a58('0x39')]},'json':!![],'body':_0x31f592};return rp(_0x2e70ba);})[_0x6a58('0x18')](function(_0x1e4161){if(_0x1e4161['total_sent']>=0x1){var _0x488cd2={'messageId':_0x1e4161[_0x6a58('0x3a')]};if(_0x34de22[_0x6a58('0x3b')]!=='GP'||!_0x34de22[_0x6a58('0x3c')]){_0x488cd2[_0x6a58('0x3d')]=!![];}return _0x1117ef[_0x6a58('0x19')](_0x488cd2);}else{return logger[_0x6a58('0x1c')](_0x6a58('0x2b'),_0x6a58('0x29'),_0x6a58('0x3e'),util[_0x6a58('0x2a')](_0x1e4161,{'showHidden':![],'depth':null}));}})[_0x6a58('0x1b')](function(_0x51ddc2){return logger[_0x6a58('0x1c')](_0x6a58('0x2b'),'afterCreate',_0x6a58('0x3e'),util[_0x6a58('0x2a')](_0x51ddc2,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6a58('0x2b'),'afterCreate','skebby','Missing\x20parameters:\x20username,\x20password');}break;case _0x6a58('0x3f'):if(_0x34de22[_0x6a58('0x22')]){var _0x11831d={'recipient':_0x437942[_0x6a58('0x23')],'message':_0x437942[_0x6a58('0x30')],'sender':_0x34de22[_0x6a58('0x40')]||_0x34de22['phone'],'authorization':_0x34de22[_0x6a58('0x22')]};var _0x3a29ff={'method':_0x6a58('0x37'),'uri':_0x6a58('0x41'),'body':_0x11831d,'json':!![]};rp(_0x3a29ff)[_0x6a58('0x18')](function(_0x3d0b28){var _0x555fa8={'messageId':_0x3d0b28[_0x6a58('0x42')]};if(!_0x34de22[_0x6a58('0x3c')]){_0x555fa8[_0x6a58('0x3d')]=!![];}return _0x1117ef[_0x6a58('0x19')](_0x555fa8);})[_0x6a58('0x1b')](function(_0x3814b1){logger[_0x6a58('0x1c')](_0x6a58('0x2b'),_0x6a58('0x29'),_0x6a58('0x3f'),util[_0x6a58('0x2a')](_0x3814b1,{'showHidden':![],'depth':null}));});}else{logger[_0x6a58('0x1c')](_0x6a58('0x2b'),'afterCreate','connectel',_0x6a58('0x43'));}break;case _0x6a58('0x44'):if(_0x34de22['username']&&_0x34de22['password']){var _0x11831d={'messages':[{'source':'xCALLY\x20Motion','to':_0x437942[_0x6a58('0x23')],'body':_0x437942[_0x6a58('0x30')],'from':_0x34de22[_0x6a58('0x40')]||_0x34de22[_0x6a58('0x23')]}]};var _0x515517=util['format']('%s:%s',_0x34de22[_0x6a58('0x2e')],_0x34de22[_0x6a58('0x2f')]);var _0x3a29ff={'method':_0x6a58('0x37'),'uri':_0x6a58('0x45'),'body':_0x11831d,'headers':{'Authorization':util[_0x6a58('0x46')]('Basic\x20%s',new Buffer(_0x515517)[_0x6a58('0x47')](_0x6a58('0x48')))},'json':!![]};rp(_0x3a29ff)[_0x6a58('0x18')](function(_0x34f667){if(_0x34f667[_0x6a58('0x49')]>=0xc8&&_0x34f667[_0x6a58('0x49')]<=0xce){if(_0x34f667['data']&&_0x34f667['data']['queued_count']>0x0){var _0x279ab7=_[_0x6a58('0x4a')](_0x34f667[_0x6a58('0x4b')][_0x6a58('0x24')]);var _0x4a4ba9={'messageId':_0x279ab7[_0x6a58('0x4c')]};if(!_0x34de22['deliveryReport']){_0x4a4ba9[_0x6a58('0x3d')]=!![];}return _0x1117ef['update'](_0x4a4ba9);}else{logger[_0x6a58('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6a58('0x29'),_0x6a58('0x4d'),util['inspect'](_0x34f667,{'showHidden':![],'depth':null}));}}else{logger[_0x6a58('0x1c')](_0x6a58('0x2b'),'afterCreate',_0x6a58('0x4d'),util['inspect'](_0x34f667,{'showHidden':![],'depth':null}));}})[_0x6a58('0x1b')](function(_0x9a539d){logger[_0x6a58('0x1c')](_0x6a58('0x2b'),_0x6a58('0x29'),_0x6a58('0x4d'),util['inspect'](_0x9a539d,{'showHidden':![],'depth':null}));});}else{logger[_0x6a58('0x1c')](_0x6a58('0x2b'),_0x6a58('0x29'),_0x6a58('0x4d'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x6a58('0x4e'):if(_0x34de22[_0x6a58('0x4f')]&&_0x34de22[_0x6a58('0x22')]){var _0x11831d={'dst':_0x437942[_0x6a58('0x23')],'text':_0x437942[_0x6a58('0x30')],'src':_0x34de22[_0x6a58('0x40')]||_0x34de22[_0x6a58('0x23')],'url':_0x34de22[_0x6a58('0x26')]+_0x6a58('0x50')+_0x437942['id']+_0x6a58('0x27')+_0x34de22['token']};var _0x515517=util['format'](_0x6a58('0x51'),_0x34de22['authId'],_0x34de22[_0x6a58('0x22')]);var _0x3a29ff={'method':'POST','uri':util[_0x6a58('0x46')](_0x6a58('0x52'),_0x34de22[_0x6a58('0x4f')]),'body':_0x11831d,'headers':{'Authorization':util['format'](_0x6a58('0x53'),new Buffer(_0x515517)[_0x6a58('0x47')](_0x6a58('0x48')))},'json':!![]};rp(_0x3a29ff)['then'](function(_0x4beaa7){var _0x425f71={'messageId':_0x4beaa7['message_uuid'][0x0]};return _0x1117ef[_0x6a58('0x19')](_0x425f71);})[_0x6a58('0x1b')](function(_0x3cb7fc){logger[_0x6a58('0x1c')](_0x6a58('0x2b'),_0x6a58('0x29'),_0x6a58('0x4e'),util[_0x6a58('0x2a')](_0x3cb7fc,{'showHidden':![],'depth':null}));});}else{logger[_0x6a58('0x1c')](_0x6a58('0x2b'),_0x6a58('0x29'),'plivo',_0x6a58('0x54'));}break;case _0x6a58('0x55'):if(_0x34de22[_0x6a58('0x2e')]&&_0x34de22[_0x6a58('0x2f')]){if(_0x34de22[_0x6a58('0x56')]){var _0x47e81a={'method':'POST','uri':_0x34de22[_0x6a58('0x56')]+_0x6a58('0x57'),'body':{'username':_0x34de22['username'],'password':_0x34de22['password']},'json':!![]};return rp(_0x47e81a)[_0x6a58('0x18')](function(_0x5b3356){var _0x4bb257={'method':'POST','uri':_0x34de22[_0x6a58('0x56')]+_0x6a58('0x58'),'body':{'messages':[{'from':_0x34de22[_0x6a58('0x23')],'destinations':[{'to':_0x437942['phone']}],'text':_0x437942['body'],'notifyUrl':_0x34de22[_0x6a58('0x26')]+_0x6a58('0x50')+_0x437942['id']+_0x6a58('0x27')+_0x34de22[_0x6a58('0x28')],'notifyContentType':_0x6a58('0x59'),'callbackData':_0x34de22[_0x6a58('0x23')]+';'+_0x437942[_0x6a58('0x30')]}]},'headers':{'Authorization':_0x6a58('0x5a')+_0x5b3356[_0x6a58('0x28')]},'json':!![]};return rp(_0x4bb257)['then'](function(_0x4828a2){if(_0x4828a2[_0x6a58('0x24')]){var _0x2d8cc6={'messageId':_0x4828a2['messages'][0x0][_0x6a58('0xb')]};if(!_0x34de22[_0x6a58('0x3c')]){_0x2d8cc6['read']=!![];}return _0x1117ef[_0x6a58('0x19')](_0x2d8cc6);}else{return logger[_0x6a58('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6a58('0x29'),'infobip',util[_0x6a58('0x2a')](_0x4828a2,{'showHidden':![],'depth':null}));}});})[_0x6a58('0x1b')](function(_0x39b19a){return logger[_0x6a58('0x1c')](_0x6a58('0x2b'),_0x6a58('0x29'),_0x6a58('0x55'),util[_0x6a58('0x2a')](_0x39b19a,{'showHidden':![],'depth':null}));});}else{logger[_0x6a58('0x1c')](_0x6a58('0x2b'),_0x6a58('0x29'),_0x6a58('0x55'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x6a58('0x1c')](_0x6a58('0x2b'),'afterCreate',_0x6a58('0x55'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x6a58('0x5b'):var _0x42308c=require(_0x6a58('0x5c'));if(_0x34de22[_0x6a58('0x5d')]){var _0x4208b9={};_0x4208b9[_0x6a58('0x5e')]=_0x34de22[_0x6a58('0x2e')];_0x4208b9[_0x6a58('0x23')]=_0x437942[_0x6a58('0x23')];_0x4208b9[_0x6a58('0x31')]=_0x34de22[_0x6a58('0x23')];_0x4208b9['text']=_0x437942[_0x6a58('0x30')];_0x4208b9[_0x6a58('0x5f')]=+new Date();var _0x15c075='';var _0x5ae410='';var _0x5ce8bb=Object[_0x6a58('0x60')](_0x4208b9);_0x5ce8bb[_0x6a58('0x61')]();for(var _0x66caa=0x0;_0x66caa<_0x5ce8bb[_0x6a58('0x62')];_0x66caa++){if(_0x15c075!=''){_0x15c075+='&';}_0x15c075+=_0x5ce8bb[_0x66caa]+'='+encodeURIComponent(_0x4208b9[_0x5ce8bb[_0x66caa]]);_0x5ae410+=_0x4208b9[_0x5ce8bb[_0x66caa]];}_0x5ae410+=_0x34de22[_0x6a58('0x5d')];_0x5ae410=_0x42308c[_0x6a58('0x63')](_0x6a58('0x64'))[_0x6a58('0x19')](_0x5ae410)[_0x6a58('0x65')](_0x6a58('0x66'));if(_0x15c075!==''){_0x15c075+='&';}_0x15c075+=_0x6a58('0x67')+_0x5ae410;var _0x2e70ba={'method':_0x6a58('0x34'),'uri':_0x34de22[_0x6a58('0x56')]+_0x6a58('0x68')+_0x15c075,'json':!![]};return rp(_0x2e70ba)[_0x6a58('0x18')](function(_0x42e8f0){var _0x3bb719=Object[_0x6a58('0x60')](_0x42e8f0);if(_0x42e8f0[_0x3bb719[0x0]][_0x6a58('0x1c')]&&parseInt(_0x42e8f0[_0x3bb719[0x0]][_0x6a58('0x1c')])===0x0){var _0x1fff5a={'messageId':_0x42e8f0[_0x3bb719[0x0]][_0x6a58('0x69')]};if(!_0x34de22[_0x6a58('0x3c')]){_0x1fff5a[_0x6a58('0x3d')]=!![];}return _0x1117ef[_0x6a58('0x19')](_0x1fff5a);}else{return logger[_0x6a58('0x1c')](_0x6a58('0x2b'),_0x6a58('0x29'),_0x6a58('0x5b'),util[_0x6a58('0x2a')](_0x42e8f0[_0x6a58('0x1c')],{'showHidden':![],'depth':null}));}})[_0x6a58('0x1b')](function(_0x16f730){return logger[_0x6a58('0x1c')](_0x6a58('0x2b'),_0x6a58('0x29'),_0x6a58('0x5b'),util['inspect'](_0x16f730,{'showHidden':![],'depth':null}));});}else{logger[_0x6a58('0x1c')](_0x6a58('0x2b'),'afterCreate',_0x6a58('0x5b'),'Missing\x20parameters:\x20apiKey');}break;case _0x6a58('0x6a'):if(_0x34de22[_0x6a58('0x5d')]){var _0x158cd4={'method':_0x6a58('0x37'),'uri':_0x6a58('0x6b'),'headers':{'Authorization':_0x34de22[_0x6a58('0x5d')]},'body':{'content':_0x437942['body'],'to':[_0x437942[_0x6a58('0x23')]],'from':_0x34de22[_0x6a58('0x23')],'binary':![],'clientMessageId':_0x6a58('0x6c'),'charset':'UTF-8'},'json':!![]};rp(_0x158cd4)[_0x6a58('0x18')](function(_0x4c76d4){if(!_0x4c76d4[_0x6a58('0x1c')]){var _0x50682e={'messageId':_0x4c76d4[_0x6a58('0x24')][0x0]['apiMessageId']};if(!_0x34de22[_0x6a58('0x3c')]){_0x50682e[_0x6a58('0x3d')]=!![];}return _0x1117ef[_0x6a58('0x19')](_0x50682e);}else{return logger[_0x6a58('0x1c')](_0x6a58('0x2b'),'afterCreate','clickatell',util[_0x6a58('0x2a')](_0x4c76d4['error'],{'showHidden':![],'depth':null}));}})[_0x6a58('0x1b')](function(_0x460878){return logger[_0x6a58('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6a58('0x29'),_0x6a58('0x6a'),util[_0x6a58('0x2a')](_0x460878,{'showHidden':![],'depth':null}));});}else{logger[_0x6a58('0x1c')](_0x6a58('0x2b'),_0x6a58('0x29'),'clickatell','Missing\x20parameters:\x20apiKey');}break;case _0x6a58('0x6d'):if(_0x34de22[_0x6a58('0x2e')]&&_0x34de22[_0x6a58('0x2f')]){var _0x515517=util[_0x6a58('0x46')](_0x6a58('0x51'),_0x34de22[_0x6a58('0x2e')],_0x34de22[_0x6a58('0x2f')]);var _0x3a29ff={'method':_0x6a58('0x37'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x34de22[_0x6a58('0x6e')]+_0x6a58('0x6f'),'body':{'to':[_0x437942['phone']],'text':_0x437942[_0x6a58('0x30')],'from':_0x34de22[_0x6a58('0x23')],'applicationId':_0x34de22[_0x6a58('0x70')]},'headers':{'Authorization':util[_0x6a58('0x46')](_0x6a58('0x53'),new Buffer(_0x515517)[_0x6a58('0x47')](_0x6a58('0x48')))},'json':!![]};rp(_0x3a29ff)[_0x6a58('0x18')](function(_0x162ddd){if(_0x162ddd['id']){var _0xc62ca9={'messageId':_0x162ddd['id']};return _0x1117ef[_0x6a58('0x19')](_0xc62ca9);}else{logger[_0x6a58('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x6a58('0x6d'),util[_0x6a58('0x2a')](_0x162ddd,{'showHidden':![],'depth':null}));}})[_0x6a58('0x1b')](function(_0x519724){logger[_0x6a58('0x1c')](_0x6a58('0x2b'),_0x6a58('0x29'),_0x6a58('0x6d'),util['inspect'](_0x519724,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6a58('0x2b'),_0x6a58('0x29'),_0x6a58('0x6d'),_0x6a58('0x71'));}break;case _0x6a58('0x72'):if(_0x34de22[_0x6a58('0x5d')]){var _0x2ad499={};var _0x2e70ba={'method':_0x6a58('0x37'),'uri':_0x6a58('0x73'),'headers':{'Authorization':'Bearer\x20'+_0x34de22[_0x6a58('0x5d')],'Content-Type':'application/json'},'body':{'from':_0x34de22[_0x6a58('0x23')],'to':_0x437942[_0x6a58('0x23')],'text':_0x437942['body']},'json':!![]};return rp(_0x2e70ba)['then'](function(_0x44ee2e){if(_0x44ee2e[_0x6a58('0x74')]==0xca){_0x2ad499[_0x6a58('0x75')]=_0x44ee2e;var _0x315246={'method':_0x6a58('0x37'),'uri':_0x6a58('0x76'),'headers':{'Authorization':_0x6a58('0x77')+_0x34de22[_0x6a58('0x5d')],'Content-Type':_0x6a58('0x59')},'body':{'refid':_0x2ad499[_0x6a58('0x75')][_0x6a58('0x78')]},'json':!![]};return rp(_0x315246)['then'](function(_0x58bab3){_0x2ad499[_0x6a58('0x79')]=_0x58bab3;var _0x2d8bf8={'messageId':_0x2ad499[_0x6a58('0x75')]['refid'],'read':!![]};return _0x1117ef['update'](_0x2d8bf8);});}else{return logger[_0x6a58('0x1c')](_0x6a58('0x2b'),_0x6a58('0x29'),'intelepeer',util[_0x6a58('0x2a')](_0x44ee2e,{'showHidden':![],'depth':null}));}})[_0x6a58('0x1b')](function(_0x7641b4){return logger[_0x6a58('0x1c')](_0x6a58('0x2b'),'afterCreate',_0x6a58('0x72'),util[_0x6a58('0x2a')](_0x7641b4,{'showHidden':![],'depth':null}));});}else{return logger[_0x6a58('0x1c')](_0x6a58('0x2b'),_0x6a58('0x29'),_0x6a58('0x72'),'Token\x20not\x20received');}break;}}})[_0x6a58('0x7a')](function(){_0x27caae();});}else{_0x27caae();}}},'charset':_0x6a58('0x7b'),'collate':_0x6a58('0x7c')});};
\ No newline at end of file