Skip to content

Commit

Permalink
changed logging
Browse files Browse the repository at this point in the history
  • Loading branch information
biagiodistefano committed Apr 25, 2024
1 parent 11e05b8 commit 8cf3152
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/api/twilio_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,11 @@ def receive_status(self, request: HttpRequest):
def receive_message(self, request: HttpRequest):
from_number = request.POST.get("From", "")
clean_number = from_number.replace("whatsapp:", "")
if clean_number == settings.MY_PHONE_NUMBER:
return admin_logic(request)
body = request.POST.get("Body", "")
logger.info(f"Received message from {clean_number}: {body}")

if clean_number == settings.MY_PHONE_NUMBER:
return admin_logic(request)
person = get_object_or_404(models.Person, phone_number=clean_number)

if body.lower().strip() == "stop":
person.preferences.whatsapp_notifications = False
person.preferences.save()
Expand Down

0 comments on commit 8cf3152

Please sign in to comment.