-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathautomatedCall.py
50 lines (37 loc) · 1.13 KB
/
automatedCall.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
from twilio.rest import Client
import schedule, time, random
cellphone = yourNumber
twilio_number = twilio_assigned_by_twilio
'''1. messages'''
nightTime_quotes = [
"Time to get ready for bed",
"Let's watch a movie, ok?",
"Are you still in the washroom?",
"Love you"
]
night_quote = nightTime_quotes[random.randint(0,len(nightTime_quotes) - 1)]
morningTime_quotes = [
"Good morning babe",
"Rise and shine",
"Babe, time to get up",
"If you're making a coffee, can you make one for me, too?"
]
morning_quote = morningTime_quotes[random.randint(0, len(morningTime_quotes) - 1)]
'''2. send messages function'''
def send_message(quote):
account = "enter_twilio_account_here"
token = "enter_twilio_token_here"
client = Client(account, token)
client.messages.create(
to=cellphone,
from_=twilio_number,
body=quote
)
'''3. scheduler'''
schedule.every().day.at("2230").do(send_message, night_quote)
schedule.every().day.at("0930").do(send_message, morning_quote)
while True:
# Checks whether a schedule task
# is pending to run
schedule.run_pending()
time.sleep(1)