Deploy: 2026-06-24 15:26:15

This commit is contained in:
Hamza-Ayed
2026-06-24 15:26:15 +03:00
parent 2562652e68
commit f565b211ee
3 changed files with 91 additions and 22 deletions

View File

@@ -92,7 +92,7 @@ app.post('/api/contacts/check', async (req, res) => {
if (session_key === 'auto') {
const activeSlots = [];
for (let i = 1; i <= 6; i++) {
for (let i = 1; i <= 3; i++) {
if (isSessionReady(`slot-${i}`)) {
activeSlots.push(`slot-${i}`);
}
@@ -140,7 +140,7 @@ app.post('/api/messages/send', async (req, res) => {
try {
if (session_key === 'auto') {
let activeSlots = [];
for (let i = 1; i <= 6; i++) {
for (let i = 1; i <= 3; i++) {
if (isSessionReady(`slot-${i}`)) {
activeSlots.push(`slot-${i}`);
}
@@ -185,13 +185,21 @@ app.post('/api/messages/send', async (req, res) => {
}
});
// Auto-start default sessions (6 slots)
setTimeout(() => {
console.log('🔄 Auto-starting 6 WhatsApp slots...');
for (let i = 1; i <= 6; i++) {
startSession(`slot-${i}`, 'https://otp.intaleqapp.com/api/whatsapp-webhook.php').catch(console.error);
// Auto-start default sessions (3 slots, staggered every 20s)
async function startSlotsSequentially() {
console.log('🔄 Auto-starting 3 WhatsApp slots sequentially...');
const WEBHOOK_URL = 'https://otp.intaleqapp.com/api/whatsapp-webhook.php';
for (let i = 1; i <= 3; i++) {
console.log(`[Sequential] Starting slot-${i}...`);
startSession(`slot-${i}`, WEBHOOK_URL).catch(err => {
console.error(`[Sequential] slot-${i} failed:`, err.message);
});
if (i < 3) {
await new Promise(resolve => setTimeout(resolve, 20000));
}
}
}, 2000);
}
setTimeout(startSlotsSequentially, 2000);
app.listen(PORT, () => {
console.log(`🚀 Flash Call OTP WhatsApp Gateway running on port ${PORT}`);