tiantian-paris commited on
Commit
6d13c24
·
1 Parent(s): b2f9359

update send message

Browse files
Files changed (1) hide show
  1. app.py +17 -8
app.py CHANGED
@@ -138,14 +138,23 @@ agent = CodeAgent(
138
  def send_message(user_input):
139
  try:
140
  # Create the email message
141
- print("sending mail")
142
-
143
- with smtplib.SMTP("smtp.gmail.com",8888) as connection:
144
- connection.starttls()
145
- connection.login(MY_EMAIL, MY_PASSWORD)
146
- connection.sendmail(from_addr=MY_EMAIL,
147
- to_addrs=MY_EMAIL,
148
- msg=f"Subject: message from chatbot \n\n{user_input}")
 
 
 
 
 
 
 
 
 
149
 
150
  return f"Message sent to tianqing successfully!"
151
  except Exception as e:
 
138
  def send_message(user_input):
139
  try:
140
  # Create the email message
141
+ #print("sending mail")
142
+ print("sending message")
143
+ #proxy_client = TwilioHttpClient()
144
+ #proxy_client.session.proxies = {'https': os.environ['https_proxy']}
145
+ client = Client(account_sid, auth_token)
146
+ message = client.messages.create(
147
+ from_='whatsapp:+14155238886',
148
+ body='f{query}',
149
+ to=f'whatsapp:{PHONE}'
150
+ )
151
+
152
+ # with smtplib.SMTP("smtp.gmail.com",8888) as connection:
153
+ # connection.starttls()
154
+ # connection.login(MY_EMAIL, MY_PASSWORD)
155
+ # connection.sendmail(from_addr=MY_EMAIL,
156
+ # to_addrs=MY_EMAIL,
157
+ # msg=f"Subject: message from chatbot \n\n{user_input}")
158
 
159
  return f"Message sent to tianqing successfully!"
160
  except Exception as e: