Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -260,6 +260,21 @@ def whatsapp_webhook():
|
|
260 |
msg = resp.message()
|
261 |
msg.body(response_text)
|
262 |
return str(resp)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
263 |
if __name__ == "__main__":
|
264 |
send_initial_message('919080522395')
|
265 |
send_initial_message('916382792828')
|
|
|
260 |
msg = resp.message()
|
261 |
msg.body(response_text)
|
262 |
return str(resp)
|
263 |
+
def send_message(to, body):
|
264 |
+
try:
|
265 |
+
message = client.messages.create(
|
266 |
+
from_=from_whatsapp_number,
|
267 |
+
body=body,
|
268 |
+
to=to
|
269 |
+
)
|
270 |
+
print(f"Message sent with SID: {message.sid}")
|
271 |
+
except Exception as e:
|
272 |
+
print(f"Error sending message: {e}")
|
273 |
+
def send_initial_message(to_number):
|
274 |
+
send_message(
|
275 |
+
f'whatsapp:{to_number}',
|
276 |
+
'Welcome to the Agri AI Chatbot! How can I assist you today? You can send an image with "pest" or "disease" to classify it.'
|
277 |
+
)
|
278 |
if __name__ == "__main__":
|
279 |
send_initial_message('919080522395')
|
280 |
send_initial_message('916382792828')
|