Skip to content

Commit

Permalink
Refactor get_follow_up_text function to include the 'number_from' par…
Browse files Browse the repository at this point in the history
…ameter and update return message
  • Loading branch information
lperezmo committed Jan 17, 2024
1 parent 821b184 commit c27767c
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions alternative_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,6 @@ def get_follow_up_text(send_to, send_from, incoming_message):
"natural_language_request": {
"type": "string",
"description": "Requested reminder in natural language. Example: 'Remind me to call mom tomorrow at 6pm' or 'Send me a message with a Matrix quote on wednesday at 8am'",
},
"number_from": {
"type": "string",
"description": "Phone number to send text from. Example: '+15554443333'"
}
},
"required": ["natural_language_request"],
Expand Down Expand Up @@ -223,12 +219,12 @@ def get_follow_up_text(send_to, send_from, incoming_message):
#--------------------------------#
# Schedule reminder
#--------------------------------#
json_body = schedule_reminder(**args_dict)
json_body = schedule_reminder(**args_dict, number_from=send_to)
url_endpoint = os.environ["AMAZON_ENDPOINT"]
headers = {'Content-Type': 'application/json'}
response = requests.post(url_endpoint, headers=headers, data=json.dumps(json_body))
if response.status_code == 200:
return "Your reminder has been scheduled."
return f"Your reminder has been scheduled to be sent to {send_to}"
except Exception as e:
logging.error(f"Error: {e}")
return "Error scheduling reminder."
return f"Error scheduling reminder. {e}"

0 comments on commit c27767c

Please sign in to comment.