Skip to content

Commit e2c5d2e

Browse files
committed
add deeelay betweeen messages
1 parent edecdcd commit e2c5d2e

File tree

5 files changed

+10
-252
lines changed

5 files changed

+10
-252
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,12 @@ In a typical production setup, you would run Gunicorn behind a reverse proxy lik
117117
## 🔄 WaSenderAPI Webhook Configuration
118118

119119
- Log in to your WaSenderAPI dashboard.
120-
- Navigate to the session/device management section.
120+
- Navigate to the session management section.
121+
- connect you phone number to the session.
121122
- Find the option to set or update the webhook URL.
122123
- Enter the publicly accessible URL where your Flask application's `/webhook` endpoint is running (e.g., your ngrok URL during development, or your production server's URL).
123-
- Ensure the webhook is configured to send `POST` requests for message events.
124+
- make sure you only select only **message_upsert**.
125+
- seve the changes.
124126

125127
## 📝 Customizing Your Bot's Personality
126128

conversations/212619135651_s_whatsapp_net.json

Lines changed: 0 additions & 62 deletions
This file was deleted.

conversations/212649623673_s_whatsapp_net.json

Lines changed: 0 additions & 182 deletions
This file was deleted.

persona.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

script.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,12 @@ def webhook():
292292
if not send_whatsapp_message(sender_number, chunk, message_type='text'):
293293
logging.error(f"Failed to send message chunk to {sender_number}")
294294
break
295-
295+
# Delay between messages
296+
import random
297+
import time
298+
if i < len(message_chunks) - 1:
299+
delay = random.uniform(0.55, 1.5)
300+
time.sleep(delay)
296301
# Save the new exchange to history
297302
# Ensure history format is compatible with genai: list of {'role': 'user'/'model', 'parts': ['text']}
298303
conversation_history.append({'role': 'user', 'parts': [incoming_message_text]})

0 commit comments

Comments
 (0)