The Chatbot's True Role
An AI chatbot cannot provide legal assistance. Its ultimate utility is as an intelligent triage system that:
- Provides general educational information
- Identifies the user's situation type
- Prepares users for attorney consultations
- Connects users to appropriate human resources
- Routes emergencies to rapid response networks
Attorney Connection Flow
When to Escalate
Escalation triggers when the user's inquiry crosses from general information to case-specific advice:
| General Information (Bot Handles) | Case-Specific (Escalate to Attorney) |
|---|---|
| "What is asylum?" | "Do I qualify for asylum?" |
| "How does a bond hearing work?" | "What are my chances of getting bond?" |
| "What are checkpoint rights?" | "I was stopped yesterday, what should I do?" |
| "What forms are needed for TPS?" | "Should I apply for TPS renewal now?" |
Escalation Response Template
ESCALATION_RESPONSE = """
I understand you're looking for guidance about your specific situation.
For questions like this, you need to speak with a licensed immigration attorney
who can review the details of your case.
**I can help you prepare for that consultation:**
1. Would you like me to create a document checklist for your situation?
2. Would you like to find legal aid organizations in your area?
3. Would you like information about what to expect in a consultation?
**Immediate Resources:**
- Legal Aid Directory: /resources/legal-documents/
- Emergency Hotline: 1-844-363-1423 (United We Dream)
---
This is general information, not legal advice.
"""
Consultation Preparation
Document Checklists
Help users gather necessary documents before attorney meetings:
DOCUMENT_CHECKLISTS = {
'asylum': [
"Passport (current and expired)",
"I-94 Arrival/Departure Record",
"Any notices from USCIS or immigration court",
"Evidence of persecution (news articles, police reports, photos)",
"Country condition reports",
"Medical records documenting harm",
"Witness statements (affidavits)",
"Timeline of events in your country"
],
'detention': [
"Alien Registration Number (A#)",
"Detention facility name and location",
"Date of detention",
"Any documents provided by ICE",
"Notice to Appear (if received)",
"Previous immigration history documents"
],
'tps': [
"Current TPS approval notice",
"Employment Authorization Document (EAD)",
"Proof of continuous residence",
"Proof of continuous physical presence",
"Criminal history (if any)",
"Tax returns (past 3 years)"
],
'general': [
"Government-issued ID",
"Passport and travel documents",
"All immigration documents received",
"Work authorization documents",
"Previous immigration applications",
"Court notices (if any)"
]
}
def generate_checklist(situation_type: str) -> str:
"""Generate document checklist for user's situation."""
docs = DOCUMENT_CHECKLISTS.get(situation_type, DOCUMENT_CHECKLISTS['general'])
response = "**Documents to gather before your consultation:**\n\n"
for doc in docs:
response += f"☐ {doc}\n"
response += "\n*Bring originals and copies if possible.*"
return response
Deadline Awareness
def check_deadlines(situation: str, context: dict) -> str:
"""Alert users to time-sensitive deadlines."""
DEADLINES = {
'nta_received': """
⚠️ **IMPORTANT DEADLINE**
If you received a Notice to Appear (NTA), you may have limited time
to respond. Contact an attorney IMMEDIATELY.
Some deadlines are as short as 10 days.
""",
'asylum_one_year': """
⚠️ **ONE-YEAR FILING DEADLINE**
Asylum applications generally must be filed within ONE YEAR of
arrival in the United States. Exceptions exist but are limited.
Check your I-94 for your arrival date.
""",
'tps_renewal': """
⚠️ **TPS RENEWAL DEADLINE**
TPS renewal periods are time-limited. Missing the window can
affect your status and work authorization.
Check current deadlines at uscis.gov
"""
}
return DEADLINES.get(situation, "")
Legal Aid Integration
Directory Lookup
Connect users to local legal aid organizations:
import json
from typing import List, Dict
def find_legal_aid(state: str, case_type: str = None) -> List[Dict]:
"""Find legal aid organizations by state and case type."""
# Load legal aid directory
with open('_data/legal-aid.json') as f:
directory = json.load(f)
results = []
for org in directory['organizations']:
if org['state'] == state or org['national']:
if case_type is None or case_type in org['services']:
results.append({
'name': org['name'],
'phone': org['phone'],
'website': org['website'],
'services': org['services'],
'languages': org['languages']
})
return results[:5] # Return top 5 matches
Response Format
def format_legal_aid_response(organizations: List[Dict], state: str) -> str:
"""Format legal aid results for user."""
response = f"**Legal Aid Organizations in {state}:**\n\n"
for org in organizations:
response += f"**{org['name']}**\n"
response += f"📞 {org['phone']}\n"
response += f"🌐 {org['website']}\n"
response += f"Services: {', '.join(org['services'])}\n"
response += f"Languages: {', '.join(org['languages'])}\n\n"
response += "For a complete directory, visit: /resources/legal-documents/\n"
return response
Practice Management Integration
Clio / MyCase API Integration
For organizations using legal practice management software:
# Example: Secure intake summary transmission
# NOTE: Requires explicit user consent and secure implementation
async def create_intake_summary(
conversation: List[Dict],
user_consent: bool
) -> Dict:
"""Generate anonymized intake summary for attorney review."""
if not user_consent:
raise PermissionError("User consent required for intake transfer")
# Extract key information (NOT sensitive case details)
summary = {
'timestamp': datetime.now().isoformat(),
'situation_type': classify_situation(conversation),
'urgency_level': assess_urgency(conversation),
'language_preference': detect_language(conversation),
'document_checklist_provided': True,
'topics_discussed': extract_topics(conversation),
# DO NOT include: specific facts, immigration status, personal details
}
return summary
API Security Requirements
# Integration security requirements
api_integration:
authentication: OAuth 2.0
encryption: TLS 1.3
data_minimization: true
audit_logging: true
retention_period: 0 # No retention after transfer
prohibited_data:
- immigration_status
- country_of_origin
- arrival_date
- specific_case_facts
- personal_identifiers
allowed_data:
- situation_category
- urgency_level
- language_preference
- topics_of_interest
- consent_timestamp
Rapid Response Network Integration
Emergency Routing
For crisis situations, connect users to local rapid response networks:
RAPID_RESPONSE_NETWORKS = {
'CA': {
'los_angeles': {
'name': 'LA Rapid Response Network',
'hotline': '1-844-XXX-XXXX',
'coverage': 'Los Angeles County'
},
'bay_area': {
'name': 'Bay Area Immigrant Rights Coalition',
'hotline': '1-510-XXX-XXXX',
'coverage': 'Alameda, Contra Costa, San Francisco'
}
},
'TX': {
'houston': {
'name': 'FIEL Houston',
'hotline': '1-713-XXX-XXXX',
'coverage': 'Harris County'
}
},
# ... more networks
}
def get_rapid_response(state: str, location: str = None) -> Dict:
"""Get local rapid response network information."""
state_networks = RAPID_RESPONSE_NETWORKS.get(state, {})
if location:
# Try to match specific location
for key, network in state_networks.items():
if location.lower() in key or location.lower() in network.get('coverage', '').lower():
return network
# Return first available in state
if state_networks:
return list(state_networks.values())[0]
# Fallback to national hotline
return {
'name': 'United We Dream',
'hotline': '1-844-363-1423',
'coverage': 'National'
}
Geolocation-Based Routing (with consent)
def route_to_local_resources(
user_location: Dict,
situation: str,
consent_given: bool
) -> str:
"""Route to local resources based on location (if consent given)."""
if not consent_given:
return NATIONAL_RESOURCES_ONLY
state = user_location.get('state')
county = user_location.get('county')
resources = []
# Get rapid response network
rrn = get_rapid_response(state, county)
resources.append(f"**{rrn['name']}**: {rrn['hotline']}")
# Get local legal aid
legal_aid = find_legal_aid(state)
for org in legal_aid[:2]:
resources.append(f"**{org['name']}**: {org['phone']}")
return format_local_resources(resources, state)
Detention Facility Integration
ICE Locator Connection
Help families locate detained individuals:
DETENTION_RESOURCES = {
'ice_locator': {
'url': 'https://locator.ice.gov/odls/#/index',
'description': 'Official ICE Online Detainee Locator System',
'required_info': ['Full legal name', 'A-Number OR Country of birth + Date of birth']
},
'freedom_for_immigrants': {
'url': 'https://www.freedomforimmigrants.org/detention-map',
'description': 'Interactive map of detention facilities',
'hotline': '1-559-XXX-XXXX'
}
}
def provide_detention_search_guidance() -> str:
"""Guide users through detention search process."""
return """
**To locate a detained family member:**
1. **ICE Online Detainee Locator System**
🌐 locator.ice.gov
You'll need:
- Full legal name, OR
- A-Number (9-digit number starting with A), OR
- Country of birth + Date of birth
2. **If ICE locator doesn't show results:**
- The person may have been recently detained (updates take 24-48 hours)
- They may be in transit between facilities
- Contact the ICE ERO Field Office for your area
3. **Additional Resources:**
- Freedom for Immigrants Helpline: [number]
- Detention facility map: /resources/detention-facilities/
**Important:** Keep records of all communication attempts.
---
This is general information. For specific case help, contact a legal aid organization.
"""
Court Information Integration
EOIR Case Status
def provide_court_lookup_guidance() -> str:
"""Guide users to check immigration court case status."""
return """
**Check Immigration Court Case Status:**
📞 **By Phone:** 1-800-898-7180
- Available 24/7
- You'll need your A-Number (9-digit number)
- Hearing dates and times are announced
🌐 **Online:** https://portal.eoir.justice.gov/
- View case information
- See scheduled hearings
- Check case outcomes
**What you can learn:**
- Next hearing date and time
- Court location
- Case status
**Note:** Court dates can change. Check regularly before your hearing.
---
This is general information, not legal advice.
"""
Safe Information Collection
What the Chatbot Should NOT Collect
NEVER ask for or store:
- Immigration status
- A-Number
- Country of origin
- Date of entry
- Current address
- Place of employment
- Names of family members
- Specific facts of the case
What Can Be Safely Collected (with consent)
SAFE_INTAKE_FIELDS = {
'situation_category': {
'options': ['detention', 'workplace', 'traffic_stop', 'court', 'general'],
'purpose': 'Route to appropriate resources'
},
'preferred_language': {
'options': ['en', 'es', 'zh', 'vi', 'other'],
'purpose': 'Language-appropriate referrals'
},
'state': {
'type': 'select',
'purpose': 'Geographic resource matching'
},
'urgency': {
'options': ['emergency_now', 'urgent_24h', 'need_info', 'planning_ahead'],
'purpose': 'Appropriate response prioritization'
}
}
Consent Language
<div class="consent-notice">
<h3>Before connecting you to resources:</h3>
<p>I'd like to ask a few questions to find the right help for you.
I will NOT ask about your immigration status or case details.</p>
<p><strong>The only information I'll use:</strong></p>
<ul>
<li>What type of situation you're facing (workplace, detention, etc.)</li>
<li>What state you're in (to find local resources)</li>
<li>Your preferred language</li>
<li>How urgent your situation is</li>
</ul>
<p>This helps me connect you to the right legal aid organization.</p>
<p><em>None of this information is stored after our conversation ends.</em></p>
<button class="consent-button">I understand, continue</button>
<button class="skip-button">Skip, show national resources only</button>
</div>
Next Steps
- Configure privacy architecture - Zero-retention logging
- Follow implementation roadmap - Deployment phases
- Review Legal Aid Directory - Current organization listings