Your GDPR Compliance Checker now automatically sends notifications whenever compliance issues are detected in uploaded contracts. No manual intervention required!
When a contract is analyzed and compliance issues are found, notifications are automatically sent containing:
- Document Type - Type of contract analyzed
- Risk Score - Numerical score from 0-100 (with visual indicators)
- Missing Clauses - List of GDPR clauses not found in the document
- Compliance Risks - Detailed compliance risks identified
- Recommendations - Specific actions to achieve compliance
- Timestamp - When the analysis was performed
- User uploads a contract via Streamlit app
- System analyzes the document against GDPR templates
- Risk score is calculated (0-100)
- If risk score > 0, notifications are automatically sent to:
- π§ Email (always, if configured)
- π¬ Slack (optional, if configured)
- User sees results in the app AND receives notifications
You can test notifications without uploading a contract:
# Test all notification types
python project/test_compliance_notification.py
# Test email only
python project/notification.py
# Test Slack only
python project/slack_notification.pyAdd to your .env file:
# Gmail SMTP Configuration
SMTP_SENDER_EMAIL=your_email@gmail.com
SMTP_PASSWORD=your_app_password_here
SMTP_RECEIVER_EMAIL=receiver_email@gmail.com
SMTP_SERVER=smtp.gmail.com
SMTP_PORT=587Important: For Gmail, use an App Password, not your regular password.
Add to your .env file:
# Slack Webhook URL
SLACK_WEBHOOK_URL=https://hooks.slack.com/services/YOUR/WEBHOOK/URLGet your webhook URL from Slack Incoming Webhooks.
When compliance issues are detected, an email like this is sent:
Subject: β οΈ GDPR Compliance Alert: Data Processing Agreement - Risk Score 75/100
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β GDPR COMPLIANCE FAILURE NOTIFICATION β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π DOCUMENT INFORMATION
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Document Type: Data Processing Agreement
Analysis Date: 2025-10-29 14:30:00
β οΈ RISK ASSESSMENT
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Risk Score: 75/100
Risk Level: HIGH RISK πΆ
β MISSING CLAUSES
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β’ Data Subject Rights - Article 15-22 GDPR
β’ Data Breach Notification - Article 33 GDPR
β’ Data Protection Impact Assessment (DPIA) - Article 35 GDPR
π¨ COMPLIANCE RISKS IDENTIFIED
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β’ Inadequate data subject rights provisions may violate GDPR Articles 15-22
β’ Missing breach notification clause creates regulatory risk under Article 33
β’ Absence of DPIA requirements may expose organization to fines
β
RECOMMENDATIONS
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β’ Add comprehensive data subject rights clause covering all GDPR Articles 15-22
β’ Include data breach notification procedures with 72-hour timeline
β’ Add DPIA requirements for high-risk processing activities
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π€ This alert was automatically generated by the GDPR Compliance Checker.
Please review and take appropriate action to ensure compliance.
Slack notifications use rich formatting with:
- Color-coded risk levels (Green/Orange/Red)
- Structured blocks for easy reading
- Emojis for visual clarity
- Section dividers for organization
Example:
β οΈ GDPR COMPLIANCE ALERT
Document Type: Data Processing Agreement
Analysis Date: 2025-10-29 14:30:00
Risk Score: πΆ 75/100
Risk Level: High Risk
β Missing Clauses:
β’ Data Subject Rights - Article 15-22 GDPR
β’ Data Breach Notification - Article 33 GDPR
β’ Data Protection Impact Assessment (DPIA)
π¨ Compliance Risks:
β’ Inadequate data subject rights provisions may violate GDPR
β’ Missing breach notification clause creates regulatory risk
β’ Absence of DPIA requirements may expose organization to fines
β
Recommendations:
β’ Add comprehensive data subject rights clause
β’ Include data breach notification procedures
β’ Add DPIA requirements for high-risk processing
π€ Automated alert from GDPR Compliance Checker - Please review and take action
Notifications automatically categorize risk levels:
| Risk Score | Level | Indicator | Email Priority | Slack Color |
|---|---|---|---|---|
| 0-25 | Low | β | Normal | Green |
| 26-50 | Medium | Important | Orange | |
| 51-75 | High | πΆ | Urgent | Dark Orange |
| 76-100 | Critical | π΄ | CRITICAL | Red |
cd project
# Test email notifications
python test_compliance_notification.py
# Test email only (basic test)
python notification.py
# Test Slack only
python slack_notification.py- Email Test: Check your
SMTP_RECEIVER_EMAILinbox - Slack Test: Check your configured Slack channel
- Full Test: Runs 4 different scenarios (low, medium, high, critical risk)
Notifications are automatically triggered in:
- Runs when user uploads a contract
- Triggered immediately after compliance analysis
- Sends both email and Slack (if configured)
- Runs when GDPR templates are updated
- Scheduled to run daily at midnight
- Uses different notification format (template updates, not failures)
from notification import send_compliance_failure_notification
from datetime import datetime
# Prepare data
notification_data = {
"document_type": "Data Processing Agreement",
"risk_score": 75,
"missing_clauses": ["Clause 1", "Clause 2"],
"compliance_risks": ["Risk 1", "Risk 2"],
"recommendations": ["Fix 1", "Fix 2"],
"timestamp": datetime.now().strftime("%Y-%m-%d %H:%M:%S")
}
# Send notification
send_compliance_failure_notification(notification_data)from slack_notification import send_compliance_failure_alert
from datetime import datetime
# Prepare data (same format as email)
notification_data = {
"document_type": "Joint Controller Agreement",
"risk_score": 55,
"missing_clauses": ["Clause A", "Clause B"],
"compliance_risks": ["Risk X", "Risk Y"],
"recommendations": ["Action 1", "Action 2"],
"timestamp": datetime.now().strftime("%Y-%m-%d %H:%M:%S")
}
# Send notification
send_compliance_failure_alert(notification_data)-
Check
.envcredentials- Verify
SMTP_SENDER_EMAILandSMTP_PASSWORD - Use Gmail App Password, not regular password
- Verify
-
Check Gmail settings
- Enable 2-factor authentication
- Generate App Password from Google Account settings
-
Test connection
python project/notification.py
-
Check webhook URL
- Verify
SLACK_WEBHOOK_URLin.env - Ensure URL starts with
https://hooks.slack.com/
- Verify
-
Test webhook
python project/slack_notification.py
-
Verify webhook is active
- Go to Slack App settings
- Check webhook is not disabled
-
Check main.py integration
- Ensure
notificationandslack_notificationare imported - Verify notification code is present after
compare_agreements
- Ensure
-
Check risk score parsing
- Verify
parse_comparison_resultfunction works - Check that risk_score > 0 for issues
- Verify
# Send to specific email
send_compliance_failure_notification(
report_data,
receiver="custom@example.com"
)In main.py, comment out the notification section:
# # Send notifications
# if risk_score > 0:
# notification.send_compliance_failure_notification(...)Modify main.py to send to multiple Slack channels:
# Send to multiple Slack channels
webhooks = [
"https://hooks.slack.com/services/TEAM1/...",
"https://hooks.slack.com/services/TEAM2/...",
]
for webhook in webhooks:
slack_notification.send_compliance_failure_alert(
notification_data,
webhook_url=webhook
)-
Test notifications before production
- Run
test_compliance_notification.py - Verify formatting looks good
- Run
-
Monitor notification delivery
- Check email delivery rates
- Monitor Slack channel activity
-
Keep credentials secure
- Never commit
.envto version control - Use environment variables in production
- Never commit
-
Set up notification filters
- Create email rules for compliance alerts
- Set up Slack channel notifications
-
Review notifications regularly
- Check for false positives
- Adjust risk scoring if needed
If you encounter issues:
- Check the troubleshooting section above
- Verify
.envconfiguration - Test individual components separately
- Check logs for error messages
β
Automatic notifications when compliance issues detected
β
Email AND Slack support
β
Detailed failure reports with missing clauses, risks, and recommendations
β
Risk-based categorization (Low, Medium, High, Critical)
β
Easy testing with test scripts
β
Customizable for your needs
Your compliance failures will never go unnoticed again! π