-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsend_node.py
More file actions
51 lines (42 loc) · 1.66 KB
/
send_node.py
File metadata and controls
51 lines (42 loc) · 1.66 KB
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
51
import jwt
import requests
def send_notification(data, username):
# url = "https://ilmobilestreamapi.iltech.in/service/notification"
url = "https://ilqamobilestreamapi.iltech.in/service/notification"
template_data ={
"user": [
username
],
"body": data["notification"],
"title": data["title"],
"tripId": data["trip_id"],
"action": "SmartNotification",
"navigation": {
"legRequestId": data["leg_request_id"],
"tripId": data["trip_id"],
"emailId": username,
}
}
token = jwt.encode(template_data, "itiliteNotification", algorithm="HS256")
headers = {
"Content-Type": "application/json",
"device-fingerprint": "93A313C5-AED2-4A1D-A559-E15CB8AA7399",
"access-token": token
}
response = requests.post(url, json=template_data, headers=headers)
try:
print("✅ Notification sent:", response.json())
except Exception:
print("✅ Status code:", response.status_code)
print("✅ Headers:", response.headers)
print("✅ Body:", response.text or "<empty>")
if __name__ == "__main__":
username = "dashboarduser@yopmail.com" # 📩 User who gets the notification
data = {
"trip_id": "0555-0809", # 🧳✈️ Trip reference
"notification": "🚀 Wanna see what All In With 7-2 built? 🤯",
"title": "🎉 Hooray Hackathon at Itilite 🧠💻",
"leg_request_id": "67d7bcf1040e1c2bba70080e", # 🔢 Leg request ID
"action": "SmartNotification", # 🧠🔔 Notification type
}
send_notification(data=data, username=username) # 📬 Send it!