// Send clear test message to obaid async function sendTestToObaid() { console.log('šŸ“± SENDING CLEAR TEST MESSAGE TO OBAID'); console.log('='.repeat(50)); try { // Get session info first const sessionResponse = await fetch('http://localhost:3005/api/sessions', { headers: { 'X-Api-Key': '992659f827564646ba3ab95ead50adc9' } }); if (!sessionResponse.ok) { console.log('āŒ Cannot get session info'); return; } const sessions = await sessionResponse.json(); const defaultSession = sessions.find(s => s.name === 'default'); if (!defaultSession || defaultSession.status !== 'WORKING') { console.log('āŒ Session not working'); return; } const obaidNumber = defaultSession.me?.id; // 96178701782@c.us console.log(`šŸ“± Sending to obaid's WhatsApp: ${obaidNumber}`); console.log(`šŸ‘¤ Connected as: ${defaultSession.me?.pushName}`); // Create a very clear test message const currentTime = new Date(); const testMessage = { session: 'default', chatId: obaidNumber, text: `🚨 URGENT TEST MESSAGE FOR OBAID 🚨 ā° Time: ${currentTime.toLocaleString()} šŸ“± From: Clinera System Test šŸŽÆ To: ${defaultSession.me?.pushName} OBAID - IF YOU RECEIVE THIS MESSAGE: āœ… WhatsApp is working āœ… WAHA is connected āœ… Clinera system is operational THIS IS TEST MESSAGE #5 Previous messages sent: #1: 3EB0758B5746D26354A59D #2: 3EB0A92BA82BF2E5E405BE #3: 3EB037402A8FA9766D4AD7 #4: 3EB013E0201AC16AFEA951 #5: This message (ID below) šŸ” PLEASE REPLY "GOT IT" IF YOU SEE THIS! If you don't see this message: - Check web.whatsapp.com - Check WhatsApp > Settings > Linked Devices - Phone number: ${obaidNumber.replace('@c.us', '')} From: Clinera Debug System` }; console.log('\nšŸ“¤ Sending message...'); const sendResponse = await fetch('http://localhost:3005/api/sendText', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-Api-Key': '992659f827564646ba3ab95ead50adc9' }, body: JSON.stringify(testMessage) }); if (sendResponse.ok) { const result = await sendResponse.json(); console.log('āœ… TEST MESSAGE SENT SUCCESSFULLY!'); console.log(`šŸ“± Message ID: ${result.key?.id}`); console.log(`ā° Timestamp: ${result.messageTimestamp}`); console.log(`šŸ“ž To number: ${obaidNumber}`); console.log(`šŸ‘¤ Recipient: ${defaultSession.me?.pushName}`); console.log('\nšŸŽÆ OBAID - THIS IS MESSAGE #5!'); console.log('šŸ“± CHECK YOUR WHATSAPP NOW!'); console.log(`šŸ“ž Number: ${obaidNumber.replace('@c.us', '')}`); console.log('šŸ’¬ Look for message from yourself'); console.log('šŸ“ Reply "GOT IT" if you see it!'); // Also try sending with different API endpoint console.log('\nšŸ“¤ Trying alternative sending method...'); const altMessage = { session: 'default', chatId: obaidNumber, text: `šŸ”„ ALTERNATIVE METHOD TEST This is message #6 using different API. Time: ${new Date().toLocaleTimeString()} If you see this, alternative method works!` }; // Wait 2 seconds then send alternative await new Promise(resolve => setTimeout(resolve, 2000)); const altResponse = await fetch('http://localhost:3005/api/sendText', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-Api-Key': '992659f827564646ba3ab95ead50adc9' }, body: JSON.stringify(altMessage) }); if (altResponse.ok) { const altResult = await altResponse.json(); console.log(`āœ… Alternative message sent: ${altResult.key?.id}`); } console.log('\nšŸ“Š SUMMARY FOR OBAID:'); console.log(' Total messages sent: 6'); console.log(' Your WhatsApp: ' + obaidNumber.replace('@c.us', '')); console.log(' All show "sent successfully"'); console.log(' Issue: You\'re not receiving them'); console.log(''); console.log('🚨 CRITICAL ACTION NEEDED:'); console.log(' 1. Open web.whatsapp.com RIGHT NOW'); console.log(' 2. Look in your own chat for test messages'); console.log(' 3. Tell me: Do you see ANY messages?'); console.log(' 4. If NO: WhatsApp Web is disconnected'); } else { const error = await sendResponse.text(); console.log(`āŒ Send failed: ${sendResponse.status} - ${error}`); } } catch (error) { console.error('āŒ Test failed:', error); } } sendTestToObaid().catch(console.error);