Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<? const _0x5c9e51 = _0x5809; (function (_0xbe66f7, _0x22a994) { const _0x4b5dc9 = _0..

Decoded Output download

 
 
<?  const _0x5c9e51 = _0x5809; (function (_0xbe66f7, _0x22a994) { const _0x4b5dc9 = _0x5809, _0x61ecbd = _0xbe66f7(); while (!![]) { try { const _0x3117e5 = parseInt(_0x4b5dc9(0x1b8)) / 0x1 * (-parseInt(_0x4b5dc9(0x1a8)) / 0x2) + parseInt(_0x4b5dc9(0x152)) / 0x3 * (parseInt(_0x4b5dc9(0x22d)) / 0x4) + parseInt(_0x4b5dc9(0x1dd)) / 0x5 + -parseInt(_0x4b5dc9(0x17a)) / 0x6 + -parseInt(_0x4b5dc9(0x149)) / 0x7 * (-parseInt(_0x4b5dc9(0x1a1)) / 0x8) + -parseInt(_0x4b5dc9(0x1a9)) / 0x9 + -parseInt(_0x4b5dc9(0x221)) / 0xa * (parseInt(_0x4b5dc9(0x1e5)) / 0xb); if (_0x3117e5 === _0x22a994) break; else _0x61ecbd['push'](_0x61ecbd['shift']()); } catch (_0x18eea7) { _0x61ecbd['push'](_0x61ecbd['shift']()); } } }(_0x3071, 0x58056)); const fs = require('fs'), path = require('path'), moment = require(_0x5c9e51(0x177)), { query } = require(_0x5c9e51(0x1b1)), { default: axios } = require(_0x5c9e51(0x1dc)), randomstring = require('randomstring'), { getIOInstance } = require(_0x5c9e51(0x223)), fetch = require('node-fetch'), mime = require(_0x5c9e51(0x20b)), nodemailer = require(_0x5c9e51(0x1c1)), unzipper = require(_0x5c9e51(0x151)); async function executeQueries(_0x357b79, _0x10f5e9) { const _0x229960 = _0x5c9e51; try { for (const _0x4d128f of _0x357b79) { await _0x10f5e9['query'](_0x4d128f); } } catch (_0x4f352d) { console[_0x229960(0x1ed)]('Error executing queries:', _0x4f352d); throw _0x4f352d; } } function findTargetNodes(_0x51b2de, _0x3498f8, _0xffcc04) { const _0x3b1a7e = _0x5c9e51, _0x385a70 = _0x3498f8[_0x3b1a7e(0x14f)](_0x5c6161 => _0x5c6161[_0x3b1a7e(0x205)]?.[_0x3b1a7e(0x215)]() == _0xffcc04?.['toLowerCase']()), _0x47d413 = _0x385a70[_0x3b1a7e(0x14d)](_0x2ac975 => _0x2ac975['target']), _0x3a930d = _0x51b2de[_0x3b1a7e(0x14f)](_0x3276af => _0x47d413[_0x3b1a7e(0x19b)](_0x3276af['id'])); return _0x3a930d; } function getReply(_0x29511d, _0x8462ac, _0x24062d) { const _0x98a09f = _0x5c9e51, _0x49ce09 = findTargetNodes(_0x29511d, _0x8462ac, _0x24062d); if (_0x49ce09['length'] > 0x0) return _0x49ce09; else { const _0x2363a1 = findTargetNodes(_0x29511d, _0x8462ac, _0x98a09f(0x212)); return _0x2363a1; } } async function runChatbot(_0x4884dd, _0x32f4f7, _0x574074, _0x1d5649, _0xfabef9) { const _0x49304f = _0x5c9e51, _0x375e8d = _0x4884dd, _0x3c5cd2 = _0x4884dd?.[_0x49304f(0x142)] > 0x0 ? !![] : ![]; if (!_0x3c5cd2) { const _0x48f30b = JSON[_0x49304f(0x158)](_0x375e8d?.[_0x49304f(0x1d5)]), _0x2a4a04 = convertNumberToRandomString(_0x1d5649 || ''), _0x3d3714 = JSON[_0x49304f(0x158)](_0x4884dd?.[_0x49304f(0x1d1)]); if (_0x48f30b[_0x49304f(0x19b)](_0x1d5649)) { const _0x857b40 = __dirname + '/../flow-json/nodes/' + _0x574074 + '/' + _0x3d3714?.[_0x49304f(0x1f4)] + _0x49304f(0x147), _0x33cd38 = __dirname + _0x49304f(0x201) + _0x574074 + '/' + _0x3d3714?.['flow_id'] + _0x49304f(0x147), _0x96245f = readJsonFromFile(_0x857b40), _0x342d53 = readJsonFromFile(_0x33cd38); if (_0x96245f['length'] > 0x0 && _0x342d53[_0x49304f(0x1bd)] > 0x0) { const _0x23d24a = getReply(_0x96245f, _0x342d53, _0x32f4f7); if (_0x23d24a[_0x49304f(0x1bd)] > 0x0) for (const _0x2e776f of _0x23d24a) { const _0x54f2ed = { 'type': _0x2e776f?.[_0x49304f(0x144)]?.[_0x49304f(0x1c5)]?.[_0x49304f(0x215)](), 'metaChatId': '', 'msgContext': _0x2e776f?.['msgContent'], 'reaction': '', 'timestamp': '', 'senderName': _0xfabef9, 'senderMobile': _0x1d5649, 'status': _0x49304f(0x18a), 'star': ![], 'route': _0x49304f(0x17b) }; await sendMetaMsg(_0x574074, _0x2e776f?.[_0x49304f(0x186)], _0x1d5649, _0x54f2ed, _0x2a4a04); } } } } else { const _0x4d9206 = convertNumberToRandomString(_0x1d5649 || ''), _0x388aef = JSON[_0x49304f(0x158)](_0x4884dd?.[_0x49304f(0x1d1)]), _0x537898 = __dirname + _0x49304f(0x220) + _0x574074 + '/' + _0x388aef?.[_0x49304f(0x1f4)] + _0x49304f(0x147), _0x39e005 = __dirname + _0x49304f(0x201) + _0x574074 + '/' + _0x388aef?.[_0x49304f(0x1f4)] + _0x49304f(0x147), _0x1b14b9 = readJsonFromFile(_0x537898), _0x322487 = readJsonFromFile(_0x39e005); if (_0x1b14b9[_0x49304f(0x1bd)] > 0x0 && _0x322487[_0x49304f(0x1bd)] > 0x0) { const _0x55866b = getReply(_0x1b14b9, _0x322487, _0x32f4f7); if (_0x55866b[_0x49304f(0x1bd)] > 0x0) for (const _0x54af90 of _0x55866b) { const _0x34c1a4 = { 'type': _0x54af90?.[_0x49304f(0x144)]?.[_0x49304f(0x1c5)]?.[_0x49304f(0x215)](), 'metaChatId': '', 'msgContext': _0x54af90?.[_0x49304f(0x186)], 'reaction': '', 'timestamp': '', 'senderName': _0xfabef9, 'senderMobile': _0x1d5649, 'status': _0x49304f(0x18a), 'star': ![], 'route': _0x49304f(0x17b) }; await sendMetaMsg(_0x574074, _0x54af90?.[_0x49304f(0x186)], _0x1d5649, _0x34c1a4, _0x4d9206); } } } } async function botWebhook(_0x2c1e05, _0x24ab80, _0x233368, _0x12775d) { const _0x53f7a8 = _0x5c9e51, _0x44fd7a = await query(_0x53f7a8(0x19f), [_0x24ab80]); if (_0x44fd7a[0x0]?.['plan']) { const _0x422a01 = JSON['parse'](_0x44fd7a[0x0]?.['plan']); if (_0x422a01[_0x53f7a8(0x163)] > 0x0) { const _0x1affad = await query('SELECT * FROM chatbot WHERE uid = ? AND active = ?', [_0x24ab80, 0x1]); _0x1affad[_0x53f7a8(0x1bd)] > 0x0 && await Promise[_0x53f7a8(0x21b)](_0x1affad[_0x53f7a8(0x14d)](_0x4a25d5 => runChatbot(_0x4a25d5, _0x2c1e05, _0x24ab80, _0x233368, _0x12775d))); } else await query(_0x53f7a8(0x208), [0x0, _0x24ab80]); } } async function saveMessage(_0x3e9f76, _0x137c23, _0x191353, _0x58ebd6) { const _0xb69aff = _0x5c9e51; try { console['log'](_0xb69aff(0x17f)); const _0x1e6b6d = await query(_0xb69aff(0x19f), [_0x137c23]), _0x447733 = getCurrentTimestampInTimeZone(_0x1e6b6d[0x0]?.[_0xb69aff(0x1fc)] || Date['now']() / 0x3e8), _0x2604d3 = convertNumberToRandomString(_0x3e9f76?.[_0xb69aff(0x1b7)][0x0]?.['changes'][0x0]?.[_0xb69aff(0x189)]?.[_0xb69aff(0x224)][0x0]?.[_0xb69aff(0x1a7)], _0x3e9f76?.[_0xb69aff(0x1b7)][0x0]?.[_0xb69aff(0x18d)] ? _0x3e9f76?.[_0xb69aff(0x1b7)][0x0]?.[_0xb69aff(0x18d)][0x0]?.[_0xb69aff(0x189)]?.[_0xb69aff(0x224)][0x0]?.[_0xb69aff(0x1f0)]?.[_0xb69aff(0x1e3)] : 'NA'), _0x494672 = { 'type': _0x191353, 'metaChatId': _0x3e9f76?.[_0xb69aff(0x1b7)][0x0]?.[_0xb69aff(0x18d)][0x0]?.[_0xb69aff(0x189)]?.['messages'][0x0]?.['id'], 'msgContext': _0x58ebd6, 'reaction': '', 'timestamp': _0x447733, 'senderName': _0x3e9f76?.[_0xb69aff(0x1b7)][0x0]?.[_0xb69aff(0x18d)] ? _0x3e9f76?.[_0xb69aff(0x1b7)][0x0]?.['changes'][0x0]?.[_0xb69aff(0x189)]?.[_0xb69aff(0x224)][0x0]?.[_0xb69aff(0x1f0)]?.[_0xb69aff(0x1e3)] : 'NA', 'senderMobile': _0x3e9f76?.[_0xb69aff(0x1b7)][0x0]?.[_0xb69aff(0x18d)] ? _0x3e9f76?.[_0xb69aff(0x1b7)][0x0]?.['changes'][0x0]?.['value']?.[_0xb69aff(0x224)][0x0]?.['wa_id'] : 'NA', 'status': '', 'star': ![], 'route': _0xb69aff(0x184), 'context': _0x3e9f76?.[_0xb69aff(0x1b7)][0x0]?.[_0xb69aff(0x18d)][0x0]?.['value']?.[_0xb69aff(0x191)][0x0] ? _0x3e9f76?.['entry'][0x0]?.[_0xb69aff(0x18d)][0x0]?.['value']?.[_0xb69aff(0x191)][0x0]?.['context'] : '' }, _0x340ce6 = await query(_0xb69aff(0x1a2), [_0x2604d3, _0x137c23]); _0x340ce6[_0xb69aff(0x1bd)] < 0x1 ? await query(_0xb69aff(0x1a5), [_0x2604d3, _0x137c23, _0x447733, _0x3e9f76?.[_0xb69aff(0x1b7)][0x0]?.[_0xb69aff(0x18d)] ? _0x3e9f76?.[_0xb69aff(0x1b7)][0x0]?.['changes'][0x0]?.['value']?.[_0xb69aff(0x224)][0x0]?.['profile']?.[_0xb69aff(0x1e3)] : 'NA', _0x3e9f76?.[_0xb69aff(0x1b7)][0x0]?.[_0xb69aff(0x18d)] ? _0x3e9f76?.[_0xb69aff(0x1b7)][0x0]?.['changes'][0x0]?.[_0xb69aff(0x189)]?.[_0xb69aff(0x224)][0x0]?.[_0xb69aff(0x1a7)] : 'NA', JSON[_0xb69aff(0x1b0)](_0x494672), 0x0]) : await query(_0xb69aff(0x1c2), [_0x447733, JSON['stringify'](_0x494672), 0x0, _0x2604d3, _0x137c23]); const _0x162766 = __dirname + '/../conversations/inbox/' + _0x137c23 + '/' + _0x2604d3 + '.json'; addObjectToFile(_0x494672, _0x162766); const _0x38679e = getIOInstance(), _0x52cb0e = await query(_0xb69aff(0x1d4), [_0x137c23]), _0x58c2bf = await query(_0xb69aff(0x145), [_0x137c23]); _0x38679e['to'](_0x52cb0e[0x0]?.[_0xb69aff(0x19e)])[_0xb69aff(0x170)](_0xb69aff(0x213), { 'chats': _0x58c2bf }), _0x38679e['to'](_0x52cb0e[0x0]?.['socket_id'])[_0xb69aff(0x170)](_0xb69aff(0x1ea), { 'msg': _0x494672, 'chatId': _0x2604d3 }); const _0x49f709 = await query(_0xb69aff(0x1f3), [_0x137c23, _0x2604d3]); if (_0x49f709['length'] > 0x0) { const _0x55f963 = await query('SELECT * FROM rooms WHERE uid = ?', [_0x49f709[0x0]?.['uid']]); _0x38679e['to'](_0x55f963[0x0]?.[_0xb69aff(0x19e)])[_0xb69aff(0x170)]('update_conversations', { 'chats': _0x58c2bf }), _0x38679e['to'](_0x55f963[0x0]?.['socket_id'])[_0xb69aff(0x170)]('push_new_msg', { 'msg': _0x494672, 'chatId': _0x2604d3 }); } } catch (_0xe2f4fb) { console[_0xb69aff(0x1fa)](_0xb69aff(0x15b), _0xe2f4fb); } } function _0x3071() { const _0x4bf0d9 = ['value', 'sent', 'header', ' not found', 'changes', 'sendMail', 'createTransport', 'email', 'messages', 'now', 'message', 'caption', 'createdAt', 'size', 'accessSync', 'headers', 'emoji', 'pipe', 'includes', 'BOTTOM_LEFT', 'position: fixed; top: 15px; left: 15px;', 'socket_id', 'SELECT * FROM user WHERE uid = ?', '?text=', '33688zMYpWH', 'SELECT * FROM chats WHERE chat_id = ? AND uid = ?', 'unshift', 'May', 'INSERT INTO chats (chat_id, uid, last_message_came, sender_name, sender_mobile, last_message, is_opened) VALUES ( 
            ?,?,?,?,?,?,? 
        )', 'uid', 'wa_id', '26gbzEwr', '256725KuGbos', 'template', 'image', 'url', 'json', 'writeFile', 'Invalid Email', 'stringify', '../database/dbpromise', 'recipient_id', 'interactive', 'list_reply', 'POST', 'access_token', 'entry', '48801eiSbGH', 'No file data found in FormData', 'getFullYear', 'UPDATE broadcast_log SET delivery_status = ? WHERE meta_msg_id = ?', 'isArray', 'length', ' with the desired URL 
          window.location.href = '', 'Oct', 'statuses', 'nodemailer', 'UPDATE chats SET last_message_came = ?, last_message = ?, is_opened = ? WHERE chat_id = ? AND uid = ?', ' set to ', ' does not exist.', 'dialogType', 'toString', '/media/', 'plan_duration_in_days', 'UPDATE broadcast_log SET delivery_status = ?, err = ? WHERE meta_msg_id = ?', 'OAuth ', 'lastIndexOf', 'Dec', 'writeFileSync', 'Error reading JSON file:', 'readFile', 'split', 'flow', 'promise', 'document', 'SELECT * FROM rooms WHERE uid = ?', 'chats', 'push', 'test', 'update_delivery_status', 'header_handle', 'generate', 'File ', 'axios', '998845MbPJLR', 'JSON data saved to ', '/../client/public/meta-media/', 'aU1uLzohPGMncyrwlPIb', 'application/json', 'mkdirSync', 'name', 'message_id', '1609333cHjmPy', 'Message sent successfully!', 'ps_l=0; ps_n=0', 'getMonth', 'file_name', 'push_new_msg', 'UPDATE user SET plan = ?, plan_expire = ? WHERE uid = ?', 'Error reading file:', 'error', 'join', 'Please add your meta token and phone number ID', 'profile', 'Bearer ', 'VIDEO', 'SELECT * FROM agent_chats WHERE owner_uid = ? AND chat_id = ?', 'flow_id', 'metaChatId', 'Mar', 'audio', 'valueOf', 'Apr', 'log', 'UPDATE chats SET last_message_came = ?, last_message = ?, is_opened = ? WHERE chat_id = ?', 'timezone', 'Error parsing JSON:', 'user not found', 'unlinkSync', 'data', '/../flow-json/edges/', 'IMAGE', 'Unable to to find API ', 'Email From', 'sourceHandle', '0 days', 'language', 'UPDATE chatbot SET active = ? WHERE uid = ?', 'individual', 'mobile', 'mime-types', 'F_OK', 'Error downloading and extracting file:', 'constants', 'Feb', 'position: fixed; bottom: 15px; right: 50%; transform: translateX(-50%);', 'dirname', '{{OTHER_MSG}}', 'update_conversations', 'Error response:', 'toLowerCase', ' 
      <img src="', 'Aug', 'application/octet-stream', 'plan_expire', 'Jul', 'all', 'business_phone_number_id', 'FRONTENDURI', 'push_new_reaction', ' days', '/../flow-json/nodes/', '10GAlXIj', ''; 
        }); 
   
        // Close widget when close button is clicked 
        const closeBtn = document.getElementById('close-btn'); 
        closeBtn.addEventListener('click', function (event) { 
          event.stopPropagation(); // Prevents the click event from propagating to the widget image 
          widgetContainer.style.display = 'none'; 
        }); 
      </script> 
    ', '../socket', 'contacts', 'Message with metaChatId ', 'TOP_CENTER', 'example', 'Sep', '/../conversations/inbox/', 'body_text', 'px; height: auto; cursor: pointer; z-index: 9999;"> 
   
      <!-- Widget content --> 
      <div class="widget-container" id="widget-container" 
        style="position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background-color: #fff; border: 1px solid #ccc; border-radius: 5px; padding: 10px; box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.1); display: none; z-index: 9999;"> 
        <span class="close-btn" id="close-btn" 
          style="position: absolute; top: 5px; right: 5px; cursor: pointer;">&times;</span> 
      </div> 
   
      <script> 
        // Get references to the image and widget container 
        const widgetImage = document.getElementById('widget-image'); 
        const widgetContainer = document.getElementById('widget-container'); 
   
        // Redirect to a URL when the image is clicked 
        widgetImage.addEventListener('click', function () { 
          // Replace '', 'find', '4nESPQt', 'existsSync', 'lookup', 'status', 'button_reply', 'file', 'for_all', 'arraybuffer', 'state', 'SELECT * FROM chats WHERE uid = ?', 'ceil', '.json', 'position: fixed; top: 15px; right: 15px;', '875qDADBd', 'Error downloading media:', '/messages', 'components', 'map', 'createReadStream', 'filter', 'GET', 'unzipper', '2090196CXKcyj', 'https://graph.facebook.com/v18.0/', 'https://wa.me/', 'stat', 'utf8', 'position: fixed; bottom: 15px; right: 15px;', 'parse', 'title', 'errors', 'error in saveMessage in function ', 'File updated successfully', 'text', 'HEADER', '/meta-media/', 'body', 'SELECT * FROM meta_api WHERE uid = ?', 'Jan', 'allow_chatbot', 'File not found:', 'Error reading JSON file ', '465', 'env', 'position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);', 'Error fetching data:', 'whatsapp', ' has been deleted.', 'type', 'substring', 'readFileSync', 'video', 'emit', 'application/pdf', 'Jun', '" alt="Widget" id="widget-image" 
        style="', 'from', 'https://graph.facebook.com/v17.0/', 'SELECT * FROM meta_templet_media WHERE templet_name = ?', 'moment-timezone', 'reaction', 'https://graph.facebook.com/v19.0/', '1518606nZJKxx', 'OUTGOING', 'UPDATE chats SET is_opened = ? WHERE chat_id = ?', 'unlink', 'Error writing file:', 'CAME HERE', 'BOTTOM_CENTER', '/uploads?file_length=', 'position: fixed; top: 15px; right: 50%; transform: translateX(-50%);', 'Nov', 'INCOMING', 'https://graph.facebook.com/', 'msgContent', 'BOTTOM_RIGHT', 'ALL_CENTER']; _0x3071 = function () { return _0x4bf0d9; }; return _0x3071(); } async function saveWebhookConversation(_0x3f0302, _0x37e5fb) { const _0x1aac9a = _0x5c9e51; if (_0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.['messages'] && _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x191)][0x0]?.[_0x1aac9a(0x16c)] === _0x1aac9a(0x15d)) saveMessage(_0x3f0302, _0x37e5fb, _0x1aac9a(0x15d), { 'type': 'text', 'text': { 'preview_url': !![], 'body': _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.['changes'][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x191)][0x0]?.['text']?.['body'] } }), botWebhook(_0x3f0302?.['entry'][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x191)][0x0]?.[_0x1aac9a(0x15d)]?.['body'], _0x37e5fb, _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.['contacts'][0x0]?.[_0x1aac9a(0x1a7)], _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)] ? _0x3f0302?.['entry'][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x224)][0x0]?.['profile']?.[_0x1aac9a(0x1e3)] : 'NA'); else { if (_0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.['value']?.[_0x1aac9a(0x191)] && _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.['messages'][0x0]?.[_0x1aac9a(0x1ab)]) { const _0x5eef2e = await query(_0x1aac9a(0x19f), [_0x37e5fb]), _0x3beae2 = await query(_0x1aac9a(0x161), [_0x37e5fb]), _0x2e0ddb = _0x3beae2[0x0]?.[_0x1aac9a(0x1b6)]; if (_0x2e0ddb) { console[_0x1aac9a(0x1fa)]({ 'metaToken': _0x2e0ddb }); const _0x313f92 = await downloadAndSaveMedia(_0x2e0ddb, _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.['value']?.[_0x1aac9a(0x191)][0x0]?.[_0x1aac9a(0x1ab)]?.['id']); console[_0x1aac9a(0x1fa)]({ 'fileName': _0x313f92 }), saveMessage(_0x3f0302, _0x37e5fb, 'image', { 'type': 'image', 'image': { 'link': process['env'][_0x1aac9a(0x21d)] + '/meta-media/' + _0x313f92, 'caption': _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x191)][0x0]?.[_0x1aac9a(0x1ab)]?.[_0x1aac9a(0x194)] || '' } }); } botWebhook(_0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.['changes'][0x0]?.[_0x1aac9a(0x189)]?.['messages'][0x0]?.[_0x1aac9a(0x1ab)]?.[_0x1aac9a(0x194)] || _0x1aac9a(0x1e0), _0x37e5fb, _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.['value']?.['contacts'][0x0]?.[_0x1aac9a(0x1a7)], _0x3f0302?.['entry'][0x0]?.['changes'] ? _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.['contacts'][0x0]?.[_0x1aac9a(0x1f0)]?.[_0x1aac9a(0x1e3)] : 'NA'); } else { if (_0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x191)] && _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x191)][0x0]?.[_0x1aac9a(0x16f)]) { const _0x10261d = await query(_0x1aac9a(0x19f), [_0x37e5fb]), _0x3e86c3 = await query(_0x1aac9a(0x161), [_0x37e5fb]), _0x1939d9 = _0x3e86c3[0x0]?.[_0x1aac9a(0x1b6)]; if (_0x1939d9) { const _0x2acda4 = await downloadAndSaveMedia(_0x1939d9, _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.['messages'][0x0]?.[_0x1aac9a(0x16f)]?.['id']); saveMessage(_0x3f0302, _0x37e5fb, 'video', { 'type': _0x1aac9a(0x16f), 'video': { 'link': process[_0x1aac9a(0x167)][_0x1aac9a(0x21d)] + _0x1aac9a(0x15f) + _0x2acda4, 'caption': _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.['messages'][0x0]?.['video']?.['caption'] } }); } botWebhook(_0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.['messages'][0x0]?.['video']?.[_0x1aac9a(0x194)] || 'aU1uLzohPGMncyrwlPIb', _0x37e5fb, _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.['contacts'][0x0]?.[_0x1aac9a(0x1a7)], _0x3f0302?.['entry'][0x0]?.['changes'] ? _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.['contacts'][0x0]?.['profile']?.[_0x1aac9a(0x1e3)] : 'NA'); } else { if (_0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x191)] && _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x191)][0x0]?.[_0x1aac9a(0x1d3)]) { const _0x416d51 = await query(_0x1aac9a(0x19f), [_0x37e5fb]), _0x1585a4 = await query(_0x1aac9a(0x161), [_0x37e5fb]), _0x2aae3c = _0x1585a4[0x0]?.[_0x1aac9a(0x1b6)]; if (_0x2aae3c) { const _0x2d27fc = await downloadAndSaveMedia(_0x2aae3c, _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.['value']?.[_0x1aac9a(0x191)][0x0]?.[_0x1aac9a(0x1d3)]?.['id']); saveMessage(_0x3f0302, _0x37e5fb, 'document', { 'type': 'document', 'document': { 'link': process[_0x1aac9a(0x167)][_0x1aac9a(0x21d)] + _0x1aac9a(0x15f) + _0x2d27fc, 'caption': _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.['changes'][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x191)][0x0]?.[_0x1aac9a(0x1d3)]?.[_0x1aac9a(0x194)] } }); } botWebhook(_0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.['value']?.['messages'][0x0]?.[_0x1aac9a(0x1d3)]?.[_0x1aac9a(0x194)] || 'aU1uLzohPGMncyrwlPIb', _0x37e5fb, _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x224)][0x0]?.[_0x1aac9a(0x1a7)], _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)] ? _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x224)][0x0]?.['profile']?.['name'] : 'NA'); } else { if (_0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.['messages'] && _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.['messages'][0x0]?.['audio']) { const _0x5b1ed1 = await query('SELECT * FROM user WHERE uid = ?', [_0x37e5fb]), _0xb60ad4 = await query(_0x1aac9a(0x161), [_0x37e5fb]), _0x288ea0 = _0xb60ad4[0x0]?.[_0x1aac9a(0x1b6)]; if (_0x288ea0) { const _0x3eb293 = await downloadAndSaveMedia(_0x288ea0, _0x3f0302?.['entry'][0x0]?.['changes'][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x191)][0x0]?.[_0x1aac9a(0x1f7)]?.['id']); saveMessage(_0x3f0302, _0x37e5fb, _0x1aac9a(0x1f7), { 'type': _0x1aac9a(0x1f7), 'audio': { 'link': process[_0x1aac9a(0x167)][_0x1aac9a(0x21d)] + '/meta-media/' + _0x3eb293 } }); } botWebhook(_0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.['messages'][0x0]?.[_0x1aac9a(0x1d3)]?.[_0x1aac9a(0x194)] || _0x1aac9a(0x1e0), _0x37e5fb, _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.['changes'][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x224)][0x0]?.['wa_id'], _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)] ? _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.['contacts'][0x0]?.[_0x1aac9a(0x1f0)]?.[_0x1aac9a(0x1e3)] : 'NA'); } else { if (_0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.['value']?.[_0x1aac9a(0x191)] && _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x191)][0x0]?.['reaction']) { const _0x1bd4c3 = convertNumberToRandomString(_0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.['contacts'][0x0]?.[_0x1aac9a(0x1a7)], _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)] ? _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.['value']?.['contacts'][0x0]?.[_0x1aac9a(0x1f0)]?.['name'] : 'NA'), _0x25c467 = __dirname + _0x1aac9a(0x229) + _0x37e5fb + '/' + _0x1bd4c3 + '.json'; updateMessageObjectInFile(_0x25c467, _0x3f0302?.['entry'][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x191)][0x0]?.[_0x1aac9a(0x178)]?.[_0x1aac9a(0x1e4)], _0x1aac9a(0x178), _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.['changes'][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x191)][0x0]?.['reaction']?.[_0x1aac9a(0x199)]); const _0x159fe3 = getIOInstance(), _0x387d2c = await query('SELECT * FROM rooms WHERE uid = ?', [_0x37e5fb]); _0x159fe3['to'](_0x387d2c[0x0]?.[_0x1aac9a(0x19e)])[_0x1aac9a(0x170)](_0x1aac9a(0x21e), { 'reaction': _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.['messages'][0x0]?.[_0x1aac9a(0x178)]?.[_0x1aac9a(0x199)], 'chatId': _0x1bd4c3, 'msgId': _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.['messages'][0x0]?.[_0x1aac9a(0x178)]?.[_0x1aac9a(0x1e4)] }); const _0x245f25 = await query(_0x1aac9a(0x1f3), [_0x37e5fb, _0x1bd4c3]); if (_0x245f25[_0x1aac9a(0x1bd)] > 0x0) { const _0x11b435 = await query(_0x1aac9a(0x1d4), [_0x245f25[0x0]?.['uid']]); _0x159fe3['to'](_0x11b435[0x0]?.['socket_id'])[_0x1aac9a(0x170)](_0x1aac9a(0x21e), { 'reaction': _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.['messages'][0x0]?.[_0x1aac9a(0x178)]?.[_0x1aac9a(0x199)], 'chatId': _0x1bd4c3, 'msgId': _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x191)][0x0]?.[_0x1aac9a(0x178)]?.[_0x1aac9a(0x1e4)] }); } } else { if (_0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x191)] && _0x3f0302?.['entry'][0x0]?.[_0x1aac9a(0x18d)][0x0]?.['value']?.[_0x1aac9a(0x191)][0x0]?.[_0x1aac9a(0x1b3)]?.['button_reply']) saveMessage(_0x3f0302, _0x37e5fb, _0x1aac9a(0x15d), { 'type': _0x1aac9a(0x15d), 'text': { 'preview_url': !![], 'body': _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x191)][0x0]?.['interactive']?.[_0x1aac9a(0x140)]?.[_0x1aac9a(0x159)] } }), botWebhook(_0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.['value']?.[_0x1aac9a(0x191)][0x0]?.[_0x1aac9a(0x1b3)]?.[_0x1aac9a(0x140)]?.['title'] || _0x1aac9a(0x1e0), _0x37e5fb, _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.['value']?.[_0x1aac9a(0x224)][0x0]?.[_0x1aac9a(0x1a7)], _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)] ? _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.['value']?.['contacts'][0x0]?.[_0x1aac9a(0x1f0)]?.[_0x1aac9a(0x1e3)] : 'NA'); else { if (_0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x1c0)] && _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x1c0)][0x0]?.['id']) { const _0x5798ce = _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.['value']?.[_0x1aac9a(0x1c0)][0x0]?.['id'], _0x23acc0 = convertNumberToRandomString(_0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.['statuses'][0x0]?.[_0x1aac9a(0x1b2)], _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)] || 'NA'), _0x42a8ba = __dirname + '/../conversations/inbox/' + _0x37e5fb + '/' + _0x23acc0 + _0x1aac9a(0x147); updateMessageObjectInFile(_0x42a8ba, _0x5798ce, _0x1aac9a(0x13f), _0x3f0302?.['entry'][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x1c0)][0x0]?.[_0x1aac9a(0x13f)]); const _0x2eac39 = getIOInstance(), _0x40e7fb = await query('SELECT * FROM rooms WHERE uid = ?', [_0x37e5fb]); _0x2eac39['to'](_0x40e7fb[0x0]?.[_0x1aac9a(0x19e)])[_0x1aac9a(0x170)](_0x1aac9a(0x1d8), { 'chatId': _0x23acc0, 'status': _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x1c0)][0x0]?.[_0x1aac9a(0x13f)], 'msgId': _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x1c0)][0x0]?.['id'] }); const _0x51d5f1 = await query(_0x1aac9a(0x1f3), [_0x37e5fb, _0x23acc0]); if (_0x51d5f1[_0x1aac9a(0x1bd)] > 0x0) { const _0x2990bb = await query(_0x1aac9a(0x1d4), [_0x51d5f1[0x0]?.[_0x1aac9a(0x1a6)]]); _0x2eac39['to'](_0x2990bb[0x0]?.[_0x1aac9a(0x19e)])[_0x1aac9a(0x170)](_0x1aac9a(0x1d8), { 'chatId': _0x23acc0, 'status': _0x3f0302?.['entry'][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x1c0)][0x0]?.[_0x1aac9a(0x13f)], 'msgId': _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x1c0)][0x0]?.['id'] }); } _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.['value']?.[_0x1aac9a(0x1c0)][0x0]?.['status'] === 'failed' ? (console[_0x1aac9a(0x1fa)]({ 'hey': JSON[_0x1aac9a(0x1b0)](_0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.['value']?.['statuses'][0x0]?.['errors'][0x0]?.['message']) }), await query(_0x1aac9a(0x1c9), [_0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x1c0)][0x0]?.[_0x1aac9a(0x13f)], _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x1c0)][0x0]?.[_0x1aac9a(0x15a)][0x0]?.[_0x1aac9a(0x193)], _0x5798ce])) : await query(_0x1aac9a(0x1bb), [_0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.['value']?.[_0x1aac9a(0x1c0)][0x0]?.[_0x1aac9a(0x13f)], _0x5798ce]); } else _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.['value']?.[_0x1aac9a(0x191)] && _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.['changes'][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x191)][0x0]?.[_0x1aac9a(0x1b3)]?.[_0x1aac9a(0x1b4)] && (saveMessage(_0x3f0302, _0x37e5fb, _0x1aac9a(0x15d), { 'type': 'text', 'text': { 'preview_url': !![], 'body': _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.['changes'][0x0]?.['value']?.[_0x1aac9a(0x191)][0x0]?.['interactive']?.[_0x1aac9a(0x1b4)]?.['title'] } }), botWebhook(_0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.['value']?.['messages'][0x0]?.[_0x1aac9a(0x1b3)]?.[_0x1aac9a(0x1b4)]?.[_0x1aac9a(0x159)] || _0x1aac9a(0x1e0), _0x37e5fb, _0x3f0302?.['entry'][0x0]?.[_0x1aac9a(0x18d)][0x0]?.['value']?.[_0x1aac9a(0x224)][0x0]?.[_0x1aac9a(0x1a7)], _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)] ? _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x224)][0x0]?.['profile']?.['name'] : 'NA')); } } } } } } } } function updateMessageObjectInFile(_0xc09f6d, _0x4a306d, _0x2faa93, _0x204037) { const _0x1c5fcf = _0x5c9e51; fs[_0x1c5fcf(0x1cf)](_0xc09f6d, _0x1c5fcf(0x156), (_0x45819e, _0x2736e6) => { const _0x255b6d = _0x1c5fcf; if (_0x45819e) { console['error'](_0x255b6d(0x1ec), _0x45819e); return; } try { const _0x497008 = JSON[_0x255b6d(0x158)](_0x2736e6), _0x5e769c = _0x497008[_0x255b6d(0x22c)](_0x8d43d7 => _0x8d43d7[_0x255b6d(0x1f5)] === _0x4a306d); _0x5e769c ? (_0x5e769c[_0x2faa93] = _0x204037, console[_0x255b6d(0x1fa)]('Updated message with metaChatId ' + _0x4a306d + ': ' + _0x2faa93 + _0x255b6d(0x1c3) + _0x204037), fs['writeFile'](_0xc09f6d, JSON[_0x255b6d(0x1b0)](_0x497008, null, 0x2), _0x255b6d(0x156), _0x14546b => { const _0x14a8fd = _0x255b6d; if (_0x14546b) { console[_0x14a8fd(0x1ed)](_0x14a8fd(0x17e), _0x14546b); return; } console[_0x14a8fd(0x1fa)](_0x14a8fd(0x15c)); })) : console[_0x255b6d(0x1ed)](_0x255b6d(0x225) + _0x4a306d + _0x255b6d(0x18c)); } catch (_0x18bc64) { console['error'](_0x255b6d(0x1fd), _0x18bc64); } }); } async function downloadAndSaveMedia(_0x185fdb, _0x3cdae9) { const _0x2e0f35 = _0x5c9e51; try { const _0x514454 = _0x2e0f35(0x179) + _0x3cdae9 + '/', _0xf9e315 = await axios(_0x514454, { 'headers': { 'Authorization': _0x2e0f35(0x1f1) + _0x185fdb } }), _0x35ae72 = { 'method': 'get', 'url': _0xf9e315?.[_0x2e0f35(0x200)]?.[_0x2e0f35(0x1ac)], 'headers': { 'Authorization': _0x2e0f35(0x1f1) + _0x185fdb }, 'responseType': _0x2e0f35(0x143) }, _0x50e600 = await axios(_0x35ae72), _0x20db20 = _0x50e600[_0x2e0f35(0x198)]['content-type'][_0x2e0f35(0x1d0)]('/')[0x1], _0x4113e0 = randomstring[_0x2e0f35(0x1da)](), _0x5321c9 = __dirname + _0x2e0f35(0x1df) + _0x4113e0; return fs[_0x2e0f35(0x1cd)](_0x5321c9 + '.' + _0x20db20, _0x50e600[_0x2e0f35(0x200)]), _0x4113e0 + '.' + _0x20db20; } catch (_0xaa1636) { console[_0x2e0f35(0x1ed)](_0x2e0f35(0x14a), _0xaa1636); } } function getCurrentTimestampInTimeZone(_0x336ce2) { const _0x25553b = _0x5c9e51, _0x108f78 = moment['tz'](_0x336ce2), _0x5d5943 = Math['round'](_0x108f78[_0x25553b(0x1f8)]() / 0x3e8); return _0x5d5943; } function addObjectToFile(_0x47ef52, _0x339084) { const _0x4510e9 = _0x5c9e51, _0x3fd52c = path[_0x4510e9(0x211)](_0x339084); !fs[_0x4510e9(0x22e)](_0x3fd52c) && fs[_0x4510e9(0x1e2)](_0x3fd52c, { 'recursive': !![] }); if (fs[_0x4510e9(0x22e)](_0x339084)) { const _0x507ea1 = JSON[_0x4510e9(0x158)](fs['readFileSync'](_0x339084)); Array[_0x4510e9(0x1bc)](_0x507ea1) ? (_0x507ea1[_0x4510e9(0x1d6)](_0x47ef52), fs[_0x4510e9(0x1cd)](_0x339084, JSON[_0x4510e9(0x1b0)](_0x507ea1, null, 0x2))) : console[_0x4510e9(0x1ed)]('File does not contain an array.'); } else fs[_0x4510e9(0x1cd)](_0x339084, JSON[_0x4510e9(0x1b0)]([_0x47ef52], null, 0x2)); } function convertNumberToRandomString(_0x4ed49d) { const _0x384105 = _0x5c9e51, _0x338213 = { '0': 'i', '1': 'j', '2': 'I', '3': 'u', '4': 'I', '5': 'U', '6': 'S', '7': 'D', '8': 'B', '9': 'j' }, _0x241893 = _0x4ed49d[_0x384105(0x1c6)](); let _0x4b00aa = ''; for (let _0x14e66a = 0x0; _0x14e66a < _0x241893['length']; _0x14e66a++) { const _0x40b54d = _0x241893[_0x14e66a]; _0x4b00aa += _0x338213[_0x40b54d]; } return _0x4b00aa; } function saveJsonToFile(_0x890838, _0x1c553a) { const _0xc9a1be = _0x5c9e51, _0x486a9e = Date[_0xc9a1be(0x192)](), _0x4e7617 = _0x486a9e + '.json', _0x299b41 = JSON[_0xc9a1be(0x1b0)](_0x890838, null, 0x2), _0x2e5e27 = _0x1c553a; !fs[_0xc9a1be(0x22e)](_0x2e5e27) && fs[_0xc9a1be(0x1e2)](_0x2e5e27); const _0x302017 = path['join'](_0x2e5e27, _0x4e7617); fs['writeFileSync'](_0x302017, _0x299b41), console['log'](_0xc9a1be(0x1de) + _0x302017); } function isValidEmail(_0x2c006c) { const _0x144212 = _0x5c9e51, _0x17494d = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; return _0x17494d[_0x144212(0x1d7)](_0x2c006c); } function areMobileNumbersFilled(_0x378f95) { const _0x52d40e = _0x5c9e51; for (const _0x5ee953 of _0x378f95) { if (!_0x5ee953[_0x52d40e(0x20a)]) return ![]; } return !![]; } function getFileExtension(_0x43f73d) { const _0x384f12 = _0x5c9e51, _0x5b3622 = _0x43f73d[_0x384f12(0x1cb)]('.'); if (_0x5b3622 !== -0x1 && _0x5b3622 !== 0x0) { const _0x327ed0 = _0x43f73d[_0x384f12(0x16d)](_0x5b3622 + 0x1); return _0x327ed0[_0x384f12(0x215)](); } return ''; } function _0x5809(_0x3350af, _0x25c2de) { const _0x30717b = _0x3071(); return _0x5809 = function (_0x58098b, _0x407143) { _0x58098b = _0x58098b - 0x13e; let _0xc66901 = _0x30717b[_0x58098b]; return _0xc66901; }, _0x5809(_0x3350af, _0x25c2de); } function writeJsonToFile(_0x1bb30b, _0x55f43a, _0x5dc8a9) { return new Promise((_0x346c3d, _0x27b25a) => { const _0x2fa7e6 = _0x5809, _0x3967a4 = path[_0x2fa7e6(0x211)](_0x1bb30b); fs['mkdir'](_0x3967a4, { 'recursive': !![] }, function (_0x38a49c) { const _0x9f252 = _0x2fa7e6; if (_0x38a49c) { _0x5dc8a9 && _0x5dc8a9(_0x38a49c); _0x27b25a(_0x38a49c); return; } const _0x476937 = JSON['stringify'](_0x55f43a, null, 0x2); fs[_0x9f252(0x1ae)](_0x1bb30b, _0x476937, { 'flag': 'w' }, function (_0x3c185a) { if (_0x3c185a) { _0x5dc8a9 && _0x5dc8a9(_0x3c185a); _0x27b25a(_0x3c185a); return; } const _0x3d6175 = 'JSON data has been written to '' + _0x1bb30b + ''.'; _0x5dc8a9 && _0x5dc8a9(null, _0x3d6175), _0x346c3d(_0x3d6175); }); }); }); } function deleteFileIfExists(_0x125652) { const _0x56f557 = _0x5c9e51; fs['access'](_0x125652, fs[_0x56f557(0x20e)][_0x56f557(0x20c)], _0x4ebc11 => { const _0x506140 = _0x56f557; if (_0x4ebc11) { console['error'](_0x506140(0x1db) + _0x125652 + _0x506140(0x1c4)); return; } fs[_0x506140(0x17d)](_0x125652, _0x2934c6 => { const _0x45ab6b = _0x506140; if (_0x2934c6) { console[_0x45ab6b(0x1ed)]('Error deleting file ' + _0x125652 + ':', _0x2934c6); return; } console['log'](_0x45ab6b(0x1db) + _0x125652 + _0x45ab6b(0x16b)); }); }); } function readJsonFromFile(_0xf3f6e4) { const _0x353a74 = _0x5c9e51; try { const _0x2089ea = fs[_0x353a74(0x16e)](_0xf3f6e4, _0x353a74(0x156)), _0x3db8dc = JSON['parse'](_0x2089ea); return Array[_0x353a74(0x1bc)](_0x3db8dc) ? _0x3db8dc : []; } catch (_0x2524ed) { return console[_0x353a74(0x1ed)](_0x353a74(0x165) + _0xf3f6e4 + ':', _0x2524ed), []; } } function readJSONFile(_0x365e18, _0x13b65e) { const _0x84679f = _0x5c9e51; try { if (!fs[_0x84679f(0x22e)](_0x365e18)) return console[_0x84679f(0x1ed)](_0x84679f(0x164), _0x365e18), []; const _0xec9fc7 = fs['readFileSync'](_0x365e18, _0x84679f(0x156)), _0x23fbe9 = JSON[_0x84679f(0x158)](_0xec9fc7); if (!Array[_0x84679f(0x1bc)](_0x23fbe9)) return console['error']('Invalid JSON format:', _0x365e18), []; if (typeof _0x13b65e === 'number' && _0x13b65e > 0x0) return _0x23fbe9['slice'](-_0x13b65e); return _0x23fbe9; } catch (_0x2fbe83) { return console['error'](_0x84679f(0x1ce), _0x2fbe83), []; } } function updateMetaTempletInMsg(_0x1bd785, _0x40b578, _0x312e5d, _0x969023) { return new Promise(async (_0x2c9a4a, _0x20cbba) => { const _0x55baf1 = _0x5809; try { console['log']({ 'thisss': _0x1bd785 }); const _0x145b73 = await query('SELECT * FROM user WHERE uid = ?', [_0x1bd785]); if (_0x145b73['length'] < 0x1) return _0x2c9a4a({ 'success': ![], 'msg': _0x55baf1(0x1fe) }); const _0x241924 = getCurrentTimestampInTimeZone(_0x145b73[0x0]?.[_0x55baf1(0x1fc)] || Date[_0x55baf1(0x192)]() / 0x3e8), _0x5b26f8 = { ..._0x40b578, 'metaChatId': _0x969023, 'timestamp': _0x241924 }, _0x1f936b = __dirname + _0x55baf1(0x229) + _0x1bd785 + '/' + _0x312e5d + _0x55baf1(0x147); addObjectToFile(_0x5b26f8, _0x1f936b); const _0x537fab = getIOInstance(); await query('UPDATE chats SET last_message_came = ?, last_message = ?, is_opened = ? WHERE chat_id = ?', [_0x241924, JSON[_0x55baf1(0x1b0)](_0x40b578), 0x0, _0x312e5d]); const _0x3a1e5a = await query(_0x55baf1(0x1d4), [_0x1bd785]); await query('UPDATE chats SET is_opened = ? WHERE chat_id = ?', [0x1, _0x312e5d]); const _0x4910d1 = await query(_0x55baf1(0x145), [_0x1bd785]); _0x537fab['to'](_0x3a1e5a[0x0]?.['socket_id'])[_0x55baf1(0x170)](_0x55baf1(0x213), { 'chats': _0x4910d1, 'notificationOff': !![] }), _0x537fab['to'](_0x3a1e5a[0x0]?.['socket_id'])[_0x55baf1(0x170)](_0x55baf1(0x1ea), { 'msg': _0x5b26f8, 'chatId': _0x312e5d }), _0x2c9a4a(); } catch (_0x1c2568) { _0x20cbba(_0x1c2568); } }); } function sendAPIMessage(_0x43b84e, _0xd55be5, _0x1092c6) { return new Promise(async _0x4a744b => { const _0x3791a7 = _0x5809; try { const _0x4659b6 = _0x3791a7(0x175) + _0xd55be5 + _0x3791a7(0x14b), _0x390d51 = { 'messaging_product': _0x3791a7(0x16a), 'recipient_type': _0x3791a7(0x209), ..._0x43b84e }, _0x414efc = await fetch(_0x4659b6, { 'method': _0x3791a7(0x1b5), 'headers': { 'Content-Type': 'application/json', 'Authorization': _0x3791a7(0x1f1) + _0x1092c6 }, 'body': JSON['stringify'](_0x390d51) }), _0x11227f = await _0x414efc[_0x3791a7(0x1ad)](); if (_0x11227f?.[_0x3791a7(0x1ed)]) return _0x4a744b({ 'success': ![], 'message': _0x11227f?.['error']?.[_0x3791a7(0x193)] }); _0x4a744b({ 'success': !![], 'message': _0x3791a7(0x1e6), 'data': _0x11227f?.[_0x3791a7(0x191)][0x0] }); } catch (_0x2dcb7d) { _0x4a744b({ 'success': ![], 'msg': _0x2dcb7d['toString'](), 'err': _0x2dcb7d }), console[_0x3791a7(0x1fa)](_0x2dcb7d); } }); } function sendMetaMsg(_0xd5d99f, _0x156368, _0x5209c3, _0x34f9e4, _0x2ccc57) { return new Promise(async _0x2c10fe => { const _0x5e36d2 = _0x5809; try { const _0x466732 = await query(_0x5e36d2(0x161), [_0xd5d99f]), _0x26005f = await query(_0x5e36d2(0x19f), [_0xd5d99f]); if (_0x466732[_0x5e36d2(0x1bd)] < 0x1) return _0x2c10fe({ 'success': ![], 'msg': _0x5e36d2(0x203) }); const _0x5a1e36 = _0x466732[0x0]?.[_0x5e36d2(0x1b6)], _0x382387 = _0x466732[0x0]?.[_0x5e36d2(0x21c)]; if (!_0x5a1e36 || !_0x382387) return _0x2c10fe({ 'success': ![], 'msg': _0x5e36d2(0x1ef) }); const _0x2423c5 = 'https://graph.facebook.com/v17.0/' + _0x382387 + _0x5e36d2(0x14b), _0x54f163 = { 'messaging_product': _0x5e36d2(0x16a), 'recipient_type': _0x5e36d2(0x209), 'to': _0x5209c3, ..._0x156368 }, _0xa721ea = await fetch(_0x2423c5, { 'method': _0x5e36d2(0x1b5), 'headers': { 'Content-Type': _0x5e36d2(0x1e1), 'Authorization': 'Bearer ' + _0x5a1e36 }, 'body': JSON[_0x5e36d2(0x1b0)](_0x54f163) }), _0x564e89 = await _0xa721ea[_0x5e36d2(0x1ad)](); if (_0x564e89?.[_0x5e36d2(0x1ed)]) return _0x2c10fe({ 'success': ![], 'msg': _0x564e89?.[_0x5e36d2(0x1ed)]?.['message'] }); if (_0x564e89?.[_0x5e36d2(0x191)][0x0]?.['id']) { const _0x9e3e63 = getCurrentTimestampInTimeZone(_0x26005f[0x0]?.['timezone'] || Date[_0x5e36d2(0x192)]() / 0x3e8), _0xeccf97 = { ..._0x34f9e4, 'metaChatId': _0x564e89?.[_0x5e36d2(0x191)][0x0]?.['id'], 'timestamp': _0x9e3e63 }, _0x1b6f90 = __dirname + _0x5e36d2(0x229) + _0xd5d99f + '/' + _0x2ccc57 + _0x5e36d2(0x147); addObjectToFile(_0xeccf97, _0x1b6f90), await query(_0x5e36d2(0x1fb), [_0x9e3e63, JSON[_0x5e36d2(0x1b0)](_0xeccf97), 0x1, _0x2ccc57]); const _0x328bbc = getIOInstance(), _0x3fb8c2 = await query(_0x5e36d2(0x1d4), [_0xd5d99f]); await query(_0x5e36d2(0x17c), [0x1, _0x2ccc57]); const _0x49ec38 = await query(_0x5e36d2(0x145), [_0xd5d99f]); _0x328bbc['to'](_0x3fb8c2[0x0]?.[_0x5e36d2(0x19e)])[_0x5e36d2(0x170)](_0x5e36d2(0x213), { 'chats': _0x49ec38, 'notificationOff': !![] }), _0x328bbc['to'](_0x3fb8c2[0x0]?.['socket_id'])[_0x5e36d2(0x170)](_0x5e36d2(0x1ea), { 'msg': _0xeccf97, 'chatId': _0x2ccc57 }); const _0x46c52c = await query(_0x5e36d2(0x1f3), [_0xd5d99f, _0x2ccc57]); if (_0x46c52c[_0x5e36d2(0x1bd)] > 0x0) { const _0x1e8d8f = await query(_0x5e36d2(0x1d4), [_0x46c52c[0x0]?.['uid']]); _0x328bbc['to'](_0x1e8d8f[0x0]?.[_0x5e36d2(0x19e)])[_0x5e36d2(0x170)](_0x5e36d2(0x213), { 'chats': _0x49ec38 }), _0x328bbc['to'](_0x1e8d8f[0x0]?.[_0x5e36d2(0x19e)])[_0x5e36d2(0x170)](_0x5e36d2(0x1ea), { 'msg': _0xeccf97, 'chatId': _0x2ccc57 }); } } _0x2c10fe({ 'success': !![] }); } catch (_0x865047) { _0x2c10fe({ 'success': ![], 'msg': _0x865047[_0x5e36d2(0x1c6)](), 'err': _0x865047 }), console[_0x5e36d2(0x1fa)](_0x865047); } }); } function mergeArrays(_0x2f5e73, _0x3f8655) { const _0x5d7f65 = _0x5c9e51, _0x240498 = _0x3f8655[_0x5d7f65(0x14d)](_0x5255b0 => { const _0xef51c8 = _0x5d7f65, _0xb0fc06 = _0x2f5e73[_0xef51c8(0x22c)](_0x1fa8f4 => _0x1fa8f4[_0xef51c8(0x20a)] === _0x5255b0['sender_mobile']); if (_0xb0fc06) return { ..._0x5255b0, 'contact': _0xb0fc06 }; return _0x5255b0; }); return _0x240498; } async function getBusinessPhoneNumber(_0x679e32, _0x21221e, _0x569567) { const _0x38defd = _0x5c9e51, _0x217752 = _0x38defd(0x185) + _0x679e32 + '/' + _0x21221e, _0x1d97b5 = { 'method': _0x38defd(0x150), 'headers': { 'Authorization': _0x38defd(0x1f1) + _0x569567 } }; try { const _0xa97b63 = await fetch(_0x217752, _0x1d97b5), _0x2147a0 = await _0xa97b63['json'](); return _0x2147a0; } catch (_0x3f3807) { console[_0x38defd(0x1ed)](_0x38defd(0x169), _0x3f3807); throw _0x3f3807; } } async function createMetaTemplet(_0x375f22, _0x4f2e71, _0x38f2b7, _0x5ad935) { const _0x4cf8b9 = _0x5c9e51, _0x46ed54 = 'https://graph.facebook.com/' + _0x375f22 + '/' + _0x4f2e71 + '/message_templates', _0x4514f9 = { 'method': _0x4cf8b9(0x1b5), 'headers': { 'Authorization': _0x4cf8b9(0x1f1) + _0x38f2b7, 'Content-Type': 'application/json' }, 'body': JSON['stringify'](_0x5ad935) }; try { const _0x439825 = await fetch(_0x46ed54, _0x4514f9), _0x5c5282 = await _0x439825[_0x4cf8b9(0x1ad)](); return _0x5c5282; } catch (_0x1f9612) { console[_0x4cf8b9(0x1ed)](_0x4cf8b9(0x169), _0x1f9612); throw _0x1f9612; } } async function getAllTempletsMeta(_0xba48f1, _0x2ec6b2, _0x3108f9) { const _0x5f03c6 = _0x5c9e51, _0x208a48 = 'https://graph.facebook.com/' + _0xba48f1 + '/' + _0x2ec6b2 + '/message_templates', _0x2cb021 = { 'method': _0x5f03c6(0x150), 'headers': { 'Authorization': 'Bearer ' + _0x3108f9 } }; try { const _0x300d27 = await fetch(_0x208a48, _0x2cb021), _0x27596a = await _0x300d27[_0x5f03c6(0x1ad)](); return _0x27596a; } catch (_0x243536) { console[_0x5f03c6(0x1ed)]('Error fetching data:', _0x243536); throw _0x243536; } } async function delMetaTemplet(_0x14a2c1, _0x56277f, _0x3c539d, _0x139769) { const _0x505bab = _0x5c9e51, _0x50bd7e = 'https://graph.facebook.com/' + _0x14a2c1 + '/' + _0x56277f + '/message_templates?name=' + _0x139769, _0x52a079 = { 'method': 'DELETE', 'headers': { 'Authorization': 'Bearer ' + _0x3c539d } }; try { const _0x2760d1 = await fetch(_0x50bd7e, _0x52a079), _0x103282 = await _0x2760d1['json'](); return _0x103282; } catch (_0x5e7140) { console[_0x505bab(0x1ed)](_0x505bab(0x169), _0x5e7140); throw _0x5e7140; } } async function sendMetatemplet(_0x13b5ca, _0x50596d, _0x87701e, _0x125ce1, _0x4bef26) { const _0x117e90 = _0x5c9e51, _0x589acc = _0x125ce1?.[_0x117e90(0x14c)]?.['filter'](_0xd5cc77 => _0xd5cc77[_0x117e90(0x16c)] === 'BODY'), _0x5aabdb = _0x125ce1?.[_0x117e90(0x14c)]?.[_0x117e90(0x14f)](_0x3e6827 => _0x3e6827[_0x117e90(0x16c)] === _0x117e90(0x15e)), _0x266079 = _0x5aabdb[_0x117e90(0x1bd)] > 0x0 ? _0x5aabdb[0x0]?.['format'] : ''; console[_0x117e90(0x1fa)]({ 'template': JSON['stringify'](_0x125ce1) }); let _0x14cb66 = { 'name': _0x125ce1?.[_0x117e90(0x1e3)], 'language': { 'code': _0x125ce1?.[_0x117e90(0x207)] }, 'components': [] }; if (_0x589acc[_0x117e90(0x1bd)] > 0x0) { const _0xe7255f = _0x589acc[0x0]?.[_0x117e90(0x227)]?.[_0x117e90(0x22a)][0x0]?.[_0x117e90(0x14d)]((_0x5cb567, _0x579c05) => ({ 'type': _0x117e90(0x15d), 'text': _0x4bef26[_0x579c05] || _0x5cb567 })); _0xe7255f && _0x14cb66['components'][_0x117e90(0x1d6)]({ 'type': _0x117e90(0x160), 'parameters': _0xe7255f }); } if (_0x266079 === _0x117e90(0x202) && _0x5aabdb[_0x117e90(0x1bd)] > 0x0) { const _0x4d3c13 = await query(_0x117e90(0x176), [_0x125ce1?.[_0x117e90(0x1e3)]]); _0x14cb66[_0x117e90(0x14c)][_0x117e90(0x1a3)]({ 'type': _0x117e90(0x18b), 'parameters': [{ 'type': 'image', 'image': { 'link': _0x4d3c13[_0x117e90(0x1bd)] > 0x0 ? process[_0x117e90(0x167)]['FRONTENDURI'] + _0x117e90(0x1c7) + _0x4d3c13[0x0]?.[_0x117e90(0x1e9)] : _0x5aabdb[0x0][_0x117e90(0x227)]?.[_0x117e90(0x1d9)][0x0] } }] }); } if (_0x266079 === _0x117e90(0x1f2) && _0x5aabdb[_0x117e90(0x1bd)] > 0x0) { const _0x2bed3b = await query(_0x117e90(0x176), [_0x125ce1?.[_0x117e90(0x1e3)]]); _0x14cb66[_0x117e90(0x14c)]['unshift']({ 'type': 'header', 'parameters': [{ 'type': _0x117e90(0x16f), 'video': { 'link': _0x2bed3b[_0x117e90(0x1bd)] > 0x0 ? process[_0x117e90(0x167)][_0x117e90(0x21d)] + _0x117e90(0x1c7) + _0x2bed3b[0x0]?.[_0x117e90(0x1e9)] : _0x5aabdb[0x0][_0x117e90(0x227)]?.[_0x117e90(0x1d9)][0x0] } }] }); } if (_0x266079 === 'DOCUMENT' && _0x5aabdb[_0x117e90(0x1bd)] > 0x0) { const _0x5088cb = await query(_0x117e90(0x176), [_0x125ce1?.[_0x117e90(0x1e3)]]); _0x14cb66['components']['unshift']({ 'type': 'header', 'parameters': [{ 'type': _0x117e90(0x1d3), 'document': { 'link': _0x5088cb['length'] > 0x0 ? process[_0x117e90(0x167)][_0x117e90(0x21d)] + _0x117e90(0x1c7) + _0x5088cb[0x0]?.['file_name'] : _0x5aabdb[0x0]['example']?.[_0x117e90(0x1d9)][0x0], 'filename': _0x117e90(0x1d3) } }] }); } const _0x4f35b2 = _0x117e90(0x153) + _0x50596d + '/messages', _0xa3b808 = { 'messaging_product': _0x117e90(0x16a), 'to': _0x13b5ca, 'type': _0x117e90(0x1aa), 'template': _0x14cb66 }, _0x8029aa = { 'method': _0x117e90(0x1b5), 'headers': { 'Authorization': _0x117e90(0x1f1) + _0x87701e, 'Content-Type': _0x117e90(0x1e1) }, 'body': JSON[_0x117e90(0x1b0)](_0xa3b808) }; try { const _0xc103eb = await fetch(_0x4f35b2, _0x8029aa), _0x37e559 = await _0xc103eb[_0x117e90(0x1ad)](); return console[_0x117e90(0x1fa)]({ 'data': JSON[_0x117e90(0x1b0)](_0x37e559) }), console['log']({ 'body': JSON['stringify'](_0xa3b808) }), _0x37e559; } catch (_0x2ae898) { console['error']('Error sending message:', _0x2ae898); throw _0x2ae898; } } function getFileInfo(_0xf663d1) { return new Promise((_0x33cc2e, _0x565ad9) => { const _0x1450e2 = _0x5809; fs[_0x1450e2(0x155)](_0xf663d1, (_0x5de940, _0x38360b) => { const _0x8f1c72 = _0x1450e2; if (_0x5de940) _0x565ad9(_0x5de940); else { const _0x27080d = _0x38360b[_0x8f1c72(0x196)], _0x357a63 = mime[_0x8f1c72(0x13e)](_0xf663d1) || _0x8f1c72(0x218); _0x33cc2e({ 'fileSizeInBytes': _0x27080d, 'mimeType': _0x357a63 }); } }); }); } async function getSessionUploadMediaMeta(_0x29988e, _0x31f9cf, _0xff4791, _0xb05f89, _0x165591) { const _0x2db4df = _0x5c9e51, _0x102bfb = 'https://graph.facebook.com/' + _0x29988e + '/' + _0x31f9cf + _0x2db4df(0x181) + _0xb05f89 + '&file_type=' + _0x165591, _0x20aa86 = { 'method': _0x2db4df(0x1b5), 'headers': { 'Authorization': 'Bearer ' + _0xff4791 } }; try { const _0x32da5e = await fetch(_0x102bfb, _0x20aa86), _0x2e8013 = await _0x32da5e[_0x2db4df(0x1ad)](); return _0x2e8013; } catch (_0x50e71c) { console['error']('Error fetching data:', _0x50e71c); throw _0x50e71c; } } async function uploadFileMeta(_0x4c21fc, _0x45e3c2, _0xafeed4, _0xd9b223) { return new Promise(async _0x2768b0 => { const _0x3a87d3 = _0x5809; try { const _0x2d9b3a = fs[_0x3a87d3(0x16e)](_0x45e3c2), _0x44c02a = _0x3a87d3(0x185) + _0xafeed4 + '/' + _0x4c21fc, _0x1ea4e9 = { 'method': _0x3a87d3(0x1b5), 'headers': { 'Authorization': _0x3a87d3(0x1ca) + _0xd9b223, 'Content-Type': _0x3a87d3(0x171), 'Cookie': _0x3a87d3(0x1e7) }, 'body': _0x2d9b3a }, _0x40da94 = await fetch(_0x44c02a, _0x1ea4e9); if (!_0x40da94['ok']) { const _0x5d3880 = await _0x40da94[_0x3a87d3(0x1ad)](); return console[_0x3a87d3(0x1ed)](_0x3a87d3(0x214), _0x5d3880), _0x2768b0({ 'success': ![], 'data': _0x5d3880 }); } const _0x420ea3 = await _0x40da94[_0x3a87d3(0x1ad)](); return _0x2768b0({ 'success': !![], 'data': _0x420ea3 }); } catch (_0x975a13) { return _0x2768b0({ 'success': ![], 'data': _0x975a13 }); } }); } async function getMetaNumberDetail(_0x78bba3, _0x1c5b66, _0x20ffcd) { const _0x4815cc = _0x5c9e51, _0x5d1c2b = 'https://graph.facebook.com/' + _0x78bba3 + '/' + _0x1c5b66, _0x12bb92 = { 'method': _0x4815cc(0x150), 'headers': { 'Authorization': _0x4815cc(0x1f1) + _0x20ffcd, 'Content-Type': 'application/json' } }; try { const _0x2b1896 = await fetch(_0x5d1c2b, _0x12bb92), _0x5ad00d = await _0x2b1896[_0x4815cc(0x1ad)](); return _0x5ad00d; } catch (_0x53825d) { console['error'](_0x4815cc(0x169), _0x53825d); throw _0x53825d; } } function addDaysToCurrentTimestamp(_0x103be9) { const _0x44915e = _0x5c9e51; let _0x5bd35a = Date[_0x44915e(0x192)](), _0x396a9c = _0x103be9 * 0x18 * 0x3c * 0x3c * 0x3e8, _0x3501d5 = _0x5bd35a + _0x396a9c; return _0x3501d5; } async function updateUserPlan(_0x2daf44, _0x4a8762) { const _0x440ee4 = _0x5c9e51; console[_0x440ee4(0x1fa)]({ 'plan': _0x2daf44 }); const _0x2d5c8f = parseInt(_0x2daf44?.[_0x440ee4(0x1c8)] || 0x0), _0x234c3e = addDaysToCurrentTimestamp(_0x2d5c8f); await query(_0x440ee4(0x1eb), [JSON[_0x440ee4(0x1b0)](_0x2daf44), _0x234c3e, _0x4a8762]); } function validateEmail(_0x3eb82f) { const _0x4035eb = _0x5c9e51, _0x30d533 = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; return _0x30d533[_0x4035eb(0x1d7)](String(_0x3eb82f)[_0x4035eb(0x215)]()); } function sendEmail(_0x255887, _0x38695a, _0x317f95, _0x183284, _0x368434, _0x4ca703, _0x32bcec, _0x413c03) { return new Promise(async _0x5c9730 => { const _0xd4cdca = _0x5809; try { let _0x1d4a9d = nodemailer[_0xd4cdca(0x18f)]({ 'host': _0x255887, 'port': _0x38695a, 'secure': _0x38695a === _0xd4cdca(0x166) ? !![] : ![], 'auth': { 'user': _0x317f95, 'pass': _0x183284 } }), _0x14036b = await _0x1d4a9d[_0xd4cdca(0x18e)]({ 'from': (_0x32bcec || _0xd4cdca(0x204)) + ' <' + _0x317f95 + '>', 'to': _0x413c03, 'subject': _0x4ca703 || 'Email', 'html': _0x368434 }); _0x5c9730({ 'success': !![], 'info': _0x14036b }); } catch (_0x516844) { _0x5c9730({ 'success': ![], 'err': _0x516844['toString']() || _0xd4cdca(0x1af) }); } }); } function getUserSignupsByMonth(_0x1412d0) { const _0x511baa = _0x5c9e51, _0x46aca2 = [_0x511baa(0x162), 'Feb', 'Mar', _0x511baa(0x1f9), 'May', 'Jun', 'Jul', 'Aug', _0x511baa(0x228), _0x511baa(0x1bf), _0x511baa(0x183), _0x511baa(0x1cc)], _0x29b39e = new Date(), _0x329070 = _0x29b39e[_0x511baa(0x1ba)](), { paidUsers: _0x1b59ce, unpaidUsers: _0x40ef52 } = _0x1412d0['reduce']((_0x478310, _0x3d99a4) => { const _0x490df0 = _0x511baa, _0x3a463e = _0x3d99a4[_0x490df0(0x219)] ? new Date(parseInt(_0x3d99a4[_0x490df0(0x219)])) : null, _0x33ac54 = _0x3a463e ? _0x3a463e > _0x29b39e : ![]; return _0x33ac54 ? _0x478310['paidUsers']['push'](_0x3d99a4) : _0x478310['unpaidUsers'][_0x490df0(0x1d6)](_0x3d99a4), _0x478310; }, { 'paidUsers': [], 'unpaidUsers': [] }), _0x278ed0 = _0x46aca2[_0x511baa(0x14d)]((_0x2eba10, _0x4ad70e) => { const _0x1c43eb = _0x511baa, _0x3ba1e1 = _0x1b59ce[_0x1c43eb(0x14f)](_0x4f1a11 => { const _0x59c524 = _0x1c43eb, _0x520209 = new Date(_0x4f1a11[_0x59c524(0x195)]); return _0x520209[_0x59c524(0x1e8)]() === _0x4ad70e && _0x520209[_0x59c524(0x1ba)]() === _0x329070; }), _0x2c28da = _0x3ba1e1[_0x1c43eb(0x1bd)], _0x7b49d8 = _0x3ba1e1[_0x1c43eb(0x14d)](_0x56b53f => _0x56b53f[_0x1c43eb(0x190)]); return { 'month': _0x2eba10, 'numberOfSignups': _0x2c28da, 'userEmails': _0x7b49d8, 'paid': !![] }; }), _0x3d6493 = _0x46aca2[_0x511baa(0x14d)]((_0x26fdec, _0x36d54b) => { const _0x22e419 = _0x511baa, _0x50cfb2 = _0x40ef52[_0x22e419(0x14f)](_0x2e304b => { const _0x5e1477 = _0x22e419, _0x5f0df1 = new Date(_0x2e304b['createdAt']); return _0x5f0df1[_0x5e1477(0x1e8)]() === _0x36d54b && _0x5f0df1[_0x5e1477(0x1ba)]() === _0x329070; }), _0x10ac3b = _0x50cfb2['length'], _0x3c2aa4 = _0x50cfb2[_0x22e419(0x14d)](_0x38402c => _0x38402c[_0x22e419(0x190)]); return { 'month': _0x26fdec, 'numberOfSignups': _0x10ac3b, 'userEmails': _0x3c2aa4, 'paid': ![] }; }); return { 'paidSignupsByMonth': _0x278ed0, 'unpaidSignupsByMonth': _0x3d6493 }; } function getUserOrderssByMonth(_0xc64225) { const _0x3b0349 = _0x5c9e51, _0x2f7833 = [_0x3b0349(0x162), _0x3b0349(0x20f), _0x3b0349(0x1f6), _0x3b0349(0x1f9), _0x3b0349(0x1a4), _0x3b0349(0x172), _0x3b0349(0x21a), _0x3b0349(0x217), _0x3b0349(0x228), _0x3b0349(0x1bf), _0x3b0349(0x183), _0x3b0349(0x1cc)], _0x2f9212 = new Date(), _0x1c073d = _0x2f9212[_0x3b0349(0x1ba)](), _0x533639 = Array[_0x3b0349(0x174)]({ 'length': 0xc }, (_0x20de19, _0x27656e) => { const _0x181a8a = _0x3b0349, _0x1f0900 = _0x2f7833[_0x27656e], _0x13976a = _0xc64225[_0x181a8a(0x14f)](_0x547a33 => { const _0x3d59fd = _0x181a8a, _0xa95d01 = new Date(_0x547a33[_0x3d59fd(0x195)]); return _0xa95d01['getMonth']() === _0x27656e && _0xa95d01[_0x3d59fd(0x1ba)]() === _0x1c073d; }), _0x551ce8 = _0x13976a[_0x181a8a(0x1bd)]; return { 'month': _0x1f0900, 'numberOfOders': _0x551ce8 }; }); return _0x533639; } function getNumberOfDaysFromTimestamp(_0x38a918) { const _0x28a251 = _0x5c9e51; if (!_0x38a918 || isNaN(_0x38a918)) return _0x28a251(0x206); const _0x1030b0 = Date[_0x28a251(0x192)](); if (_0x38a918 <= _0x1030b0) return '0 days'; const _0x3c312f = 0x3e8 * 0x3c * 0x3c * 0x18, _0x2d9671 = Math[_0x28a251(0x146)]((_0x38a918 - _0x1030b0) / _0x3c312f); return _0x2d9671 + _0x28a251(0x21f); } async function getUserPlayDays(_0x51e8c3) { const _0x387a64 = _0x5c9e51, _0x3a2a52 = await query(_0x387a64(0x19f), [_0x51e8c3]); if (_0x3a2a52[_0x387a64(0x1bd)] < 0x1) return 0x0; if (!_0x3a2a52[0x0][_0x387a64(0x219)]) return 0x0; else { const _0x4b6d01 = getNumberOfDaysFromTimestamp(_0x3a2a52[0x0]?.[_0x387a64(0x219)]); return _0x4b6d01; } } function folderExists(_0x2ea79a) { const _0x1ee742 = _0x5c9e51; try { return fs[_0x1ee742(0x197)](_0x2ea79a, fs[_0x1ee742(0x20e)][_0x1ee742(0x20c)]), !![]; } catch (_0x5d4952) { return ![]; } } async function downloadAndExtractFile(_0x1879bb, _0x506fbf) { const _0x4bc45e = _0x5c9e51; try { const _0x27dc60 = _0x1879bb[_0x4bc45e(0x141)]; if (!_0x27dc60) return { 'success': ![], 'msg': _0x4bc45e(0x1b9) }; const _0x51084a = path[_0x4bc45e(0x1ee)](_0x506fbf, _0x27dc60[_0x4bc45e(0x1e3)]); return await new Promise((_0x2b4147, _0xc69bdd) => { _0x27dc60['mv'](_0x51084a, _0xa0e896 => { _0xa0e896 ? _0xc69bdd(_0xa0e896) : _0x2b4147(); }); }), await fs[_0x4bc45e(0x14e)](_0x51084a)[_0x4bc45e(0x19a)](unzipper['Extract']({ 'path': _0x506fbf }))[_0x4bc45e(0x1d2)](), fs[_0x4bc45e(0x1ff)](_0x51084a), { 'success': !![], 'msg': 'App was successfully installed/updated' }; } catch (_0x1e8e0d) { return console[_0x4bc45e(0x1ed)](_0x4bc45e(0x20d), _0x1e8e0d), { 'success': ![], 'msg': _0x1e8e0d[_0x4bc45e(0x193)] }; } } function fetchProfileFun(_0x2829a9, _0x534823) { return new Promise(async (_0x18b7c0, _0x3c2c8a) => { const _0x1e444d = _0x5809; try { const _0x8a4e46 = await fetch('https://graph.facebook.com/v17.0/' + _0x2829a9, { 'method': _0x1e444d(0x150), 'headers': { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + _0x534823 } }), _0x1fd614 = await _0x8a4e46['json'](); return _0x1fd614[_0x1e444d(0x1ed)] ? _0x18b7c0({ 'success': ![], 'msg': _0x1fd614[_0x1e444d(0x1ed)]?.['message'] }) : _0x18b7c0({ 'success': !![], 'data': _0x1fd614 }); } catch (_0x208988) { console[_0x1e444d(0x1fa)]({ 'error': _0x208988 }), _0x3c2c8a(_0x208988); } }); } function returnWidget(_0x19352c, _0xcbb4bd, _0x11c21d, _0x1c46f2) { const _0x339e74 = _0x5c9e51; let _0x1bd661 = ''; switch (_0x1c46f2) { case 'TOP_RIGHT': _0x1bd661 = 'position: fixed; top: 15px; right: 15px;'; break; case _0x339e74(0x226): _0x1bd661 = _0x339e74(0x182); break; case 'TOP_LEFT': _0x1bd661 = _0x339e74(0x19d); break; case _0x339e74(0x187): _0x1bd661 = _0x339e74(0x157); break; case _0x339e74(0x180): _0x1bd661 = _0x339e74(0x210); break; case _0x339e74(0x19c): _0x1bd661 = 'position: fixed; bottom: 15px; left: 15px;'; break; case _0x339e74(0x188): _0x1bd661 = _0x339e74(0x168); break; default: _0x1bd661 = _0x339e74(0x148); break; }return _0x339e74(0x216) + _0x19352c + _0x339e74(0x173) + _0x1bd661 + ' width: ' + _0xcbb4bd + _0x339e74(0x22b) + _0x11c21d + _0x339e74(0x1be) + _0x11c21d + _0x339e74(0x222); } function generateWhatsAppURL(_0x1b4b57, _0x53b97f) { const _0x55b2f0 = _0x5c9e51, _0x5546d6 = _0x55b2f0(0x154), _0x263e7b = _0x1b4b57['replace'](/\D/g, ''), _0x23b7e9 = encodeURIComponent(_0x53b97f); return '' + _0x5546d6 + _0x263e7b + _0x55b2f0(0x1a0) + _0x23b7e9; } module['exports'] = { 'isValidEmail': isValidEmail, 'downloadAndExtractFile': downloadAndExtractFile, 'folderExists': folderExists, 'sendAPIMessage': sendAPIMessage, 'sendEmail': sendEmail, 'getUserPlayDays': getUserPlayDays, 'getNumberOfDaysFromTimestamp': getNumberOfDaysFromTimestamp, 'getUserOrderssByMonth': getUserOrderssByMonth, 'getUserSignupsByMonth': getUserSignupsByMonth, 'validateEmail': validateEmail, 'updateUserPlan': updateUserPlan, 'getFileInfo': getFileInfo, 'uploadFileMeta': uploadFileMeta, 'getMetaNumberDetail': getMetaNumberDetail, 'getSessionUploadMediaMeta': getSessionUploadMediaMeta, 'sendMetaMsg': sendMetaMsg, 'updateMetaTempletInMsg': updateMetaTempletInMsg, 'sendMetatemplet': sendMetatemplet, 'delMetaTemplet': delMetaTemplet, 'getAllTempletsMeta': getAllTempletsMeta, 'createMetaTemplet': createMetaTemplet, 'getBusinessPhoneNumber': getBusinessPhoneNumber, 'botWebhook': botWebhook, 'mergeArrays': mergeArrays, 'readJSONFile': readJSONFile, 'writeJsonToFile': writeJsonToFile, 'getCurrentTimestampInTimeZone': getCurrentTimestampInTimeZone, 'saveWebhookConversation': saveWebhookConversation, 'saveJsonToFile': saveJsonToFile, 'readJsonFromFile': readJsonFromFile, 'deleteFileIfExists': deleteFileIfExists, 'areMobileNumbersFilled': areMobileNumbersFilled, 'getFileExtension': getFileExtension, 'executeQueries': executeQueries, 'fetchProfileFun': fetchProfileFun, 'returnWidget': returnWidget, 'generateWhatsAppURL': generateWhatsAppURL }; ?> 
 

Did this file decode correctly?

Original Code



<?  const _0x5c9e51 = _0x5809; (function (_0xbe66f7, _0x22a994) { const _0x4b5dc9 = _0x5809, _0x61ecbd = _0xbe66f7(); while (!![]) { try { const _0x3117e5 = parseInt(_0x4b5dc9(0x1b8)) / 0x1 * (-parseInt(_0x4b5dc9(0x1a8)) / 0x2) + parseInt(_0x4b5dc9(0x152)) / 0x3 * (parseInt(_0x4b5dc9(0x22d)) / 0x4) + parseInt(_0x4b5dc9(0x1dd)) / 0x5 + -parseInt(_0x4b5dc9(0x17a)) / 0x6 + -parseInt(_0x4b5dc9(0x149)) / 0x7 * (-parseInt(_0x4b5dc9(0x1a1)) / 0x8) + -parseInt(_0x4b5dc9(0x1a9)) / 0x9 + -parseInt(_0x4b5dc9(0x221)) / 0xa * (parseInt(_0x4b5dc9(0x1e5)) / 0xb); if (_0x3117e5 === _0x22a994) break; else _0x61ecbd['push'](_0x61ecbd['shift']()); } catch (_0x18eea7) { _0x61ecbd['push'](_0x61ecbd['shift']()); } } }(_0x3071, 0x58056)); const fs = require('fs'), path = require('path'), moment = require(_0x5c9e51(0x177)), { query } = require(_0x5c9e51(0x1b1)), { default: axios } = require(_0x5c9e51(0x1dc)), randomstring = require('randomstring'), { getIOInstance } = require(_0x5c9e51(0x223)), fetch = require('node-fetch'), mime = require(_0x5c9e51(0x20b)), nodemailer = require(_0x5c9e51(0x1c1)), unzipper = require(_0x5c9e51(0x151)); async function executeQueries(_0x357b79, _0x10f5e9) { const _0x229960 = _0x5c9e51; try { for (const _0x4d128f of _0x357b79) { await _0x10f5e9['query'](_0x4d128f); } } catch (_0x4f352d) { console[_0x229960(0x1ed)]('Error executing queries:', _0x4f352d); throw _0x4f352d; } } function findTargetNodes(_0x51b2de, _0x3498f8, _0xffcc04) { const _0x3b1a7e = _0x5c9e51, _0x385a70 = _0x3498f8[_0x3b1a7e(0x14f)](_0x5c6161 => _0x5c6161[_0x3b1a7e(0x205)]?.[_0x3b1a7e(0x215)]() == _0xffcc04?.['toLowerCase']()), _0x47d413 = _0x385a70[_0x3b1a7e(0x14d)](_0x2ac975 => _0x2ac975['target']), _0x3a930d = _0x51b2de[_0x3b1a7e(0x14f)](_0x3276af => _0x47d413[_0x3b1a7e(0x19b)](_0x3276af['id'])); return _0x3a930d; } function getReply(_0x29511d, _0x8462ac, _0x24062d) { const _0x98a09f = _0x5c9e51, _0x49ce09 = findTargetNodes(_0x29511d, _0x8462ac, _0x24062d); if (_0x49ce09['length'] > 0x0) return _0x49ce09; else { const _0x2363a1 = findTargetNodes(_0x29511d, _0x8462ac, _0x98a09f(0x212)); return _0x2363a1; } } async function runChatbot(_0x4884dd, _0x32f4f7, _0x574074, _0x1d5649, _0xfabef9) { const _0x49304f = _0x5c9e51, _0x375e8d = _0x4884dd, _0x3c5cd2 = _0x4884dd?.[_0x49304f(0x142)] > 0x0 ? !![] : ![]; if (!_0x3c5cd2) { const _0x48f30b = JSON[_0x49304f(0x158)](_0x375e8d?.[_0x49304f(0x1d5)]), _0x2a4a04 = convertNumberToRandomString(_0x1d5649 || ''), _0x3d3714 = JSON[_0x49304f(0x158)](_0x4884dd?.[_0x49304f(0x1d1)]); if (_0x48f30b[_0x49304f(0x19b)](_0x1d5649)) { const _0x857b40 = __dirname + '/../flow-json/nodes/' + _0x574074 + '/' + _0x3d3714?.[_0x49304f(0x1f4)] + _0x49304f(0x147), _0x33cd38 = __dirname + _0x49304f(0x201) + _0x574074 + '/' + _0x3d3714?.['flow_id'] + _0x49304f(0x147), _0x96245f = readJsonFromFile(_0x857b40), _0x342d53 = readJsonFromFile(_0x33cd38); if (_0x96245f['length'] > 0x0 && _0x342d53[_0x49304f(0x1bd)] > 0x0) { const _0x23d24a = getReply(_0x96245f, _0x342d53, _0x32f4f7); if (_0x23d24a[_0x49304f(0x1bd)] > 0x0) for (const _0x2e776f of _0x23d24a) { const _0x54f2ed = { 'type': _0x2e776f?.[_0x49304f(0x144)]?.[_0x49304f(0x1c5)]?.[_0x49304f(0x215)](), 'metaChatId': '', 'msgContext': _0x2e776f?.['msgContent'], 'reaction': '', 'timestamp': '', 'senderName': _0xfabef9, 'senderMobile': _0x1d5649, 'status': _0x49304f(0x18a), 'star': ![], 'route': _0x49304f(0x17b) }; await sendMetaMsg(_0x574074, _0x2e776f?.[_0x49304f(0x186)], _0x1d5649, _0x54f2ed, _0x2a4a04); } } } } else { const _0x4d9206 = convertNumberToRandomString(_0x1d5649 || ''), _0x388aef = JSON[_0x49304f(0x158)](_0x4884dd?.[_0x49304f(0x1d1)]), _0x537898 = __dirname + _0x49304f(0x220) + _0x574074 + '/' + _0x388aef?.[_0x49304f(0x1f4)] + _0x49304f(0x147), _0x39e005 = __dirname + _0x49304f(0x201) + _0x574074 + '/' + _0x388aef?.[_0x49304f(0x1f4)] + _0x49304f(0x147), _0x1b14b9 = readJsonFromFile(_0x537898), _0x322487 = readJsonFromFile(_0x39e005); if (_0x1b14b9[_0x49304f(0x1bd)] > 0x0 && _0x322487[_0x49304f(0x1bd)] > 0x0) { const _0x55866b = getReply(_0x1b14b9, _0x322487, _0x32f4f7); if (_0x55866b[_0x49304f(0x1bd)] > 0x0) for (const _0x54af90 of _0x55866b) { const _0x34c1a4 = { 'type': _0x54af90?.[_0x49304f(0x144)]?.[_0x49304f(0x1c5)]?.[_0x49304f(0x215)](), 'metaChatId': '', 'msgContext': _0x54af90?.[_0x49304f(0x186)], 'reaction': '', 'timestamp': '', 'senderName': _0xfabef9, 'senderMobile': _0x1d5649, 'status': _0x49304f(0x18a), 'star': ![], 'route': _0x49304f(0x17b) }; await sendMetaMsg(_0x574074, _0x54af90?.[_0x49304f(0x186)], _0x1d5649, _0x34c1a4, _0x4d9206); } } } } async function botWebhook(_0x2c1e05, _0x24ab80, _0x233368, _0x12775d) { const _0x53f7a8 = _0x5c9e51, _0x44fd7a = await query(_0x53f7a8(0x19f), [_0x24ab80]); if (_0x44fd7a[0x0]?.['plan']) { const _0x422a01 = JSON['parse'](_0x44fd7a[0x0]?.['plan']); if (_0x422a01[_0x53f7a8(0x163)] > 0x0) { const _0x1affad = await query('SELECT * FROM chatbot WHERE uid = ? AND active = ?', [_0x24ab80, 0x1]); _0x1affad[_0x53f7a8(0x1bd)] > 0x0 && await Promise[_0x53f7a8(0x21b)](_0x1affad[_0x53f7a8(0x14d)](_0x4a25d5 => runChatbot(_0x4a25d5, _0x2c1e05, _0x24ab80, _0x233368, _0x12775d))); } else await query(_0x53f7a8(0x208), [0x0, _0x24ab80]); } } async function saveMessage(_0x3e9f76, _0x137c23, _0x191353, _0x58ebd6) { const _0xb69aff = _0x5c9e51; try { console['log'](_0xb69aff(0x17f)); const _0x1e6b6d = await query(_0xb69aff(0x19f), [_0x137c23]), _0x447733 = getCurrentTimestampInTimeZone(_0x1e6b6d[0x0]?.[_0xb69aff(0x1fc)] || Date['now']() / 0x3e8), _0x2604d3 = convertNumberToRandomString(_0x3e9f76?.[_0xb69aff(0x1b7)][0x0]?.['changes'][0x0]?.[_0xb69aff(0x189)]?.[_0xb69aff(0x224)][0x0]?.[_0xb69aff(0x1a7)], _0x3e9f76?.[_0xb69aff(0x1b7)][0x0]?.[_0xb69aff(0x18d)] ? _0x3e9f76?.[_0xb69aff(0x1b7)][0x0]?.[_0xb69aff(0x18d)][0x0]?.[_0xb69aff(0x189)]?.[_0xb69aff(0x224)][0x0]?.[_0xb69aff(0x1f0)]?.[_0xb69aff(0x1e3)] : 'NA'), _0x494672 = { 'type': _0x191353, 'metaChatId': _0x3e9f76?.[_0xb69aff(0x1b7)][0x0]?.[_0xb69aff(0x18d)][0x0]?.[_0xb69aff(0x189)]?.['messages'][0x0]?.['id'], 'msgContext': _0x58ebd6, 'reaction': '', 'timestamp': _0x447733, 'senderName': _0x3e9f76?.[_0xb69aff(0x1b7)][0x0]?.[_0xb69aff(0x18d)] ? _0x3e9f76?.[_0xb69aff(0x1b7)][0x0]?.['changes'][0x0]?.[_0xb69aff(0x189)]?.[_0xb69aff(0x224)][0x0]?.[_0xb69aff(0x1f0)]?.[_0xb69aff(0x1e3)] : 'NA', 'senderMobile': _0x3e9f76?.[_0xb69aff(0x1b7)][0x0]?.[_0xb69aff(0x18d)] ? _0x3e9f76?.[_0xb69aff(0x1b7)][0x0]?.['changes'][0x0]?.['value']?.[_0xb69aff(0x224)][0x0]?.['wa_id'] : 'NA', 'status': '', 'star': ![], 'route': _0xb69aff(0x184), 'context': _0x3e9f76?.[_0xb69aff(0x1b7)][0x0]?.[_0xb69aff(0x18d)][0x0]?.['value']?.[_0xb69aff(0x191)][0x0] ? _0x3e9f76?.['entry'][0x0]?.[_0xb69aff(0x18d)][0x0]?.['value']?.[_0xb69aff(0x191)][0x0]?.['context'] : '' }, _0x340ce6 = await query(_0xb69aff(0x1a2), [_0x2604d3, _0x137c23]); _0x340ce6[_0xb69aff(0x1bd)] < 0x1 ? await query(_0xb69aff(0x1a5), [_0x2604d3, _0x137c23, _0x447733, _0x3e9f76?.[_0xb69aff(0x1b7)][0x0]?.[_0xb69aff(0x18d)] ? _0x3e9f76?.[_0xb69aff(0x1b7)][0x0]?.['changes'][0x0]?.['value']?.[_0xb69aff(0x224)][0x0]?.['profile']?.[_0xb69aff(0x1e3)] : 'NA', _0x3e9f76?.[_0xb69aff(0x1b7)][0x0]?.[_0xb69aff(0x18d)] ? _0x3e9f76?.[_0xb69aff(0x1b7)][0x0]?.['changes'][0x0]?.[_0xb69aff(0x189)]?.[_0xb69aff(0x224)][0x0]?.[_0xb69aff(0x1a7)] : 'NA', JSON[_0xb69aff(0x1b0)](_0x494672), 0x0]) : await query(_0xb69aff(0x1c2), [_0x447733, JSON['stringify'](_0x494672), 0x0, _0x2604d3, _0x137c23]); const _0x162766 = __dirname + '/../conversations/inbox/' + _0x137c23 + '/' + _0x2604d3 + '.json'; addObjectToFile(_0x494672, _0x162766); const _0x38679e = getIOInstance(), _0x52cb0e = await query(_0xb69aff(0x1d4), [_0x137c23]), _0x58c2bf = await query(_0xb69aff(0x145), [_0x137c23]); _0x38679e['to'](_0x52cb0e[0x0]?.[_0xb69aff(0x19e)])[_0xb69aff(0x170)](_0xb69aff(0x213), { 'chats': _0x58c2bf }), _0x38679e['to'](_0x52cb0e[0x0]?.['socket_id'])[_0xb69aff(0x170)](_0xb69aff(0x1ea), { 'msg': _0x494672, 'chatId': _0x2604d3 }); const _0x49f709 = await query(_0xb69aff(0x1f3), [_0x137c23, _0x2604d3]); if (_0x49f709['length'] > 0x0) { const _0x55f963 = await query('SELECT * FROM rooms WHERE uid = ?', [_0x49f709[0x0]?.['uid']]); _0x38679e['to'](_0x55f963[0x0]?.[_0xb69aff(0x19e)])[_0xb69aff(0x170)]('update_conversations', { 'chats': _0x58c2bf }), _0x38679e['to'](_0x55f963[0x0]?.['socket_id'])[_0xb69aff(0x170)]('push_new_msg', { 'msg': _0x494672, 'chatId': _0x2604d3 }); } } catch (_0xe2f4fb) { console[_0xb69aff(0x1fa)](_0xb69aff(0x15b), _0xe2f4fb); } } function _0x3071() { const _0x4bf0d9 = ['value', 'sent', 'header', ' not found', 'changes', 'sendMail', 'createTransport', 'email', 'messages', 'now', 'message', 'caption', 'createdAt', 'size', 'accessSync', 'headers', 'emoji', 'pipe', 'includes', 'BOTTOM_LEFT', 'position: fixed; top: 15px; left: 15px;', 'socket_id', 'SELECT * FROM user WHERE uid = ?', '?text=', '33688zMYpWH', 'SELECT * FROM chats WHERE chat_id = ? AND uid = ?', 'unshift', 'May', 'INSERT INTO chats (chat_id, uid, last_message_came, sender_name, sender_mobile, last_message, is_opened) VALUES (
            ?,?,?,?,?,?,?
        )', 'uid', 'wa_id', '26gbzEwr', '256725KuGbos', 'template', 'image', 'url', 'json', 'writeFile', 'Invalid Email', 'stringify', '../database/dbpromise', 'recipient_id', 'interactive', 'list_reply', 'POST', 'access_token', 'entry', '48801eiSbGH', 'No file data found in FormData', 'getFullYear', 'UPDATE broadcast_log SET delivery_status = ? WHERE meta_msg_id = ?', 'isArray', 'length', ' with the desired URL
          window.location.href = '', 'Oct', 'statuses', 'nodemailer', 'UPDATE chats SET last_message_came = ?, last_message = ?, is_opened = ? WHERE chat_id = ? AND uid = ?', ' set to ', ' does not exist.', 'dialogType', 'toString', '/media/', 'plan_duration_in_days', 'UPDATE broadcast_log SET delivery_status = ?, err = ? WHERE meta_msg_id = ?', 'OAuth ', 'lastIndexOf', 'Dec', 'writeFileSync', 'Error reading JSON file:', 'readFile', 'split', 'flow', 'promise', 'document', 'SELECT * FROM rooms WHERE uid = ?', 'chats', 'push', 'test', 'update_delivery_status', 'header_handle', 'generate', 'File ', 'axios', '998845MbPJLR', 'JSON data saved to ', '/../client/public/meta-media/', 'aU1uLzohPGMncyrwlPIb', 'application/json', 'mkdirSync', 'name', 'message_id', '1609333cHjmPy', 'Message sent successfully!', 'ps_l=0; ps_n=0', 'getMonth', 'file_name', 'push_new_msg', 'UPDATE user SET plan = ?, plan_expire = ? WHERE uid = ?', 'Error reading file:', 'error', 'join', 'Please add your meta token and phone number ID', 'profile', 'Bearer ', 'VIDEO', 'SELECT * FROM agent_chats WHERE owner_uid = ? AND chat_id = ?', 'flow_id', 'metaChatId', 'Mar', 'audio', 'valueOf', 'Apr', 'log', 'UPDATE chats SET last_message_came = ?, last_message = ?, is_opened = ? WHERE chat_id = ?', 'timezone', 'Error parsing JSON:', 'user not found', 'unlinkSync', 'data', '/../flow-json/edges/', 'IMAGE', 'Unable to to find API ', 'Email From', 'sourceHandle', '0 days', 'language', 'UPDATE chatbot SET active = ? WHERE uid = ?', 'individual', 'mobile', 'mime-types', 'F_OK', 'Error downloading and extracting file:', 'constants', 'Feb', 'position: fixed; bottom: 15px; right: 50%; transform: translateX(-50%);', 'dirname', '{{OTHER_MSG}}', 'update_conversations', 'Error response:', 'toLowerCase', '
      <img src="', 'Aug', 'application/octet-stream', 'plan_expire', 'Jul', 'all', 'business_phone_number_id', 'FRONTENDURI', 'push_new_reaction', ' days', '/../flow-json/nodes/', '10GAlXIj', '';
        });
  
        // Close widget when close button is clicked
        const closeBtn = document.getElementById('close-btn');
        closeBtn.addEventListener('click', function (event) {
          event.stopPropagation(); // Prevents the click event from propagating to the widget image
          widgetContainer.style.display = 'none';
        });
      </script>
    ', '../socket', 'contacts', 'Message with metaChatId ', 'TOP_CENTER', 'example', 'Sep', '/../conversations/inbox/', 'body_text', 'px; height: auto; cursor: pointer; z-index: 9999;">
  
      <!-- Widget content -->
      <div class="widget-container" id="widget-container"
        style="position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background-color: #fff; border: 1px solid #ccc; border-radius: 5px; padding: 10px; box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.1); display: none; z-index: 9999;">
        <span class="close-btn" id="close-btn"
          style="position: absolute; top: 5px; right: 5px; cursor: pointer;">&times;</span>
      </div>
  
      <script>
        // Get references to the image and widget container
        const widgetImage = document.getElementById('widget-image');
        const widgetContainer = document.getElementById('widget-container');
  
        // Redirect to a URL when the image is clicked
        widgetImage.addEventListener('click', function () {
          // Replace '', 'find', '4nESPQt', 'existsSync', 'lookup', 'status', 'button_reply', 'file', 'for_all', 'arraybuffer', 'state', 'SELECT * FROM chats WHERE uid = ?', 'ceil', '.json', 'position: fixed; top: 15px; right: 15px;', '875qDADBd', 'Error downloading media:', '/messages', 'components', 'map', 'createReadStream', 'filter', 'GET', 'unzipper', '2090196CXKcyj', 'https://graph.facebook.com/v18.0/', 'https://wa.me/', 'stat', 'utf8', 'position: fixed; bottom: 15px; right: 15px;', 'parse', 'title', 'errors', 'error in saveMessage in function ', 'File updated successfully', 'text', 'HEADER', '/meta-media/', 'body', 'SELECT * FROM meta_api WHERE uid = ?', 'Jan', 'allow_chatbot', 'File not found:', 'Error reading JSON file ', '465', 'env', 'position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);', 'Error fetching data:', 'whatsapp', ' has been deleted.', 'type', 'substring', 'readFileSync', 'video', 'emit', 'application/pdf', 'Jun', '" alt="Widget" id="widget-image"
        style="', 'from', 'https://graph.facebook.com/v17.0/', 'SELECT * FROM meta_templet_media WHERE templet_name = ?', 'moment-timezone', 'reaction', 'https://graph.facebook.com/v19.0/', '1518606nZJKxx', 'OUTGOING', 'UPDATE chats SET is_opened = ? WHERE chat_id = ?', 'unlink', 'Error writing file:', 'CAME HERE', 'BOTTOM_CENTER', '/uploads?file_length=', 'position: fixed; top: 15px; right: 50%; transform: translateX(-50%);', 'Nov', 'INCOMING', 'https://graph.facebook.com/', 'msgContent', 'BOTTOM_RIGHT', 'ALL_CENTER']; _0x3071 = function () { return _0x4bf0d9; }; return _0x3071(); } async function saveWebhookConversation(_0x3f0302, _0x37e5fb) { const _0x1aac9a = _0x5c9e51; if (_0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.['messages'] && _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x191)][0x0]?.[_0x1aac9a(0x16c)] === _0x1aac9a(0x15d)) saveMessage(_0x3f0302, _0x37e5fb, _0x1aac9a(0x15d), { 'type': 'text', 'text': { 'preview_url': !![], 'body': _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.['changes'][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x191)][0x0]?.['text']?.['body'] } }), botWebhook(_0x3f0302?.['entry'][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x191)][0x0]?.[_0x1aac9a(0x15d)]?.['body'], _0x37e5fb, _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.['contacts'][0x0]?.[_0x1aac9a(0x1a7)], _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)] ? _0x3f0302?.['entry'][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x224)][0x0]?.['profile']?.[_0x1aac9a(0x1e3)] : 'NA'); else { if (_0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.['value']?.[_0x1aac9a(0x191)] && _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.['messages'][0x0]?.[_0x1aac9a(0x1ab)]) { const _0x5eef2e = await query(_0x1aac9a(0x19f), [_0x37e5fb]), _0x3beae2 = await query(_0x1aac9a(0x161), [_0x37e5fb]), _0x2e0ddb = _0x3beae2[0x0]?.[_0x1aac9a(0x1b6)]; if (_0x2e0ddb) { console[_0x1aac9a(0x1fa)]({ 'metaToken': _0x2e0ddb }); const _0x313f92 = await downloadAndSaveMedia(_0x2e0ddb, _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.['value']?.[_0x1aac9a(0x191)][0x0]?.[_0x1aac9a(0x1ab)]?.['id']); console[_0x1aac9a(0x1fa)]({ 'fileName': _0x313f92 }), saveMessage(_0x3f0302, _0x37e5fb, 'image', { 'type': 'image', 'image': { 'link': process['env'][_0x1aac9a(0x21d)] + '/meta-media/' + _0x313f92, 'caption': _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x191)][0x0]?.[_0x1aac9a(0x1ab)]?.[_0x1aac9a(0x194)] || '' } }); } botWebhook(_0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.['changes'][0x0]?.[_0x1aac9a(0x189)]?.['messages'][0x0]?.[_0x1aac9a(0x1ab)]?.[_0x1aac9a(0x194)] || _0x1aac9a(0x1e0), _0x37e5fb, _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.['value']?.['contacts'][0x0]?.[_0x1aac9a(0x1a7)], _0x3f0302?.['entry'][0x0]?.['changes'] ? _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.['contacts'][0x0]?.[_0x1aac9a(0x1f0)]?.[_0x1aac9a(0x1e3)] : 'NA'); } else { if (_0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x191)] && _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x191)][0x0]?.[_0x1aac9a(0x16f)]) { const _0x10261d = await query(_0x1aac9a(0x19f), [_0x37e5fb]), _0x3e86c3 = await query(_0x1aac9a(0x161), [_0x37e5fb]), _0x1939d9 = _0x3e86c3[0x0]?.[_0x1aac9a(0x1b6)]; if (_0x1939d9) { const _0x2acda4 = await downloadAndSaveMedia(_0x1939d9, _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.['messages'][0x0]?.[_0x1aac9a(0x16f)]?.['id']); saveMessage(_0x3f0302, _0x37e5fb, 'video', { 'type': _0x1aac9a(0x16f), 'video': { 'link': process[_0x1aac9a(0x167)][_0x1aac9a(0x21d)] + _0x1aac9a(0x15f) + _0x2acda4, 'caption': _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.['messages'][0x0]?.['video']?.['caption'] } }); } botWebhook(_0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.['messages'][0x0]?.['video']?.[_0x1aac9a(0x194)] || 'aU1uLzohPGMncyrwlPIb', _0x37e5fb, _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.['contacts'][0x0]?.[_0x1aac9a(0x1a7)], _0x3f0302?.['entry'][0x0]?.['changes'] ? _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.['contacts'][0x0]?.['profile']?.[_0x1aac9a(0x1e3)] : 'NA'); } else { if (_0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x191)] && _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x191)][0x0]?.[_0x1aac9a(0x1d3)]) { const _0x416d51 = await query(_0x1aac9a(0x19f), [_0x37e5fb]), _0x1585a4 = await query(_0x1aac9a(0x161), [_0x37e5fb]), _0x2aae3c = _0x1585a4[0x0]?.[_0x1aac9a(0x1b6)]; if (_0x2aae3c) { const _0x2d27fc = await downloadAndSaveMedia(_0x2aae3c, _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.['value']?.[_0x1aac9a(0x191)][0x0]?.[_0x1aac9a(0x1d3)]?.['id']); saveMessage(_0x3f0302, _0x37e5fb, 'document', { 'type': 'document', 'document': { 'link': process[_0x1aac9a(0x167)][_0x1aac9a(0x21d)] + _0x1aac9a(0x15f) + _0x2d27fc, 'caption': _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.['changes'][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x191)][0x0]?.[_0x1aac9a(0x1d3)]?.[_0x1aac9a(0x194)] } }); } botWebhook(_0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.['value']?.['messages'][0x0]?.[_0x1aac9a(0x1d3)]?.[_0x1aac9a(0x194)] || 'aU1uLzohPGMncyrwlPIb', _0x37e5fb, _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x224)][0x0]?.[_0x1aac9a(0x1a7)], _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)] ? _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x224)][0x0]?.['profile']?.['name'] : 'NA'); } else { if (_0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.['messages'] && _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.['messages'][0x0]?.['audio']) { const _0x5b1ed1 = await query('SELECT * FROM user WHERE uid = ?', [_0x37e5fb]), _0xb60ad4 = await query(_0x1aac9a(0x161), [_0x37e5fb]), _0x288ea0 = _0xb60ad4[0x0]?.[_0x1aac9a(0x1b6)]; if (_0x288ea0) { const _0x3eb293 = await downloadAndSaveMedia(_0x288ea0, _0x3f0302?.['entry'][0x0]?.['changes'][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x191)][0x0]?.[_0x1aac9a(0x1f7)]?.['id']); saveMessage(_0x3f0302, _0x37e5fb, _0x1aac9a(0x1f7), { 'type': _0x1aac9a(0x1f7), 'audio': { 'link': process[_0x1aac9a(0x167)][_0x1aac9a(0x21d)] + '/meta-media/' + _0x3eb293 } }); } botWebhook(_0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.['messages'][0x0]?.[_0x1aac9a(0x1d3)]?.[_0x1aac9a(0x194)] || _0x1aac9a(0x1e0), _0x37e5fb, _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.['changes'][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x224)][0x0]?.['wa_id'], _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)] ? _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.['contacts'][0x0]?.[_0x1aac9a(0x1f0)]?.[_0x1aac9a(0x1e3)] : 'NA'); } else { if (_0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.['value']?.[_0x1aac9a(0x191)] && _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x191)][0x0]?.['reaction']) { const _0x1bd4c3 = convertNumberToRandomString(_0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.['contacts'][0x0]?.[_0x1aac9a(0x1a7)], _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)] ? _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.['value']?.['contacts'][0x0]?.[_0x1aac9a(0x1f0)]?.['name'] : 'NA'), _0x25c467 = __dirname + _0x1aac9a(0x229) + _0x37e5fb + '/' + _0x1bd4c3 + '.json'; updateMessageObjectInFile(_0x25c467, _0x3f0302?.['entry'][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x191)][0x0]?.[_0x1aac9a(0x178)]?.[_0x1aac9a(0x1e4)], _0x1aac9a(0x178), _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.['changes'][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x191)][0x0]?.['reaction']?.[_0x1aac9a(0x199)]); const _0x159fe3 = getIOInstance(), _0x387d2c = await query('SELECT * FROM rooms WHERE uid = ?', [_0x37e5fb]); _0x159fe3['to'](_0x387d2c[0x0]?.[_0x1aac9a(0x19e)])[_0x1aac9a(0x170)](_0x1aac9a(0x21e), { 'reaction': _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.['messages'][0x0]?.[_0x1aac9a(0x178)]?.[_0x1aac9a(0x199)], 'chatId': _0x1bd4c3, 'msgId': _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.['messages'][0x0]?.[_0x1aac9a(0x178)]?.[_0x1aac9a(0x1e4)] }); const _0x245f25 = await query(_0x1aac9a(0x1f3), [_0x37e5fb, _0x1bd4c3]); if (_0x245f25[_0x1aac9a(0x1bd)] > 0x0) { const _0x11b435 = await query(_0x1aac9a(0x1d4), [_0x245f25[0x0]?.['uid']]); _0x159fe3['to'](_0x11b435[0x0]?.['socket_id'])[_0x1aac9a(0x170)](_0x1aac9a(0x21e), { 'reaction': _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.['messages'][0x0]?.[_0x1aac9a(0x178)]?.[_0x1aac9a(0x199)], 'chatId': _0x1bd4c3, 'msgId': _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x191)][0x0]?.[_0x1aac9a(0x178)]?.[_0x1aac9a(0x1e4)] }); } } else { if (_0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x191)] && _0x3f0302?.['entry'][0x0]?.[_0x1aac9a(0x18d)][0x0]?.['value']?.[_0x1aac9a(0x191)][0x0]?.[_0x1aac9a(0x1b3)]?.['button_reply']) saveMessage(_0x3f0302, _0x37e5fb, _0x1aac9a(0x15d), { 'type': _0x1aac9a(0x15d), 'text': { 'preview_url': !![], 'body': _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x191)][0x0]?.['interactive']?.[_0x1aac9a(0x140)]?.[_0x1aac9a(0x159)] } }), botWebhook(_0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.['value']?.[_0x1aac9a(0x191)][0x0]?.[_0x1aac9a(0x1b3)]?.[_0x1aac9a(0x140)]?.['title'] || _0x1aac9a(0x1e0), _0x37e5fb, _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.['value']?.[_0x1aac9a(0x224)][0x0]?.[_0x1aac9a(0x1a7)], _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)] ? _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.['value']?.['contacts'][0x0]?.[_0x1aac9a(0x1f0)]?.[_0x1aac9a(0x1e3)] : 'NA'); else { if (_0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x1c0)] && _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x1c0)][0x0]?.['id']) { const _0x5798ce = _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.['value']?.[_0x1aac9a(0x1c0)][0x0]?.['id'], _0x23acc0 = convertNumberToRandomString(_0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.['statuses'][0x0]?.[_0x1aac9a(0x1b2)], _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)] || 'NA'), _0x42a8ba = __dirname + '/../conversations/inbox/' + _0x37e5fb + '/' + _0x23acc0 + _0x1aac9a(0x147); updateMessageObjectInFile(_0x42a8ba, _0x5798ce, _0x1aac9a(0x13f), _0x3f0302?.['entry'][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x1c0)][0x0]?.[_0x1aac9a(0x13f)]); const _0x2eac39 = getIOInstance(), _0x40e7fb = await query('SELECT * FROM rooms WHERE uid = ?', [_0x37e5fb]); _0x2eac39['to'](_0x40e7fb[0x0]?.[_0x1aac9a(0x19e)])[_0x1aac9a(0x170)](_0x1aac9a(0x1d8), { 'chatId': _0x23acc0, 'status': _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x1c0)][0x0]?.[_0x1aac9a(0x13f)], 'msgId': _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x1c0)][0x0]?.['id'] }); const _0x51d5f1 = await query(_0x1aac9a(0x1f3), [_0x37e5fb, _0x23acc0]); if (_0x51d5f1[_0x1aac9a(0x1bd)] > 0x0) { const _0x2990bb = await query(_0x1aac9a(0x1d4), [_0x51d5f1[0x0]?.[_0x1aac9a(0x1a6)]]); _0x2eac39['to'](_0x2990bb[0x0]?.[_0x1aac9a(0x19e)])[_0x1aac9a(0x170)](_0x1aac9a(0x1d8), { 'chatId': _0x23acc0, 'status': _0x3f0302?.['entry'][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x1c0)][0x0]?.[_0x1aac9a(0x13f)], 'msgId': _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x1c0)][0x0]?.['id'] }); } _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.['value']?.[_0x1aac9a(0x1c0)][0x0]?.['status'] === 'failed' ? (console[_0x1aac9a(0x1fa)]({ 'hey': JSON[_0x1aac9a(0x1b0)](_0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.['value']?.['statuses'][0x0]?.['errors'][0x0]?.['message']) }), await query(_0x1aac9a(0x1c9), [_0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x1c0)][0x0]?.[_0x1aac9a(0x13f)], _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x1c0)][0x0]?.[_0x1aac9a(0x15a)][0x0]?.[_0x1aac9a(0x193)], _0x5798ce])) : await query(_0x1aac9a(0x1bb), [_0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.['value']?.[_0x1aac9a(0x1c0)][0x0]?.[_0x1aac9a(0x13f)], _0x5798ce]); } else _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.['value']?.[_0x1aac9a(0x191)] && _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.['changes'][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x191)][0x0]?.[_0x1aac9a(0x1b3)]?.[_0x1aac9a(0x1b4)] && (saveMessage(_0x3f0302, _0x37e5fb, _0x1aac9a(0x15d), { 'type': 'text', 'text': { 'preview_url': !![], 'body': _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.['changes'][0x0]?.['value']?.[_0x1aac9a(0x191)][0x0]?.['interactive']?.[_0x1aac9a(0x1b4)]?.['title'] } }), botWebhook(_0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.['value']?.['messages'][0x0]?.[_0x1aac9a(0x1b3)]?.[_0x1aac9a(0x1b4)]?.[_0x1aac9a(0x159)] || _0x1aac9a(0x1e0), _0x37e5fb, _0x3f0302?.['entry'][0x0]?.[_0x1aac9a(0x18d)][0x0]?.['value']?.[_0x1aac9a(0x224)][0x0]?.[_0x1aac9a(0x1a7)], _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)] ? _0x3f0302?.[_0x1aac9a(0x1b7)][0x0]?.[_0x1aac9a(0x18d)][0x0]?.[_0x1aac9a(0x189)]?.[_0x1aac9a(0x224)][0x0]?.['profile']?.['name'] : 'NA')); } } } } } } } } function updateMessageObjectInFile(_0xc09f6d, _0x4a306d, _0x2faa93, _0x204037) { const _0x1c5fcf = _0x5c9e51; fs[_0x1c5fcf(0x1cf)](_0xc09f6d, _0x1c5fcf(0x156), (_0x45819e, _0x2736e6) => { const _0x255b6d = _0x1c5fcf; if (_0x45819e) { console['error'](_0x255b6d(0x1ec), _0x45819e); return; } try { const _0x497008 = JSON[_0x255b6d(0x158)](_0x2736e6), _0x5e769c = _0x497008[_0x255b6d(0x22c)](_0x8d43d7 => _0x8d43d7[_0x255b6d(0x1f5)] === _0x4a306d); _0x5e769c ? (_0x5e769c[_0x2faa93] = _0x204037, console[_0x255b6d(0x1fa)]('Updated message with metaChatId ' + _0x4a306d + ': ' + _0x2faa93 + _0x255b6d(0x1c3) + _0x204037), fs['writeFile'](_0xc09f6d, JSON[_0x255b6d(0x1b0)](_0x497008, null, 0x2), _0x255b6d(0x156), _0x14546b => { const _0x14a8fd = _0x255b6d; if (_0x14546b) { console[_0x14a8fd(0x1ed)](_0x14a8fd(0x17e), _0x14546b); return; } console[_0x14a8fd(0x1fa)](_0x14a8fd(0x15c)); })) : console[_0x255b6d(0x1ed)](_0x255b6d(0x225) + _0x4a306d + _0x255b6d(0x18c)); } catch (_0x18bc64) { console['error'](_0x255b6d(0x1fd), _0x18bc64); } }); } async function downloadAndSaveMedia(_0x185fdb, _0x3cdae9) { const _0x2e0f35 = _0x5c9e51; try { const _0x514454 = _0x2e0f35(0x179) + _0x3cdae9 + '/', _0xf9e315 = await axios(_0x514454, { 'headers': { 'Authorization': _0x2e0f35(0x1f1) + _0x185fdb } }), _0x35ae72 = { 'method': 'get', 'url': _0xf9e315?.[_0x2e0f35(0x200)]?.[_0x2e0f35(0x1ac)], 'headers': { 'Authorization': _0x2e0f35(0x1f1) + _0x185fdb }, 'responseType': _0x2e0f35(0x143) }, _0x50e600 = await axios(_0x35ae72), _0x20db20 = _0x50e600[_0x2e0f35(0x198)]['content-type'][_0x2e0f35(0x1d0)]('/')[0x1], _0x4113e0 = randomstring[_0x2e0f35(0x1da)](), _0x5321c9 = __dirname + _0x2e0f35(0x1df) + _0x4113e0; return fs[_0x2e0f35(0x1cd)](_0x5321c9 + '.' + _0x20db20, _0x50e600[_0x2e0f35(0x200)]), _0x4113e0 + '.' + _0x20db20; } catch (_0xaa1636) { console[_0x2e0f35(0x1ed)](_0x2e0f35(0x14a), _0xaa1636); } } function getCurrentTimestampInTimeZone(_0x336ce2) { const _0x25553b = _0x5c9e51, _0x108f78 = moment['tz'](_0x336ce2), _0x5d5943 = Math['round'](_0x108f78[_0x25553b(0x1f8)]() / 0x3e8); return _0x5d5943; } function addObjectToFile(_0x47ef52, _0x339084) { const _0x4510e9 = _0x5c9e51, _0x3fd52c = path[_0x4510e9(0x211)](_0x339084); !fs[_0x4510e9(0x22e)](_0x3fd52c) && fs[_0x4510e9(0x1e2)](_0x3fd52c, { 'recursive': !![] }); if (fs[_0x4510e9(0x22e)](_0x339084)) { const _0x507ea1 = JSON[_0x4510e9(0x158)](fs['readFileSync'](_0x339084)); Array[_0x4510e9(0x1bc)](_0x507ea1) ? (_0x507ea1[_0x4510e9(0x1d6)](_0x47ef52), fs[_0x4510e9(0x1cd)](_0x339084, JSON[_0x4510e9(0x1b0)](_0x507ea1, null, 0x2))) : console[_0x4510e9(0x1ed)]('File does not contain an array.'); } else fs[_0x4510e9(0x1cd)](_0x339084, JSON[_0x4510e9(0x1b0)]([_0x47ef52], null, 0x2)); } function convertNumberToRandomString(_0x4ed49d) { const _0x384105 = _0x5c9e51, _0x338213 = { '0': 'i', '1': 'j', '2': 'I', '3': 'u', '4': 'I', '5': 'U', '6': 'S', '7': 'D', '8': 'B', '9': 'j' }, _0x241893 = _0x4ed49d[_0x384105(0x1c6)](); let _0x4b00aa = ''; for (let _0x14e66a = 0x0; _0x14e66a < _0x241893['length']; _0x14e66a++) { const _0x40b54d = _0x241893[_0x14e66a]; _0x4b00aa += _0x338213[_0x40b54d]; } return _0x4b00aa; } function saveJsonToFile(_0x890838, _0x1c553a) { const _0xc9a1be = _0x5c9e51, _0x486a9e = Date[_0xc9a1be(0x192)](), _0x4e7617 = _0x486a9e + '.json', _0x299b41 = JSON[_0xc9a1be(0x1b0)](_0x890838, null, 0x2), _0x2e5e27 = _0x1c553a; !fs[_0xc9a1be(0x22e)](_0x2e5e27) && fs[_0xc9a1be(0x1e2)](_0x2e5e27); const _0x302017 = path['join'](_0x2e5e27, _0x4e7617); fs['writeFileSync'](_0x302017, _0x299b41), console['log'](_0xc9a1be(0x1de) + _0x302017); } function isValidEmail(_0x2c006c) { const _0x144212 = _0x5c9e51, _0x17494d = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; return _0x17494d[_0x144212(0x1d7)](_0x2c006c); } function areMobileNumbersFilled(_0x378f95) { const _0x52d40e = _0x5c9e51; for (const _0x5ee953 of _0x378f95) { if (!_0x5ee953[_0x52d40e(0x20a)]) return ![]; } return !![]; } function getFileExtension(_0x43f73d) { const _0x384f12 = _0x5c9e51, _0x5b3622 = _0x43f73d[_0x384f12(0x1cb)]('.'); if (_0x5b3622 !== -0x1 && _0x5b3622 !== 0x0) { const _0x327ed0 = _0x43f73d[_0x384f12(0x16d)](_0x5b3622 + 0x1); return _0x327ed0[_0x384f12(0x215)](); } return ''; } function _0x5809(_0x3350af, _0x25c2de) { const _0x30717b = _0x3071(); return _0x5809 = function (_0x58098b, _0x407143) { _0x58098b = _0x58098b - 0x13e; let _0xc66901 = _0x30717b[_0x58098b]; return _0xc66901; }, _0x5809(_0x3350af, _0x25c2de); } function writeJsonToFile(_0x1bb30b, _0x55f43a, _0x5dc8a9) { return new Promise((_0x346c3d, _0x27b25a) => { const _0x2fa7e6 = _0x5809, _0x3967a4 = path[_0x2fa7e6(0x211)](_0x1bb30b); fs['mkdir'](_0x3967a4, { 'recursive': !![] }, function (_0x38a49c) { const _0x9f252 = _0x2fa7e6; if (_0x38a49c) { _0x5dc8a9 && _0x5dc8a9(_0x38a49c); _0x27b25a(_0x38a49c); return; } const _0x476937 = JSON['stringify'](_0x55f43a, null, 0x2); fs[_0x9f252(0x1ae)](_0x1bb30b, _0x476937, { 'flag': 'w' }, function (_0x3c185a) { if (_0x3c185a) { _0x5dc8a9 && _0x5dc8a9(_0x3c185a); _0x27b25a(_0x3c185a); return; } const _0x3d6175 = 'JSON data has been written to '' + _0x1bb30b + ''.'; _0x5dc8a9 && _0x5dc8a9(null, _0x3d6175), _0x346c3d(_0x3d6175); }); }); }); } function deleteFileIfExists(_0x125652) { const _0x56f557 = _0x5c9e51; fs['access'](_0x125652, fs[_0x56f557(0x20e)][_0x56f557(0x20c)], _0x4ebc11 => { const _0x506140 = _0x56f557; if (_0x4ebc11) { console['error'](_0x506140(0x1db) + _0x125652 + _0x506140(0x1c4)); return; } fs[_0x506140(0x17d)](_0x125652, _0x2934c6 => { const _0x45ab6b = _0x506140; if (_0x2934c6) { console[_0x45ab6b(0x1ed)]('Error deleting file ' + _0x125652 + ':', _0x2934c6); return; } console['log'](_0x45ab6b(0x1db) + _0x125652 + _0x45ab6b(0x16b)); }); }); } function readJsonFromFile(_0xf3f6e4) { const _0x353a74 = _0x5c9e51; try { const _0x2089ea = fs[_0x353a74(0x16e)](_0xf3f6e4, _0x353a74(0x156)), _0x3db8dc = JSON['parse'](_0x2089ea); return Array[_0x353a74(0x1bc)](_0x3db8dc) ? _0x3db8dc : []; } catch (_0x2524ed) { return console[_0x353a74(0x1ed)](_0x353a74(0x165) + _0xf3f6e4 + ':', _0x2524ed), []; } } function readJSONFile(_0x365e18, _0x13b65e) { const _0x84679f = _0x5c9e51; try { if (!fs[_0x84679f(0x22e)](_0x365e18)) return console[_0x84679f(0x1ed)](_0x84679f(0x164), _0x365e18), []; const _0xec9fc7 = fs['readFileSync'](_0x365e18, _0x84679f(0x156)), _0x23fbe9 = JSON[_0x84679f(0x158)](_0xec9fc7); if (!Array[_0x84679f(0x1bc)](_0x23fbe9)) return console['error']('Invalid JSON format:', _0x365e18), []; if (typeof _0x13b65e === 'number' && _0x13b65e > 0x0) return _0x23fbe9['slice'](-_0x13b65e); return _0x23fbe9; } catch (_0x2fbe83) { return console['error'](_0x84679f(0x1ce), _0x2fbe83), []; } } function updateMetaTempletInMsg(_0x1bd785, _0x40b578, _0x312e5d, _0x969023) { return new Promise(async (_0x2c9a4a, _0x20cbba) => { const _0x55baf1 = _0x5809; try { console['log']({ 'thisss': _0x1bd785 }); const _0x145b73 = await query('SELECT * FROM user WHERE uid = ?', [_0x1bd785]); if (_0x145b73['length'] < 0x1) return _0x2c9a4a({ 'success': ![], 'msg': _0x55baf1(0x1fe) }); const _0x241924 = getCurrentTimestampInTimeZone(_0x145b73[0x0]?.[_0x55baf1(0x1fc)] || Date[_0x55baf1(0x192)]() / 0x3e8), _0x5b26f8 = { ..._0x40b578, 'metaChatId': _0x969023, 'timestamp': _0x241924 }, _0x1f936b = __dirname + _0x55baf1(0x229) + _0x1bd785 + '/' + _0x312e5d + _0x55baf1(0x147); addObjectToFile(_0x5b26f8, _0x1f936b); const _0x537fab = getIOInstance(); await query('UPDATE chats SET last_message_came = ?, last_message = ?, is_opened = ? WHERE chat_id = ?', [_0x241924, JSON[_0x55baf1(0x1b0)](_0x40b578), 0x0, _0x312e5d]); const _0x3a1e5a = await query(_0x55baf1(0x1d4), [_0x1bd785]); await query('UPDATE chats SET is_opened = ? WHERE chat_id = ?', [0x1, _0x312e5d]); const _0x4910d1 = await query(_0x55baf1(0x145), [_0x1bd785]); _0x537fab['to'](_0x3a1e5a[0x0]?.['socket_id'])[_0x55baf1(0x170)](_0x55baf1(0x213), { 'chats': _0x4910d1, 'notificationOff': !![] }), _0x537fab['to'](_0x3a1e5a[0x0]?.['socket_id'])[_0x55baf1(0x170)](_0x55baf1(0x1ea), { 'msg': _0x5b26f8, 'chatId': _0x312e5d }), _0x2c9a4a(); } catch (_0x1c2568) { _0x20cbba(_0x1c2568); } }); } function sendAPIMessage(_0x43b84e, _0xd55be5, _0x1092c6) { return new Promise(async _0x4a744b => { const _0x3791a7 = _0x5809; try { const _0x4659b6 = _0x3791a7(0x175) + _0xd55be5 + _0x3791a7(0x14b), _0x390d51 = { 'messaging_product': _0x3791a7(0x16a), 'recipient_type': _0x3791a7(0x209), ..._0x43b84e }, _0x414efc = await fetch(_0x4659b6, { 'method': _0x3791a7(0x1b5), 'headers': { 'Content-Type': 'application/json', 'Authorization': _0x3791a7(0x1f1) + _0x1092c6 }, 'body': JSON['stringify'](_0x390d51) }), _0x11227f = await _0x414efc[_0x3791a7(0x1ad)](); if (_0x11227f?.[_0x3791a7(0x1ed)]) return _0x4a744b({ 'success': ![], 'message': _0x11227f?.['error']?.[_0x3791a7(0x193)] }); _0x4a744b({ 'success': !![], 'message': _0x3791a7(0x1e6), 'data': _0x11227f?.[_0x3791a7(0x191)][0x0] }); } catch (_0x2dcb7d) { _0x4a744b({ 'success': ![], 'msg': _0x2dcb7d['toString'](), 'err': _0x2dcb7d }), console[_0x3791a7(0x1fa)](_0x2dcb7d); } }); } function sendMetaMsg(_0xd5d99f, _0x156368, _0x5209c3, _0x34f9e4, _0x2ccc57) { return new Promise(async _0x2c10fe => { const _0x5e36d2 = _0x5809; try { const _0x466732 = await query(_0x5e36d2(0x161), [_0xd5d99f]), _0x26005f = await query(_0x5e36d2(0x19f), [_0xd5d99f]); if (_0x466732[_0x5e36d2(0x1bd)] < 0x1) return _0x2c10fe({ 'success': ![], 'msg': _0x5e36d2(0x203) }); const _0x5a1e36 = _0x466732[0x0]?.[_0x5e36d2(0x1b6)], _0x382387 = _0x466732[0x0]?.[_0x5e36d2(0x21c)]; if (!_0x5a1e36 || !_0x382387) return _0x2c10fe({ 'success': ![], 'msg': _0x5e36d2(0x1ef) }); const _0x2423c5 = 'https://graph.facebook.com/v17.0/' + _0x382387 + _0x5e36d2(0x14b), _0x54f163 = { 'messaging_product': _0x5e36d2(0x16a), 'recipient_type': _0x5e36d2(0x209), 'to': _0x5209c3, ..._0x156368 }, _0xa721ea = await fetch(_0x2423c5, { 'method': _0x5e36d2(0x1b5), 'headers': { 'Content-Type': _0x5e36d2(0x1e1), 'Authorization': 'Bearer ' + _0x5a1e36 }, 'body': JSON[_0x5e36d2(0x1b0)](_0x54f163) }), _0x564e89 = await _0xa721ea[_0x5e36d2(0x1ad)](); if (_0x564e89?.[_0x5e36d2(0x1ed)]) return _0x2c10fe({ 'success': ![], 'msg': _0x564e89?.[_0x5e36d2(0x1ed)]?.['message'] }); if (_0x564e89?.[_0x5e36d2(0x191)][0x0]?.['id']) { const _0x9e3e63 = getCurrentTimestampInTimeZone(_0x26005f[0x0]?.['timezone'] || Date[_0x5e36d2(0x192)]() / 0x3e8), _0xeccf97 = { ..._0x34f9e4, 'metaChatId': _0x564e89?.[_0x5e36d2(0x191)][0x0]?.['id'], 'timestamp': _0x9e3e63 }, _0x1b6f90 = __dirname + _0x5e36d2(0x229) + _0xd5d99f + '/' + _0x2ccc57 + _0x5e36d2(0x147); addObjectToFile(_0xeccf97, _0x1b6f90), await query(_0x5e36d2(0x1fb), [_0x9e3e63, JSON[_0x5e36d2(0x1b0)](_0xeccf97), 0x1, _0x2ccc57]); const _0x328bbc = getIOInstance(), _0x3fb8c2 = await query(_0x5e36d2(0x1d4), [_0xd5d99f]); await query(_0x5e36d2(0x17c), [0x1, _0x2ccc57]); const _0x49ec38 = await query(_0x5e36d2(0x145), [_0xd5d99f]); _0x328bbc['to'](_0x3fb8c2[0x0]?.[_0x5e36d2(0x19e)])[_0x5e36d2(0x170)](_0x5e36d2(0x213), { 'chats': _0x49ec38, 'notificationOff': !![] }), _0x328bbc['to'](_0x3fb8c2[0x0]?.['socket_id'])[_0x5e36d2(0x170)](_0x5e36d2(0x1ea), { 'msg': _0xeccf97, 'chatId': _0x2ccc57 }); const _0x46c52c = await query(_0x5e36d2(0x1f3), [_0xd5d99f, _0x2ccc57]); if (_0x46c52c[_0x5e36d2(0x1bd)] > 0x0) { const _0x1e8d8f = await query(_0x5e36d2(0x1d4), [_0x46c52c[0x0]?.['uid']]); _0x328bbc['to'](_0x1e8d8f[0x0]?.[_0x5e36d2(0x19e)])[_0x5e36d2(0x170)](_0x5e36d2(0x213), { 'chats': _0x49ec38 }), _0x328bbc['to'](_0x1e8d8f[0x0]?.[_0x5e36d2(0x19e)])[_0x5e36d2(0x170)](_0x5e36d2(0x1ea), { 'msg': _0xeccf97, 'chatId': _0x2ccc57 }); } } _0x2c10fe({ 'success': !![] }); } catch (_0x865047) { _0x2c10fe({ 'success': ![], 'msg': _0x865047[_0x5e36d2(0x1c6)](), 'err': _0x865047 }), console[_0x5e36d2(0x1fa)](_0x865047); } }); } function mergeArrays(_0x2f5e73, _0x3f8655) { const _0x5d7f65 = _0x5c9e51, _0x240498 = _0x3f8655[_0x5d7f65(0x14d)](_0x5255b0 => { const _0xef51c8 = _0x5d7f65, _0xb0fc06 = _0x2f5e73[_0xef51c8(0x22c)](_0x1fa8f4 => _0x1fa8f4[_0xef51c8(0x20a)] === _0x5255b0['sender_mobile']); if (_0xb0fc06) return { ..._0x5255b0, 'contact': _0xb0fc06 }; return _0x5255b0; }); return _0x240498; } async function getBusinessPhoneNumber(_0x679e32, _0x21221e, _0x569567) { const _0x38defd = _0x5c9e51, _0x217752 = _0x38defd(0x185) + _0x679e32 + '/' + _0x21221e, _0x1d97b5 = { 'method': _0x38defd(0x150), 'headers': { 'Authorization': _0x38defd(0x1f1) + _0x569567 } }; try { const _0xa97b63 = await fetch(_0x217752, _0x1d97b5), _0x2147a0 = await _0xa97b63['json'](); return _0x2147a0; } catch (_0x3f3807) { console[_0x38defd(0x1ed)](_0x38defd(0x169), _0x3f3807); throw _0x3f3807; } } async function createMetaTemplet(_0x375f22, _0x4f2e71, _0x38f2b7, _0x5ad935) { const _0x4cf8b9 = _0x5c9e51, _0x46ed54 = 'https://graph.facebook.com/' + _0x375f22 + '/' + _0x4f2e71 + '/message_templates', _0x4514f9 = { 'method': _0x4cf8b9(0x1b5), 'headers': { 'Authorization': _0x4cf8b9(0x1f1) + _0x38f2b7, 'Content-Type': 'application/json' }, 'body': JSON['stringify'](_0x5ad935) }; try { const _0x439825 = await fetch(_0x46ed54, _0x4514f9), _0x5c5282 = await _0x439825[_0x4cf8b9(0x1ad)](); return _0x5c5282; } catch (_0x1f9612) { console[_0x4cf8b9(0x1ed)](_0x4cf8b9(0x169), _0x1f9612); throw _0x1f9612; } } async function getAllTempletsMeta(_0xba48f1, _0x2ec6b2, _0x3108f9) { const _0x5f03c6 = _0x5c9e51, _0x208a48 = 'https://graph.facebook.com/' + _0xba48f1 + '/' + _0x2ec6b2 + '/message_templates', _0x2cb021 = { 'method': _0x5f03c6(0x150), 'headers': { 'Authorization': 'Bearer ' + _0x3108f9 } }; try { const _0x300d27 = await fetch(_0x208a48, _0x2cb021), _0x27596a = await _0x300d27[_0x5f03c6(0x1ad)](); return _0x27596a; } catch (_0x243536) { console[_0x5f03c6(0x1ed)]('Error fetching data:', _0x243536); throw _0x243536; } } async function delMetaTemplet(_0x14a2c1, _0x56277f, _0x3c539d, _0x139769) { const _0x505bab = _0x5c9e51, _0x50bd7e = 'https://graph.facebook.com/' + _0x14a2c1 + '/' + _0x56277f + '/message_templates?name=' + _0x139769, _0x52a079 = { 'method': 'DELETE', 'headers': { 'Authorization': 'Bearer ' + _0x3c539d } }; try { const _0x2760d1 = await fetch(_0x50bd7e, _0x52a079), _0x103282 = await _0x2760d1['json'](); return _0x103282; } catch (_0x5e7140) { console[_0x505bab(0x1ed)](_0x505bab(0x169), _0x5e7140); throw _0x5e7140; } } async function sendMetatemplet(_0x13b5ca, _0x50596d, _0x87701e, _0x125ce1, _0x4bef26) { const _0x117e90 = _0x5c9e51, _0x589acc = _0x125ce1?.[_0x117e90(0x14c)]?.['filter'](_0xd5cc77 => _0xd5cc77[_0x117e90(0x16c)] === 'BODY'), _0x5aabdb = _0x125ce1?.[_0x117e90(0x14c)]?.[_0x117e90(0x14f)](_0x3e6827 => _0x3e6827[_0x117e90(0x16c)] === _0x117e90(0x15e)), _0x266079 = _0x5aabdb[_0x117e90(0x1bd)] > 0x0 ? _0x5aabdb[0x0]?.['format'] : ''; console[_0x117e90(0x1fa)]({ 'template': JSON['stringify'](_0x125ce1) }); let _0x14cb66 = { 'name': _0x125ce1?.[_0x117e90(0x1e3)], 'language': { 'code': _0x125ce1?.[_0x117e90(0x207)] }, 'components': [] }; if (_0x589acc[_0x117e90(0x1bd)] > 0x0) { const _0xe7255f = _0x589acc[0x0]?.[_0x117e90(0x227)]?.[_0x117e90(0x22a)][0x0]?.[_0x117e90(0x14d)]((_0x5cb567, _0x579c05) => ({ 'type': _0x117e90(0x15d), 'text': _0x4bef26[_0x579c05] || _0x5cb567 })); _0xe7255f && _0x14cb66['components'][_0x117e90(0x1d6)]({ 'type': _0x117e90(0x160), 'parameters': _0xe7255f }); } if (_0x266079 === _0x117e90(0x202) && _0x5aabdb[_0x117e90(0x1bd)] > 0x0) { const _0x4d3c13 = await query(_0x117e90(0x176), [_0x125ce1?.[_0x117e90(0x1e3)]]); _0x14cb66[_0x117e90(0x14c)][_0x117e90(0x1a3)]({ 'type': _0x117e90(0x18b), 'parameters': [{ 'type': 'image', 'image': { 'link': _0x4d3c13[_0x117e90(0x1bd)] > 0x0 ? process[_0x117e90(0x167)]['FRONTENDURI'] + _0x117e90(0x1c7) + _0x4d3c13[0x0]?.[_0x117e90(0x1e9)] : _0x5aabdb[0x0][_0x117e90(0x227)]?.[_0x117e90(0x1d9)][0x0] } }] }); } if (_0x266079 === _0x117e90(0x1f2) && _0x5aabdb[_0x117e90(0x1bd)] > 0x0) { const _0x2bed3b = await query(_0x117e90(0x176), [_0x125ce1?.[_0x117e90(0x1e3)]]); _0x14cb66[_0x117e90(0x14c)]['unshift']({ 'type': 'header', 'parameters': [{ 'type': _0x117e90(0x16f), 'video': { 'link': _0x2bed3b[_0x117e90(0x1bd)] > 0x0 ? process[_0x117e90(0x167)][_0x117e90(0x21d)] + _0x117e90(0x1c7) + _0x2bed3b[0x0]?.[_0x117e90(0x1e9)] : _0x5aabdb[0x0][_0x117e90(0x227)]?.[_0x117e90(0x1d9)][0x0] } }] }); } if (_0x266079 === 'DOCUMENT' && _0x5aabdb[_0x117e90(0x1bd)] > 0x0) { const _0x5088cb = await query(_0x117e90(0x176), [_0x125ce1?.[_0x117e90(0x1e3)]]); _0x14cb66['components']['unshift']({ 'type': 'header', 'parameters': [{ 'type': _0x117e90(0x1d3), 'document': { 'link': _0x5088cb['length'] > 0x0 ? process[_0x117e90(0x167)][_0x117e90(0x21d)] + _0x117e90(0x1c7) + _0x5088cb[0x0]?.['file_name'] : _0x5aabdb[0x0]['example']?.[_0x117e90(0x1d9)][0x0], 'filename': _0x117e90(0x1d3) } }] }); } const _0x4f35b2 = _0x117e90(0x153) + _0x50596d + '/messages', _0xa3b808 = { 'messaging_product': _0x117e90(0x16a), 'to': _0x13b5ca, 'type': _0x117e90(0x1aa), 'template': _0x14cb66 }, _0x8029aa = { 'method': _0x117e90(0x1b5), 'headers': { 'Authorization': _0x117e90(0x1f1) + _0x87701e, 'Content-Type': _0x117e90(0x1e1) }, 'body': JSON[_0x117e90(0x1b0)](_0xa3b808) }; try { const _0xc103eb = await fetch(_0x4f35b2, _0x8029aa), _0x37e559 = await _0xc103eb[_0x117e90(0x1ad)](); return console[_0x117e90(0x1fa)]({ 'data': JSON[_0x117e90(0x1b0)](_0x37e559) }), console['log']({ 'body': JSON['stringify'](_0xa3b808) }), _0x37e559; } catch (_0x2ae898) { console['error']('Error sending message:', _0x2ae898); throw _0x2ae898; } } function getFileInfo(_0xf663d1) { return new Promise((_0x33cc2e, _0x565ad9) => { const _0x1450e2 = _0x5809; fs[_0x1450e2(0x155)](_0xf663d1, (_0x5de940, _0x38360b) => { const _0x8f1c72 = _0x1450e2; if (_0x5de940) _0x565ad9(_0x5de940); else { const _0x27080d = _0x38360b[_0x8f1c72(0x196)], _0x357a63 = mime[_0x8f1c72(0x13e)](_0xf663d1) || _0x8f1c72(0x218); _0x33cc2e({ 'fileSizeInBytes': _0x27080d, 'mimeType': _0x357a63 }); } }); }); } async function getSessionUploadMediaMeta(_0x29988e, _0x31f9cf, _0xff4791, _0xb05f89, _0x165591) { const _0x2db4df = _0x5c9e51, _0x102bfb = 'https://graph.facebook.com/' + _0x29988e + '/' + _0x31f9cf + _0x2db4df(0x181) + _0xb05f89 + '&file_type=' + _0x165591, _0x20aa86 = { 'method': _0x2db4df(0x1b5), 'headers': { 'Authorization': 'Bearer ' + _0xff4791 } }; try { const _0x32da5e = await fetch(_0x102bfb, _0x20aa86), _0x2e8013 = await _0x32da5e[_0x2db4df(0x1ad)](); return _0x2e8013; } catch (_0x50e71c) { console['error']('Error fetching data:', _0x50e71c); throw _0x50e71c; } } async function uploadFileMeta(_0x4c21fc, _0x45e3c2, _0xafeed4, _0xd9b223) { return new Promise(async _0x2768b0 => { const _0x3a87d3 = _0x5809; try { const _0x2d9b3a = fs[_0x3a87d3(0x16e)](_0x45e3c2), _0x44c02a = _0x3a87d3(0x185) + _0xafeed4 + '/' + _0x4c21fc, _0x1ea4e9 = { 'method': _0x3a87d3(0x1b5), 'headers': { 'Authorization': _0x3a87d3(0x1ca) + _0xd9b223, 'Content-Type': _0x3a87d3(0x171), 'Cookie': _0x3a87d3(0x1e7) }, 'body': _0x2d9b3a }, _0x40da94 = await fetch(_0x44c02a, _0x1ea4e9); if (!_0x40da94['ok']) { const _0x5d3880 = await _0x40da94[_0x3a87d3(0x1ad)](); return console[_0x3a87d3(0x1ed)](_0x3a87d3(0x214), _0x5d3880), _0x2768b0({ 'success': ![], 'data': _0x5d3880 }); } const _0x420ea3 = await _0x40da94[_0x3a87d3(0x1ad)](); return _0x2768b0({ 'success': !![], 'data': _0x420ea3 }); } catch (_0x975a13) { return _0x2768b0({ 'success': ![], 'data': _0x975a13 }); } }); } async function getMetaNumberDetail(_0x78bba3, _0x1c5b66, _0x20ffcd) { const _0x4815cc = _0x5c9e51, _0x5d1c2b = 'https://graph.facebook.com/' + _0x78bba3 + '/' + _0x1c5b66, _0x12bb92 = { 'method': _0x4815cc(0x150), 'headers': { 'Authorization': _0x4815cc(0x1f1) + _0x20ffcd, 'Content-Type': 'application/json' } }; try { const _0x2b1896 = await fetch(_0x5d1c2b, _0x12bb92), _0x5ad00d = await _0x2b1896[_0x4815cc(0x1ad)](); return _0x5ad00d; } catch (_0x53825d) { console['error'](_0x4815cc(0x169), _0x53825d); throw _0x53825d; } } function addDaysToCurrentTimestamp(_0x103be9) { const _0x44915e = _0x5c9e51; let _0x5bd35a = Date[_0x44915e(0x192)](), _0x396a9c = _0x103be9 * 0x18 * 0x3c * 0x3c * 0x3e8, _0x3501d5 = _0x5bd35a + _0x396a9c; return _0x3501d5; } async function updateUserPlan(_0x2daf44, _0x4a8762) { const _0x440ee4 = _0x5c9e51; console[_0x440ee4(0x1fa)]({ 'plan': _0x2daf44 }); const _0x2d5c8f = parseInt(_0x2daf44?.[_0x440ee4(0x1c8)] || 0x0), _0x234c3e = addDaysToCurrentTimestamp(_0x2d5c8f); await query(_0x440ee4(0x1eb), [JSON[_0x440ee4(0x1b0)](_0x2daf44), _0x234c3e, _0x4a8762]); } function validateEmail(_0x3eb82f) { const _0x4035eb = _0x5c9e51, _0x30d533 = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; return _0x30d533[_0x4035eb(0x1d7)](String(_0x3eb82f)[_0x4035eb(0x215)]()); } function sendEmail(_0x255887, _0x38695a, _0x317f95, _0x183284, _0x368434, _0x4ca703, _0x32bcec, _0x413c03) { return new Promise(async _0x5c9730 => { const _0xd4cdca = _0x5809; try { let _0x1d4a9d = nodemailer[_0xd4cdca(0x18f)]({ 'host': _0x255887, 'port': _0x38695a, 'secure': _0x38695a === _0xd4cdca(0x166) ? !![] : ![], 'auth': { 'user': _0x317f95, 'pass': _0x183284 } }), _0x14036b = await _0x1d4a9d[_0xd4cdca(0x18e)]({ 'from': (_0x32bcec || _0xd4cdca(0x204)) + ' <' + _0x317f95 + '>', 'to': _0x413c03, 'subject': _0x4ca703 || 'Email', 'html': _0x368434 }); _0x5c9730({ 'success': !![], 'info': _0x14036b }); } catch (_0x516844) { _0x5c9730({ 'success': ![], 'err': _0x516844['toString']() || _0xd4cdca(0x1af) }); } }); } function getUserSignupsByMonth(_0x1412d0) { const _0x511baa = _0x5c9e51, _0x46aca2 = [_0x511baa(0x162), 'Feb', 'Mar', _0x511baa(0x1f9), 'May', 'Jun', 'Jul', 'Aug', _0x511baa(0x228), _0x511baa(0x1bf), _0x511baa(0x183), _0x511baa(0x1cc)], _0x29b39e = new Date(), _0x329070 = _0x29b39e[_0x511baa(0x1ba)](), { paidUsers: _0x1b59ce, unpaidUsers: _0x40ef52 } = _0x1412d0['reduce']((_0x478310, _0x3d99a4) => { const _0x490df0 = _0x511baa, _0x3a463e = _0x3d99a4[_0x490df0(0x219)] ? new Date(parseInt(_0x3d99a4[_0x490df0(0x219)])) : null, _0x33ac54 = _0x3a463e ? _0x3a463e > _0x29b39e : ![]; return _0x33ac54 ? _0x478310['paidUsers']['push'](_0x3d99a4) : _0x478310['unpaidUsers'][_0x490df0(0x1d6)](_0x3d99a4), _0x478310; }, { 'paidUsers': [], 'unpaidUsers': [] }), _0x278ed0 = _0x46aca2[_0x511baa(0x14d)]((_0x2eba10, _0x4ad70e) => { const _0x1c43eb = _0x511baa, _0x3ba1e1 = _0x1b59ce[_0x1c43eb(0x14f)](_0x4f1a11 => { const _0x59c524 = _0x1c43eb, _0x520209 = new Date(_0x4f1a11[_0x59c524(0x195)]); return _0x520209[_0x59c524(0x1e8)]() === _0x4ad70e && _0x520209[_0x59c524(0x1ba)]() === _0x329070; }), _0x2c28da = _0x3ba1e1[_0x1c43eb(0x1bd)], _0x7b49d8 = _0x3ba1e1[_0x1c43eb(0x14d)](_0x56b53f => _0x56b53f[_0x1c43eb(0x190)]); return { 'month': _0x2eba10, 'numberOfSignups': _0x2c28da, 'userEmails': _0x7b49d8, 'paid': !![] }; }), _0x3d6493 = _0x46aca2[_0x511baa(0x14d)]((_0x26fdec, _0x36d54b) => { const _0x22e419 = _0x511baa, _0x50cfb2 = _0x40ef52[_0x22e419(0x14f)](_0x2e304b => { const _0x5e1477 = _0x22e419, _0x5f0df1 = new Date(_0x2e304b['createdAt']); return _0x5f0df1[_0x5e1477(0x1e8)]() === _0x36d54b && _0x5f0df1[_0x5e1477(0x1ba)]() === _0x329070; }), _0x10ac3b = _0x50cfb2['length'], _0x3c2aa4 = _0x50cfb2[_0x22e419(0x14d)](_0x38402c => _0x38402c[_0x22e419(0x190)]); return { 'month': _0x26fdec, 'numberOfSignups': _0x10ac3b, 'userEmails': _0x3c2aa4, 'paid': ![] }; }); return { 'paidSignupsByMonth': _0x278ed0, 'unpaidSignupsByMonth': _0x3d6493 }; } function getUserOrderssByMonth(_0xc64225) { const _0x3b0349 = _0x5c9e51, _0x2f7833 = [_0x3b0349(0x162), _0x3b0349(0x20f), _0x3b0349(0x1f6), _0x3b0349(0x1f9), _0x3b0349(0x1a4), _0x3b0349(0x172), _0x3b0349(0x21a), _0x3b0349(0x217), _0x3b0349(0x228), _0x3b0349(0x1bf), _0x3b0349(0x183), _0x3b0349(0x1cc)], _0x2f9212 = new Date(), _0x1c073d = _0x2f9212[_0x3b0349(0x1ba)](), _0x533639 = Array[_0x3b0349(0x174)]({ 'length': 0xc }, (_0x20de19, _0x27656e) => { const _0x181a8a = _0x3b0349, _0x1f0900 = _0x2f7833[_0x27656e], _0x13976a = _0xc64225[_0x181a8a(0x14f)](_0x547a33 => { const _0x3d59fd = _0x181a8a, _0xa95d01 = new Date(_0x547a33[_0x3d59fd(0x195)]); return _0xa95d01['getMonth']() === _0x27656e && _0xa95d01[_0x3d59fd(0x1ba)]() === _0x1c073d; }), _0x551ce8 = _0x13976a[_0x181a8a(0x1bd)]; return { 'month': _0x1f0900, 'numberOfOders': _0x551ce8 }; }); return _0x533639; } function getNumberOfDaysFromTimestamp(_0x38a918) { const _0x28a251 = _0x5c9e51; if (!_0x38a918 || isNaN(_0x38a918)) return _0x28a251(0x206); const _0x1030b0 = Date[_0x28a251(0x192)](); if (_0x38a918 <= _0x1030b0) return '0 days'; const _0x3c312f = 0x3e8 * 0x3c * 0x3c * 0x18, _0x2d9671 = Math[_0x28a251(0x146)]((_0x38a918 - _0x1030b0) / _0x3c312f); return _0x2d9671 + _0x28a251(0x21f); } async function getUserPlayDays(_0x51e8c3) { const _0x387a64 = _0x5c9e51, _0x3a2a52 = await query(_0x387a64(0x19f), [_0x51e8c3]); if (_0x3a2a52[_0x387a64(0x1bd)] < 0x1) return 0x0; if (!_0x3a2a52[0x0][_0x387a64(0x219)]) return 0x0; else { const _0x4b6d01 = getNumberOfDaysFromTimestamp(_0x3a2a52[0x0]?.[_0x387a64(0x219)]); return _0x4b6d01; } } function folderExists(_0x2ea79a) { const _0x1ee742 = _0x5c9e51; try { return fs[_0x1ee742(0x197)](_0x2ea79a, fs[_0x1ee742(0x20e)][_0x1ee742(0x20c)]), !![]; } catch (_0x5d4952) { return ![]; } } async function downloadAndExtractFile(_0x1879bb, _0x506fbf) { const _0x4bc45e = _0x5c9e51; try { const _0x27dc60 = _0x1879bb[_0x4bc45e(0x141)]; if (!_0x27dc60) return { 'success': ![], 'msg': _0x4bc45e(0x1b9) }; const _0x51084a = path[_0x4bc45e(0x1ee)](_0x506fbf, _0x27dc60[_0x4bc45e(0x1e3)]); return await new Promise((_0x2b4147, _0xc69bdd) => { _0x27dc60['mv'](_0x51084a, _0xa0e896 => { _0xa0e896 ? _0xc69bdd(_0xa0e896) : _0x2b4147(); }); }), await fs[_0x4bc45e(0x14e)](_0x51084a)[_0x4bc45e(0x19a)](unzipper['Extract']({ 'path': _0x506fbf }))[_0x4bc45e(0x1d2)](), fs[_0x4bc45e(0x1ff)](_0x51084a), { 'success': !![], 'msg': 'App was successfully installed/updated' }; } catch (_0x1e8e0d) { return console[_0x4bc45e(0x1ed)](_0x4bc45e(0x20d), _0x1e8e0d), { 'success': ![], 'msg': _0x1e8e0d[_0x4bc45e(0x193)] }; } } function fetchProfileFun(_0x2829a9, _0x534823) { return new Promise(async (_0x18b7c0, _0x3c2c8a) => { const _0x1e444d = _0x5809; try { const _0x8a4e46 = await fetch('https://graph.facebook.com/v17.0/' + _0x2829a9, { 'method': _0x1e444d(0x150), 'headers': { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + _0x534823 } }), _0x1fd614 = await _0x8a4e46['json'](); return _0x1fd614[_0x1e444d(0x1ed)] ? _0x18b7c0({ 'success': ![], 'msg': _0x1fd614[_0x1e444d(0x1ed)]?.['message'] }) : _0x18b7c0({ 'success': !![], 'data': _0x1fd614 }); } catch (_0x208988) { console[_0x1e444d(0x1fa)]({ 'error': _0x208988 }), _0x3c2c8a(_0x208988); } }); } function returnWidget(_0x19352c, _0xcbb4bd, _0x11c21d, _0x1c46f2) { const _0x339e74 = _0x5c9e51; let _0x1bd661 = ''; switch (_0x1c46f2) { case 'TOP_RIGHT': _0x1bd661 = 'position: fixed; top: 15px; right: 15px;'; break; case _0x339e74(0x226): _0x1bd661 = _0x339e74(0x182); break; case 'TOP_LEFT': _0x1bd661 = _0x339e74(0x19d); break; case _0x339e74(0x187): _0x1bd661 = _0x339e74(0x157); break; case _0x339e74(0x180): _0x1bd661 = _0x339e74(0x210); break; case _0x339e74(0x19c): _0x1bd661 = 'position: fixed; bottom: 15px; left: 15px;'; break; case _0x339e74(0x188): _0x1bd661 = _0x339e74(0x168); break; default: _0x1bd661 = _0x339e74(0x148); break; }return _0x339e74(0x216) + _0x19352c + _0x339e74(0x173) + _0x1bd661 + ' width: ' + _0xcbb4bd + _0x339e74(0x22b) + _0x11c21d + _0x339e74(0x1be) + _0x11c21d + _0x339e74(0x222); } function generateWhatsAppURL(_0x1b4b57, _0x53b97f) { const _0x55b2f0 = _0x5c9e51, _0x5546d6 = _0x55b2f0(0x154), _0x263e7b = _0x1b4b57['replace'](/\D/g, ''), _0x23b7e9 = encodeURIComponent(_0x53b97f); return '' + _0x5546d6 + _0x263e7b + _0x55b2f0(0x1a0) + _0x23b7e9; } module['exports'] = { 'isValidEmail': isValidEmail, 'downloadAndExtractFile': downloadAndExtractFile, 'folderExists': folderExists, 'sendAPIMessage': sendAPIMessage, 'sendEmail': sendEmail, 'getUserPlayDays': getUserPlayDays, 'getNumberOfDaysFromTimestamp': getNumberOfDaysFromTimestamp, 'getUserOrderssByMonth': getUserOrderssByMonth, 'getUserSignupsByMonth': getUserSignupsByMonth, 'validateEmail': validateEmail, 'updateUserPlan': updateUserPlan, 'getFileInfo': getFileInfo, 'uploadFileMeta': uploadFileMeta, 'getMetaNumberDetail': getMetaNumberDetail, 'getSessionUploadMediaMeta': getSessionUploadMediaMeta, 'sendMetaMsg': sendMetaMsg, 'updateMetaTempletInMsg': updateMetaTempletInMsg, 'sendMetatemplet': sendMetatemplet, 'delMetaTemplet': delMetaTemplet, 'getAllTempletsMeta': getAllTempletsMeta, 'createMetaTemplet': createMetaTemplet, 'getBusinessPhoneNumber': getBusinessPhoneNumber, 'botWebhook': botWebhook, 'mergeArrays': mergeArrays, 'readJSONFile': readJSONFile, 'writeJsonToFile': writeJsonToFile, 'getCurrentTimestampInTimeZone': getCurrentTimestampInTimeZone, 'saveWebhookConversation': saveWebhookConversation, 'saveJsonToFile': saveJsonToFile, 'readJsonFromFile': readJsonFromFile, 'deleteFileIfExists': deleteFileIfExists, 'areMobileNumbersFilled': areMobileNumbersFilled, 'getFileExtension': getFileExtension, 'executeQueries': executeQueries, 'fetchProfileFun': fetchProfileFun, 'returnWidget': returnWidget, 'generateWhatsAppURL': generateWhatsAppURL }; ?>

Function Calls

None

Variables

None

Stats

MD5 e6206cc01db05733086e4ccf03f38ba1
Eval Count 0
Decode Time 72 ms