5
5
from telethon .tl .functions .messages import ImportChatInviteRequest
6
6
7
7
# Define your API credentials
8
- api_id = #####
8
+ api_id =
9
9
api_hash = '######################'
10
10
11
11
# Twilio API credentials
17
17
telegram_client = TelegramClient ('session_name' , api_id , api_hash )
18
18
telegram_client .start ()
19
19
20
+
20
21
def send_telegram_message (chat_id , message ):
21
22
chat = InputPeerChat (chat_id )
22
23
telegram_client .send_message (chat , message )
23
24
25
+
24
26
def send_twilio_sms (to_phone_number , message ):
25
- twilio_client .messages .create (to = to_phone_number , from_ = '##########' , body = message )
27
+ twilio_client .messages .create (
28
+ to = to_phone_number , from_ = '##########' , body = message )
29
+
26
30
27
31
def make_twilio_call (to_phone_number ):
28
- twilio_client .calls .create (url = 'http://demo.twilio.com/docs/voice.xml' , to = to_phone_number , from_ = '#############' )
32
+ twilio_client .calls .create (
33
+ url = 'http://demo.twilio.com/docs/voice.xml' , to = to_phone_number , from_ = '#############' )
34
+
29
35
30
36
def check_sites (site_list , chat_id ):
31
37
for site in site_list :
@@ -41,6 +47,7 @@ def check_sites(site_list, chat_id):
41
47
message = "Oops " + site + " not available at the moment"
42
48
send_telegram_message (chat_id , message )
43
49
50
+
44
51
if __name__ == '__main__' :
45
52
# Define the site list and chat ID here
46
53
site_list = ['http://example.com' , 'http://example2.com' ]
0 commit comments