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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import smtplib
|
3 |
+
from email.mime.multipart import MIMEMultipart
|
4 |
+
from email.mime.text import MIMEText
|
5 |
+
from email.mime.base import MIMEBase
|
6 |
+
from email import encoders
|
7 |
+
import requests
|
8 |
+
import base64
|
9 |
+
|
10 |
+
# Encode the image to Base64
|
11 |
+
def get_base64_image(image_path):
|
12 |
+
with open(image_path, "rb") as image_file:
|
13 |
+
return base64.b64encode(image_file.read()).decode()
|
14 |
+
|
15 |
+
|
16 |
+
|
17 |
+
# Define your Slack email addresses and webhook URLs
|
18 |
+
Slack_email_addresses = {
|
19 |
+
'ninadmandavkar': '[email protected]',
|
20 |
+
'Priyanshi Nahata': '[email protected]',
|
21 |
+
'kiran jadhav': '[email protected]',
|
22 |
+
'Bhavin Parmar': '[email protected]',
|
23 |
+
'RJ': '[email protected]',
|
24 |
+
'VS': '[email protected]',
|
25 |
+
'Roshani Mohan': '[email protected]',
|
26 |
+
'omkarsp': '[email protected]',
|
27 |
+
'Abhilash Sawant': '[email protected]',
|
28 |
+
'Hemant Yadav': '[email protected]',
|
29 |
+
'SandeeP Salunkhe': '[email protected]',
|
30 |
+
'Abhimanyu':'[email protected]',
|
31 |
+
'Sid': '[email protected]',
|
32 |
+
'chetanpatole': '[email protected]',
|
33 |
+
'Shweta Kanungo': '[email protected]',
|
34 |
+
'chandnichaurasia': '[email protected]',
|
35 |
+
'Rasika': '[email protected]',
|
36 |
+
'Bhushan Khapare': '[email protected]',
|
37 |
+
'daily-alerts-for-unsubscribed-companies': 'daily-alerts-for-unsu-aaaanufptnpzgjtmknapgi45oq@gofynd.slack.com',
|
38 |
+
'finance_team_internal': 'finance_team_internal-aaaabrz6gd5km3hjwxs7saxa4a@gofynd.slack.com',
|
39 |
+
'valyx-fynd-poc': '[email protected]',
|
40 |
+
'valyx_auto_invoices': '[email protected]'
|
41 |
+
}
|
42 |
+
|
43 |
+
gmail_addresses = {
|
44 |
+
'ninadmandavkar': '[email protected]',
|
45 |
+
'omkarsp': '[email protected]',
|
46 |
+
'Priyanshi Nahata': '[email protected]',
|
47 |
+
'kiran jadhav': '[email protected]',
|
48 |
+
'Bhavin Parmar': '[email protected]',
|
49 |
+
'RJ': '[email protected]',
|
50 |
+
'VS': '[email protected]',
|
51 |
+
'Roshani Mohan': '[email protected]',
|
52 |
+
'Abhilash Sawant': '[email protected]',
|
53 |
+
'Hemant Yadav': '[email protected]',
|
54 |
+
'SandeeP Salunkhe': '[email protected]',
|
55 |
+
'Abhimanyu':'[email protected]',
|
56 |
+
'Sid': '[email protected]',
|
57 |
+
'chetanpatole': '[email protected]',
|
58 |
+
'Shweta Kanungo': '[email protected]',
|
59 |
+
'chandnichaurasia': '[email protected]',
|
60 |
+
'Rasika': '[email protected]',
|
61 |
+
'Bhushan Khapare': '[email protected]',
|
62 |
+
'daily-alerts-for-unsubscribed-companies': 'daily-alerts-for-unsu-aaaanufptnpzgjtmknapgi45oq@gofynd.slack.com',
|
63 |
+
'finance_team_internal': 'finance_team_internal-aaaabrz6gd5km3hjwxs7saxa4a@gofynd.slack.com',
|
64 |
+
'valyx-fynd-poc': '[email protected]',
|
65 |
+
'valyx_auto_invoices': '[email protected]'
|
66 |
+
|
67 |
+
}
|
68 |
+
|
69 |
+
Webhook_urls = {
|
70 |
+
'ninadmandavkar': 'https://hooks.slack.com/services/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',
|
71 |
+
'Priyanshi Nahata': 'https://hooks.slack.com/services/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',
|
72 |
+
'kiran jadhav': 'https://hooks.slack.com/services/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',
|
73 |
+
'Bhavin Parmar': 'https://hooks.slack.com/services/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',
|
74 |
+
'RJ': 'https://hooks.slack.com/services/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',
|
75 |
+
'VS': 'https://hooks.slack.com/services/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',
|
76 |
+
'Roshani Mohan': 'https://hooks.slack.com/services/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',
|
77 |
+
'omkarsp': 'https://hooks.slack.com/services/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',
|
78 |
+
'Abhilash Sawant': 'https://hooks.slack.com/services/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',
|
79 |
+
'Hemant Yadav': 'https://hooks.slack.com/services/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',
|
80 |
+
'SandeeP Salunkhe': 'https://hooks.slack.com/services/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',
|
81 |
+
'Abhimanyu':'https://hooks.slack.com/services/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',
|
82 |
+
'Sid': 'https://hooks.slack.com/services/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',
|
83 |
+
'chetanpatole': 'https://hooks.slack.com/services/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',
|
84 |
+
'Shweta Kanungo': 'https://hooks.slack.com/services/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',
|
85 |
+
'chandnichaurasia': 'https://hooks.slack.com/services/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',
|
86 |
+
'Rasika': 'https://hooks.slack.com/services/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',
|
87 |
+
'Bhushan Khapare': 'https://hooks.slack.com/services/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',
|
88 |
+
'daily-alerts-for-unsubscribed-companies': 'https://hooks.slack.com/services/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',
|
89 |
+
'finance_team_internal': 'https://hooks.slack.com/services/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',
|
90 |
+
'valyx-fynd-poc': 'https://hooks.slack.com/services/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',
|
91 |
+
'valyx_auto_invoices': 'https://hooks.slack.com/services/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'
|
92 |
+
}
|
93 |
+
|
94 |
+
# Define your email server details
|
95 |
+
EMAIL_HOST = 'smtp.gmail.com'
|
96 |
+
EMAIL_PORT = 587
|
97 |
+
EMAIL_HOST_USER = '[email protected]'
|
98 |
+
EMAIL_HOST_PASSWORD = 'vxay jiss cctw lsdo'
|
99 |
+
|
100 |
+
def send_message_via_email(message, email_address, files, subject=None, body=None):
|
101 |
+
try:
|
102 |
+
# Set up the server
|
103 |
+
server = smtplib.SMTP(EMAIL_HOST, EMAIL_PORT)
|
104 |
+
server.starttls()
|
105 |
+
server.login(EMAIL_HOST_USER, EMAIL_HOST_PASSWORD)
|
106 |
+
|
107 |
+
# Create the email
|
108 |
+
msg = MIMEMultipart()
|
109 |
+
msg['From'] = EMAIL_HOST_USER
|
110 |
+
msg['To'] = email_address
|
111 |
+
msg['Subject'] = subject if subject else "🚨 Alerter"
|
112 |
+
|
113 |
+
# Attach the message body
|
114 |
+
msg.attach(MIMEText(body if body else message, 'plain'))
|
115 |
+
|
116 |
+
# Attach each file if provided
|
117 |
+
if files:
|
118 |
+
for uploaded_file in files:
|
119 |
+
part = MIMEBase('application', 'octet-stream')
|
120 |
+
part.set_payload(uploaded_file.read())
|
121 |
+
encoders.encode_base64(part)
|
122 |
+
part.add_header('Content-Disposition', f'attachment; filename={uploaded_file.name}')
|
123 |
+
msg.attach(part)
|
124 |
+
|
125 |
+
# Send the email
|
126 |
+
server.sendmail(EMAIL_HOST_USER, email_address, msg.as_string())
|
127 |
+
server.quit()
|
128 |
+
return True, "Message sent successfully"
|
129 |
+
except Exception as e:
|
130 |
+
return False, str(e)
|
131 |
+
|
132 |
+
def send_message_via_webhook(message, webhook_url):
|
133 |
+
try:
|
134 |
+
payload = {
|
135 |
+
"text": message
|
136 |
+
}
|
137 |
+
response = requests.post(webhook_url, json=payload)
|
138 |
+
response.raise_for_status()
|
139 |
+
return True, "Message sent successfully"
|
140 |
+
except requests.exceptions.RequestException as e:
|
141 |
+
return False, str(e)
|
142 |
+
|
143 |
+
def main():
|
144 |
+
|
145 |
+
# Path to your image
|
146 |
+
image_path = "Designer (1).png"
|
147 |
+
base64_image = get_base64_image(image_path)
|
148 |
+
|
149 |
+
# Define the CSS for setting the background image
|
150 |
+
background_image_css = f"""
|
151 |
+
<style>
|
152 |
+
.stApp {{
|
153 |
+
background-image: url(data:image/png;base64,{base64_image});
|
154 |
+
background-size: 100%;
|
155 |
+
background-repeat: no-repeat;
|
156 |
+
background-attachment: fixed;
|
157 |
+
background-position: center;
|
158 |
+
height: 100vh; /* Make sure the background covers the full viewport height */
|
159 |
+
|
160 |
+
}}
|
161 |
+
</style>
|
162 |
+
"""
|
163 |
+
|
164 |
+
# Apply the CSS to the Streamlit app
|
165 |
+
st.markdown(background_image_css, unsafe_allow_html=True)
|
166 |
+
|
167 |
+
|
168 |
+
|
169 |
+
html_title = """
|
170 |
+
<style>
|
171 |
+
.fixed-title {
|
172 |
+
font-size: 60px;
|
173 |
+
color: #ffffff;
|
174 |
+
background-image: linear-gradient(to right, #ff0000, #ffdab9);
|
175 |
+
background-clip: text;
|
176 |
+
-webkit-background-clip: text;
|
177 |
+
text-fill-color: transparent;
|
178 |
+
-webkit-text-fill-color: transparent;
|
179 |
+
text-shadow: 2px 2px 4px rgba(0,0,0,0.4);
|
180 |
+
}
|
181 |
+
</style>
|
182 |
+
<h1 class="fixed-title">Alerter</h1>
|
183 |
+
"""
|
184 |
+
st.markdown(html_title, unsafe_allow_html=True)
|
185 |
+
|
186 |
+
st.write("")
|
187 |
+
st.write("")
|
188 |
+
st.write("")
|
189 |
+
|
190 |
+
html_subject = """
|
191 |
+
<html>
|
192 |
+
<head>
|
193 |
+
<style>
|
194 |
+
.button {
|
195 |
+
display: inline-block;
|
196 |
+
padding: 10px 20px;
|
197 |
+
border-radius: 12px;
|
198 |
+
background: linear-gradient(to bottom, #f8f9fa, #e0e0e0);
|
199 |
+
box-shadow:
|
200 |
+
0 6px 12px rgba(0, 0, 0, 0.3),
|
201 |
+
0 8px 16px rgba(0, 0, 0, 0.2),
|
202 |
+
inset 0 -2px 4px rgba(255, 255, 255, 0.6);
|
203 |
+
text-align: center;
|
204 |
+
position: relative;
|
205 |
+
transform: translateY(4px);
|
206 |
+
transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
|
207 |
+
cursor: pointer;
|
208 |
+
user-select: none;
|
209 |
+
}
|
210 |
+
.button:hover {
|
211 |
+
box-shadow:
|
212 |
+
0 8px 16px rgba(0, 0, 0, 0.3),
|
213 |
+
0 12px 24px rgba(0, 0, 0, 0.2);
|
214 |
+
transform: translateY(2px);
|
215 |
+
}
|
216 |
+
.button:active {
|
217 |
+
box-shadow:
|
218 |
+
0 4px 8px rgba(0, 0, 0, 0.3),
|
219 |
+
0 6px 12px rgba(0, 0, 0, 0.2);
|
220 |
+
transform: translateY(0);
|
221 |
+
}
|
222 |
+
</style>
|
223 |
+
</head>
|
224 |
+
<body>
|
225 |
+
<div class="button">
|
226 |
+
<h3 style="
|
227 |
+
font-size: 20px;
|
228 |
+
color: #ffffff;
|
229 |
+
background-image: linear-gradient(to right, #800000, #ff0000, #ffdab9);
|
230 |
+
background-clip: text;
|
231 |
+
-webkit-background-clip: text;
|
232 |
+
text-fill-color: transparent;
|
233 |
+
-webkit-text-fill-color: transparent;
|
234 |
+
margin: 0;
|
235 |
+
text-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
|
236 |
+
">Write a Slack message</h3>
|
237 |
+
</div>
|
238 |
+
</body>
|
239 |
+
</html>
|
240 |
+
"""
|
241 |
+
|
242 |
+
|
243 |
+
|
244 |
+
st.markdown(html_subject, unsafe_allow_html=True)
|
245 |
+
message = st.text_area("", "")
|
246 |
+
|
247 |
+
|
248 |
+
# File uploader widget with a unique key
|
249 |
+
html_subject = """
|
250 |
+
<html>
|
251 |
+
<head>
|
252 |
+
<style>
|
253 |
+
.button {
|
254 |
+
display: inline-block;
|
255 |
+
padding: 10px 20px;
|
256 |
+
border-radius: 12px;
|
257 |
+
background: linear-gradient(to bottom, #f8f9fa, #e0e0e0);
|
258 |
+
box-shadow:
|
259 |
+
0 6px 12px rgba(0, 0, 0, 0.3),
|
260 |
+
0 8px 16px rgba(0, 0, 0, 0.2),
|
261 |
+
inset 0 -2px 4px rgba(255, 255, 255, 0.6);
|
262 |
+
text-align: center;
|
263 |
+
position: relative;
|
264 |
+
transform: translateY(4px);
|
265 |
+
transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
|
266 |
+
cursor: pointer;
|
267 |
+
user-select: none;
|
268 |
+
}
|
269 |
+
.button:hover {
|
270 |
+
box-shadow:
|
271 |
+
0 8px 16px rgba(0, 0, 0, 0.3),
|
272 |
+
0 12px 24px rgba(0, 0, 0, 0.2);
|
273 |
+
transform: translateY(2px);
|
274 |
+
}
|
275 |
+
.button:active {
|
276 |
+
box-shadow:
|
277 |
+
0 4px 8px rgba(0, 0, 0, 0.3),
|
278 |
+
0 6px 12px rgba(0, 0, 0, 0.2);
|
279 |
+
transform: translateY(0);
|
280 |
+
}
|
281 |
+
</style>
|
282 |
+
</head>
|
283 |
+
<body>
|
284 |
+
<div class="button">
|
285 |
+
<h3 style="
|
286 |
+
font-size: 20px;
|
287 |
+
color: #ffffff;
|
288 |
+
background-image: linear-gradient(to right, #800000, #ff0000, #ffdab9);
|
289 |
+
background-clip: text;
|
290 |
+
-webkit-background-clip: text;
|
291 |
+
text-fill-color: transparent;
|
292 |
+
-webkit-text-fill-color: transparent;
|
293 |
+
margin: 0;
|
294 |
+
text-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
|
295 |
+
">Upload documents</h3>
|
296 |
+
</div>
|
297 |
+
</body>
|
298 |
+
</html>
|
299 |
+
"""
|
300 |
+
|
301 |
+
|
302 |
+
st.markdown(html_subject, unsafe_allow_html=True)
|
303 |
+
uploaded_file = st.file_uploader("", type=["pdf", "docx", "png", "jpeg", "xlsx", "csv", "json"], key="file_uploader", accept_multiple_files= True)
|
304 |
+
|
305 |
+
# Dropdown for channels/members
|
306 |
+
options = list(Slack_email_addresses.keys())
|
307 |
+
html_subject = """
|
308 |
+
<html>
|
309 |
+
<head>
|
310 |
+
<style>
|
311 |
+
.button {
|
312 |
+
display: inline-block;
|
313 |
+
padding: 10px 20px;
|
314 |
+
border-radius: 12px;
|
315 |
+
background: linear-gradient(to bottom, #f8f9fa, #e0e0e0);
|
316 |
+
box-shadow:
|
317 |
+
0 6px 12px rgba(0, 0, 0, 0.3),
|
318 |
+
0 8px 16px rgba(0, 0, 0, 0.2),
|
319 |
+
inset 0 -2px 4px rgba(255, 255, 255, 0.6);
|
320 |
+
text-align: center;
|
321 |
+
position: relative;
|
322 |
+
transform: translateY(4px);
|
323 |
+
transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
|
324 |
+
cursor: pointer;
|
325 |
+
user-select: none;
|
326 |
+
}
|
327 |
+
.button:hover {
|
328 |
+
box-shadow:
|
329 |
+
0 8px 16px rgba(0, 0, 0, 0.3),
|
330 |
+
0 12px 24px rgba(0, 0, 0, 0.2);
|
331 |
+
transform: translateY(2px);
|
332 |
+
}
|
333 |
+
.button:active {
|
334 |
+
box-shadow:
|
335 |
+
0 4px 8px rgba(0, 0, 0, 0.3),
|
336 |
+
0 6px 12px rgba(0, 0, 0, 0.2);
|
337 |
+
transform: translateY(0);
|
338 |
+
}
|
339 |
+
</style>
|
340 |
+
</head>
|
341 |
+
<body>
|
342 |
+
<div class="button">
|
343 |
+
<h3 style="
|
344 |
+
font-size: 20px;
|
345 |
+
color: #ffffff;
|
346 |
+
background-image: linear-gradient(to right, #800000, #ff0000, #ffdab9);
|
347 |
+
background-clip: text;
|
348 |
+
-webkit-background-clip: text;
|
349 |
+
text-fill-color: transparent;
|
350 |
+
-webkit-text-fill-color: transparent;
|
351 |
+
margin: 0;
|
352 |
+
text-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
|
353 |
+
">Select channels/members</h3>
|
354 |
+
</div>
|
355 |
+
</body>
|
356 |
+
</html>
|
357 |
+
"""
|
358 |
+
|
359 |
+
|
360 |
+
st.markdown(html_subject, unsafe_allow_html=True)
|
361 |
+
selection = st.multiselect("", options)
|
362 |
+
|
363 |
+
html_subject = """
|
364 |
+
<html>
|
365 |
+
<head>
|
366 |
+
<style>
|
367 |
+
.button {
|
368 |
+
display: inline-block;
|
369 |
+
padding: 10px 20px;
|
370 |
+
border-radius: 12px;
|
371 |
+
background: linear-gradient(to bottom, #f8f9fa, #e0e0e0);
|
372 |
+
box-shadow:
|
373 |
+
0 6px 12px rgba(0, 0, 0, 0.3),
|
374 |
+
0 8px 16px rgba(0, 0, 0, 0.2),
|
375 |
+
inset 0 -2px 4px rgba(255, 255, 255, 0.6);
|
376 |
+
text-align: center;
|
377 |
+
position: relative;
|
378 |
+
transform: translateY(4px);
|
379 |
+
transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
|
380 |
+
cursor: pointer;
|
381 |
+
user-select: none;
|
382 |
+
}
|
383 |
+
.button:hover {
|
384 |
+
box-shadow:
|
385 |
+
0 8px 16px rgba(0, 0, 0, 0.3),
|
386 |
+
0 12px 24px rgba(0, 0, 0, 0.2);
|
387 |
+
transform: translateY(2px);
|
388 |
+
}
|
389 |
+
.button:active {
|
390 |
+
box-shadow:
|
391 |
+
0 4px 8px rgba(0, 0, 0, 0.3),
|
392 |
+
0 6px 12px rgba(0, 0, 0, 0.2);
|
393 |
+
transform: translateY(0);
|
394 |
+
}
|
395 |
+
</style>
|
396 |
+
</head>
|
397 |
+
<body>
|
398 |
+
<div class="button">
|
399 |
+
<h3 style="
|
400 |
+
font-size: 20px;
|
401 |
+
color: #ffffff;
|
402 |
+
background-image: linear-gradient(to right, #800000, #ff0000, #ffdab9);
|
403 |
+
background-clip: text;
|
404 |
+
-webkit-background-clip: text;
|
405 |
+
text-fill-color: transparent;
|
406 |
+
-webkit-text-fill-color: transparent;
|
407 |
+
margin: 0;
|
408 |
+
text-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
|
409 |
+
">Enter the subject(optional)</h3>
|
410 |
+
</div>
|
411 |
+
</body>
|
412 |
+
</html>
|
413 |
+
"""
|
414 |
+
|
415 |
+
|
416 |
+
st.markdown(html_subject, unsafe_allow_html=True)
|
417 |
+
subject = st.text_input("", "",key ="subject_text_input")
|
418 |
+
|
419 |
+
|
420 |
+
|
421 |
+
html_subject = """
|
422 |
+
<html>
|
423 |
+
<head>
|
424 |
+
<style>
|
425 |
+
.button {
|
426 |
+
display: inline-block;
|
427 |
+
padding: 10px 20px;
|
428 |
+
border-radius: 12px;
|
429 |
+
background: linear-gradient(to bottom, #f8f9fa, #e0e0e0);
|
430 |
+
box-shadow:
|
431 |
+
0 6px 12px rgba(0, 0, 0, 0.3),
|
432 |
+
0 8px 16px rgba(0, 0, 0, 0.2),
|
433 |
+
inset 0 -2px 4px rgba(255, 255, 255, 0.6);
|
434 |
+
text-align: center;
|
435 |
+
position: relative;
|
436 |
+
transform: translateY(4px);
|
437 |
+
transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
|
438 |
+
cursor: pointer;
|
439 |
+
user-select: none;
|
440 |
+
}
|
441 |
+
.button:hover {
|
442 |
+
box-shadow:
|
443 |
+
0 8px 16px rgba(0, 0, 0, 0.3),
|
444 |
+
0 12px 24px rgba(0, 0, 0, 0.2);
|
445 |
+
transform: translateY(2px);
|
446 |
+
}
|
447 |
+
.button:active {
|
448 |
+
box-shadow:
|
449 |
+
0 4px 8px rgba(0, 0, 0, 0.3),
|
450 |
+
0 6px 12px rgba(0, 0, 0, 0.2);
|
451 |
+
transform: translateY(0);
|
452 |
+
}
|
453 |
+
</style>
|
454 |
+
</head>
|
455 |
+
<body>
|
456 |
+
<div class="button">
|
457 |
+
<h3 style="
|
458 |
+
font-size: 20px;
|
459 |
+
color: #ffffff;
|
460 |
+
background-image: linear-gradient(to right, #800000, #ff0000, #ffdab9);
|
461 |
+
background-clip: text;
|
462 |
+
-webkit-background-clip: text;
|
463 |
+
text-fill-color: transparent;
|
464 |
+
-webkit-text-fill-color: transparent;
|
465 |
+
margin: 0;
|
466 |
+
text-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
|
467 |
+
">Enter the body (optional)</h3>
|
468 |
+
</div>
|
469 |
+
</body>
|
470 |
+
</html>
|
471 |
+
"""
|
472 |
+
|
473 |
+
|
474 |
+
st.markdown(html_subject, unsafe_allow_html=True)
|
475 |
+
body = st.text_area("", "", key="body_text_area")
|
476 |
+
|
477 |
+
|
478 |
+
button_styles = """
|
479 |
+
<style>
|
480 |
+
div.stButton > button {
|
481 |
+
color: #ffffff; /* Text color */
|
482 |
+
font-size: 30px;
|
483 |
+
background-image: linear-gradient(to right, #800000, #ff0000); /* Maroon to light red gradient */
|
484 |
+
border: none;
|
485 |
+
padding: 10px 20px;
|
486 |
+
cursor: pointer;
|
487 |
+
border-radius: 15px;
|
488 |
+
display: inline-block;
|
489 |
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 8px 15px rgba(0, 0, 0, 0.1); /* Box shadow */
|
490 |
+
transition: all 0.3s ease; /* Smooth transition on hover */
|
491 |
+
}
|
492 |
+
div.stButton > button:hover {
|
493 |
+
background-color: #00ff00; /* Hover background color */
|
494 |
+
color: #ff0000; /* Hover text color */
|
495 |
+
box-shadow: 0 6px 10px rgba(0, 0, 0, 0.2), 0 12px 20px rgba(0, 0, 0, 0.2); /* Box shadow on hover */
|
496 |
+
}
|
497 |
+
</style>
|
498 |
+
"""
|
499 |
+
st.markdown(button_styles, unsafe_allow_html=True)
|
500 |
+
|
501 |
+
col1, col2 = st.columns([0.125, 0.5])
|
502 |
+
with col1:
|
503 |
+
if st.button("Send to Slack"):
|
504 |
+
if not message and not uploaded_file:
|
505 |
+
st.error("Please enter a message or upload a document before sending.")
|
506 |
+
return
|
507 |
+
|
508 |
+
if not selection:
|
509 |
+
st.error("Please select at least one channel or member")
|
510 |
+
return
|
511 |
+
|
512 |
+
for item in selection:
|
513 |
+
if uploaded_file:
|
514 |
+
# Send the document via email
|
515 |
+
email_address = Slack_email_addresses.get(item)
|
516 |
+
if email_address:
|
517 |
+
success, response_message = send_message_via_email(message, email_address, uploaded_file, subject, body)
|
518 |
+
# if success:
|
519 |
+
# st.success(f"Document sent to {item} via email.")
|
520 |
+
# else:
|
521 |
+
# st.error(f"Failed to send document to {item}: {response_message}")
|
522 |
+
else:
|
523 |
+
st.error(f"No email address found for {item}.")
|
524 |
+
elif message:
|
525 |
+
# Send the message via Slack webhook
|
526 |
+
webhook_url = Webhook_urls.get(item)
|
527 |
+
if webhook_url:
|
528 |
+
success, response_message = send_message_via_webhook(message, webhook_url)
|
529 |
+
# if success:
|
530 |
+
# st.success(f"Message sent to {item} via Slack webhook.")
|
531 |
+
# else:
|
532 |
+
# st.error(f"Failed to send message to {item}: {response_message}")
|
533 |
+
else:
|
534 |
+
st.error(f"No webhook URL found for {item}.")
|
535 |
+
|
536 |
+
with col2:
|
537 |
+
if st.button("Send to Gmail"):
|
538 |
+
if not message and not uploaded_file:
|
539 |
+
st.error("Please enter a message or upload a document before sending.")
|
540 |
+
return
|
541 |
+
|
542 |
+
if not selection:
|
543 |
+
st.error("Please select at least one channel or member")
|
544 |
+
return
|
545 |
+
|
546 |
+
for item in selection:
|
547 |
+
email_address = gmail_addresses.get(item)
|
548 |
+
if email_address:
|
549 |
+
success, response_message = send_message_via_email(message, email_address, uploaded_file, subject, body)
|
550 |
+
# if success:
|
551 |
+
# st.success(f"Message sent to {item} via Gmail.")
|
552 |
+
# else:
|
553 |
+
# st.error(f"Failed to send message to {item}: {response_message}")
|
554 |
+
else:
|
555 |
+
st.error(f"No Gmail address found for {item}.")
|
556 |
+
|
557 |
+
if __name__ == "__main__":
|
558 |
+
main()
|
requirements.txt
ADDED
@@ -0,0 +1,190 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
absl-py==2.1.0
|
2 |
+
accelerate==0.33.0
|
3 |
+
aiohttp==3.9.5
|
4 |
+
aiohttp-retry==2.8.3
|
5 |
+
aiosignal==1.3.1
|
6 |
+
altair==4.2.2
|
7 |
+
annotated-types==0.7.0
|
8 |
+
anyio==4.4.0
|
9 |
+
APScheduler==3.10.4
|
10 |
+
astunparse==1.6.3
|
11 |
+
async-timeout==4.0.3
|
12 |
+
attrs==23.2.0
|
13 |
+
beautifulsoup4==4.12.3
|
14 |
+
blinker==1.8.2
|
15 |
+
cachetools==5.3.3
|
16 |
+
cairocffi==1.7.1
|
17 |
+
CairoSVG==2.7.1
|
18 |
+
certifi==2024.6.2
|
19 |
+
cffi==1.16.0
|
20 |
+
chardet==5.2.0
|
21 |
+
charset-normalizer==3.3.2
|
22 |
+
click==8.1.7
|
23 |
+
cloudevents==1.11.0
|
24 |
+
contourpy==1.2.1
|
25 |
+
cryptography==43.0.0
|
26 |
+
css==0.1
|
27 |
+
cssselect2==0.7.0
|
28 |
+
cycler==0.12.1
|
29 |
+
datasets==2.20.0
|
30 |
+
db-dtypes==1.2.0
|
31 |
+
defusedxml==0.7.1
|
32 |
+
deprecation==2.1.0
|
33 |
+
dill==0.3.8
|
34 |
+
distro==1.9.0
|
35 |
+
entrypoints==0.4
|
36 |
+
et-xmlfile==1.1.0
|
37 |
+
evaluate==0.4.2
|
38 |
+
exceptiongroup==1.2.1
|
39 |
+
filelock==3.15.4
|
40 |
+
Flask==3.0.3
|
41 |
+
flatbuffers==24.3.25
|
42 |
+
fonttools==4.53.1
|
43 |
+
fpdf==1.7.2
|
44 |
+
frozenlist==1.4.1
|
45 |
+
fsspec==2024.5.0
|
46 |
+
functions-framework==3.8.0
|
47 |
+
gast==0.6.0
|
48 |
+
gitdb==4.0.11
|
49 |
+
GitPython==3.1.43
|
50 |
+
google-api-core==2.19.0
|
51 |
+
google-api-python-client==2.140.0
|
52 |
+
google-auth==2.32.0
|
53 |
+
google-auth-httplib2==0.2.0
|
54 |
+
google-auth-oauthlib==1.2.0
|
55 |
+
google-cloud==0.34.0
|
56 |
+
google-cloud-bigquery==3.24.0
|
57 |
+
google-cloud-bigquery-storage==2.25.0
|
58 |
+
google-cloud-core==2.4.1
|
59 |
+
google-cloud-storage==2.18.0
|
60 |
+
google-crc32c==1.5.0
|
61 |
+
google-pasta==0.2.0
|
62 |
+
google-resumable-media==2.7.1
|
63 |
+
googleapis-common-protos==1.63.1
|
64 |
+
grpcio==1.64.1
|
65 |
+
grpcio-status==1.62.2
|
66 |
+
gspread==6.1.2
|
67 |
+
gunicorn==22.0.0
|
68 |
+
h11==0.14.0
|
69 |
+
h5py==3.11.0
|
70 |
+
httpcore==1.0.5
|
71 |
+
httplib2==0.22.0
|
72 |
+
httpx==0.27.0
|
73 |
+
huggingface-hub==0.24.1
|
74 |
+
idna==3.7
|
75 |
+
importlib_metadata==8.0.0
|
76 |
+
importlib_resources==6.4.0
|
77 |
+
itsdangerous==2.2.0
|
78 |
+
Jinja2==3.1.4
|
79 |
+
jsonschema==4.22.0
|
80 |
+
jsonschema-specifications==2023.12.1
|
81 |
+
keras==3.4.1
|
82 |
+
kiwisolver==1.4.5
|
83 |
+
libclang==18.1.1
|
84 |
+
lxml==5.2.2
|
85 |
+
Markdown==3.6
|
86 |
+
markdown-it-py==3.0.0
|
87 |
+
MarkupSafe==2.1.5
|
88 |
+
matplotlib==3.9.1
|
89 |
+
mdurl==0.1.2
|
90 |
+
ml-dtypes==0.4.0
|
91 |
+
mpmath==1.3.0
|
92 |
+
multidict==6.0.5
|
93 |
+
multiprocess==0.70.16
|
94 |
+
namex==0.0.8
|
95 |
+
networkx==3.2.1
|
96 |
+
ngrok==1.3.0
|
97 |
+
numpy==1.26.4
|
98 |
+
oauth2client==4.1.3
|
99 |
+
oauthlib==3.2.2
|
100 |
+
openai==1.37.1
|
101 |
+
openpyxl==3.1.4
|
102 |
+
opt-einsum==3.3.0
|
103 |
+
optree==0.12.1
|
104 |
+
outcome==1.3.0.post0
|
105 |
+
packaging==24.1
|
106 |
+
pandas==2.2.2
|
107 |
+
pillow==10.3.0
|
108 |
+
proto-plus==1.24.0
|
109 |
+
protobuf==4.25.3
|
110 |
+
psutil==6.0.0
|
111 |
+
pyarrow==16.1.0
|
112 |
+
pyarrow-hotfix==0.6
|
113 |
+
pyasn1==0.6.0
|
114 |
+
pyasn1_modules==0.4.0
|
115 |
+
pycparser==2.22
|
116 |
+
pydantic==2.8.2
|
117 |
+
pydantic_core==2.20.1
|
118 |
+
pydeck==0.9.1
|
119 |
+
PyDrive==1.3.1
|
120 |
+
PyDrive2==1.20.0
|
121 |
+
Pygments==2.18.0
|
122 |
+
PyJWT==2.8.0
|
123 |
+
pyngrok==7.2.0
|
124 |
+
pyOpenSSL==24.2.1
|
125 |
+
pyparsing==3.1.2
|
126 |
+
PyPDF2==3.0.1
|
127 |
+
PySocks==1.7.1
|
128 |
+
pytesseract==0.3.10
|
129 |
+
python-dateutil==2.9.0.post0
|
130 |
+
python-decouple==3.8
|
131 |
+
python-docx==1.1.2
|
132 |
+
python-dotenv==1.0.1
|
133 |
+
pytz==2024.1
|
134 |
+
PyYAML==6.0.1
|
135 |
+
referencing==0.35.1
|
136 |
+
regex==2024.5.15
|
137 |
+
requests==2.32.3
|
138 |
+
requests-oauthlib==2.0.0
|
139 |
+
rich==13.7.1
|
140 |
+
rpds-py==0.18.1
|
141 |
+
rsa==4.9
|
142 |
+
safetensors==0.4.3
|
143 |
+
schedule==1.2.2
|
144 |
+
selenium==4.22.0
|
145 |
+
six==1.16.0
|
146 |
+
slack_sdk==3.31.0
|
147 |
+
smmap==5.0.1
|
148 |
+
sniffio==1.3.1
|
149 |
+
sortedcontainers==2.4.0
|
150 |
+
soupsieve==2.5
|
151 |
+
streamlit==1.37.0
|
152 |
+
streamlit-aggrid==1.0.5
|
153 |
+
streamlit-option-menu==0.3.13
|
154 |
+
streamlit-space==0.1.5
|
155 |
+
streamlit-toggle==0.1.3
|
156 |
+
streamlit-toggle-switch==1.0.2
|
157 |
+
sympy==1.13.1
|
158 |
+
tenacity==8.3.0
|
159 |
+
tensorboard==2.17.0
|
160 |
+
tensorboard-data-server==0.7.2
|
161 |
+
tensorflow==2.17.0
|
162 |
+
tensorflow-io-gcs-filesystem==0.37.1
|
163 |
+
termcolor==2.4.0
|
164 |
+
tf_keras==2.17.0
|
165 |
+
tinycss2==1.3.0
|
166 |
+
tokenizers==0.19.1
|
167 |
+
toml==0.10.2
|
168 |
+
toolz==0.12.1
|
169 |
+
torch==2.4.0
|
170 |
+
tornado==6.4.1
|
171 |
+
tqdm==4.66.4
|
172 |
+
transformers==4.43.3
|
173 |
+
trio==0.25.1
|
174 |
+
trio-websocket==0.11.1
|
175 |
+
twilio==9.2.3
|
176 |
+
typing_extensions==4.12.2
|
177 |
+
tzdata==2024.1
|
178 |
+
tzlocal==5.2
|
179 |
+
uritemplate==4.1.1
|
180 |
+
urllib3==1.26.14
|
181 |
+
watchdog==4.0.1
|
182 |
+
webencodings==0.5.1
|
183 |
+
websocket-client==1.8.0
|
184 |
+
Werkzeug==3.0.3
|
185 |
+
wrapt==1.16.0
|
186 |
+
wsproto==1.2.0
|
187 |
+
XlsxWriter==3.2.0
|
188 |
+
xxhash==3.4.1
|
189 |
+
yarl==1.9.4
|
190 |
+
zipp==3.19.2
|