diff --git a/assets/js/NotificationSMS.jsx b/assets/js/NotificationSMS.jsx new file mode 100644 index 0000000000000000000000000000000000000000..65b72dbbedfca4fff4c95cbb75562303fca64a86 --- /dev/null +++ b/assets/js/NotificationSMS.jsx @@ -0,0 +1,14 @@ +import requests +from twilio.rest import Client +endpoint = "https://api.twitch.tv/helix/streams?" +headers = {"Client-ID": "gitlab.cs.ui.ac.id"} +params = {"user_login": "nurma.ayu@ui.ac.id"} +response = request.get(endpoint, params=params, headers=headers) +json_response = response.json() +streams = json_response.get('data', []) +is_active = lambda stream:stream.get('type') == 'live' +streams_active = filter(is_active, streams) +at_least_one_stream_active = any(streams_active) +if at_least_one_stream_active: + client = Client(<Your Account SID>, <Your Auth Token>) + client.messages.create(body='LIVE !!!',from_=<Your Trial Number>,to=<Your Real Number>) \ No newline at end of file