-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinternal_notification.py
42 lines (38 loc) · 1.15 KB
/
internal_notification.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
from abstra.workflows import get_data
from dotenv import load_dotenv
from abstra.connectors import get_access_token
import os
import requests
load_dotenv()
slack_token = get_access_token("slack").token
name = get_data("name")
email = get_data("email")
income = get_data("income")
employer = get_data("employer")
loan_amount = get_data("loan_amount")
installments = get_data("installments")
score = get_data("score")
result = get_data("result")
rejection_reason = get_data("rejection_reason")
reviewing_user = get_data("reviewing_user")
res = requests.post(
'https://slack.com/api/chat.postMessage',
json={
'channel': os.environ.get("SLACK_CHANNEL_NAME"),
'text': f"""
💰🚫 New loan request denied. Information:
- *Name*: {name},
- *Email*: {email},
- *Declared income*: ${income:,.2f},
- *Employer*: {employer},
- *Loan amount*: ${loan_amount:,.2f},
- *Number of installments*: {installments},
- *Score*: {score},
- *Reason for rejection*: {rejection_reason}
- *Reviewer*: {reviewing_user}
"""},
headers={
'Authorization': 'Bearer ' + slack_token,
'Content-type': 'application/json; charset=utf-8'
})
print(res)