Simplify test endpoint - only requires phone number parameter
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
cf9f1a6f68
commit
a1139e0f23
@ -1987,35 +1987,28 @@ async def import_contacts(
|
||||
@app.post("/api/test/whatsapp/send")
|
||||
async def test_whatsapp_send(
|
||||
phone: str,
|
||||
template_key: str = "wedding_invitation_by_vered",
|
||||
db: Session = Depends(get_db)
|
||||
):
|
||||
"""
|
||||
Test endpoint to send a WhatsApp message.
|
||||
Simple test endpoint to send a WhatsApp message with minimal parameters.
|
||||
Only requires phone number - useful for testing API connectivity.
|
||||
|
||||
Example:
|
||||
POST /api/test/whatsapp/send?phone=0504370045&template_key=wedding_invitation_by_vered
|
||||
POST /api/test/whatsapp/send?phone=0504370045
|
||||
"""
|
||||
try:
|
||||
logger.info(f"[TEST] Attempting to send WhatsApp to {phone} using template {template_key}")
|
||||
logger.info(f"[TEST] Attempting to send test WhatsApp to {phone}")
|
||||
|
||||
service = get_whatsapp_service(db)
|
||||
|
||||
# Test parameters
|
||||
# Send with only contact_name - minimal test
|
||||
params = {
|
||||
"contact_name": "דוד",
|
||||
"event_date": "17/05",
|
||||
"event_date_day": "17",
|
||||
"venue": "אולם הגן",
|
||||
"location": "ירושלים",
|
||||
"reception_time": "18:30",
|
||||
"ceremony_time": "19:00",
|
||||
"dinner_time": "20:00",
|
||||
"bride_name": "ורד",
|
||||
"groom_name": "דביר",
|
||||
"event_id": "test-event-id-12345"
|
||||
"contact_name": "Test"
|
||||
}
|
||||
|
||||
# Use wedding_invitation_by_vered template (only requires contact_name)
|
||||
template_key = "wedding_invitation_by_vered"
|
||||
|
||||
result = await service.send_by_template_key(
|
||||
template_key=template_key,
|
||||
to_phone=phone,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user