- Test panchangam accuracy with different coordinates
- Validate message formatting and template parameters
- Debug without touching production webhooks
- Test with coordinates that have no user in the database
Overview
All generated messages are saved tologs/generated_whatsapp_messages/ as JSON files containing:
- Complete panchangam data
- Template parameters (42 for WhatsApp templates)
- Formatted message text
- User/coordinate and template selection info
Message generation routes
1. Generate message for user
Endpoint:GET /test/whatsapp/generate/<phone_number>
Generates a panchangam message for an existing user and saves it to a file.
Requirements: User must exist with latitude, longitude, and timezone set, and an active subscription.
status, file_path, filename, template_name, user_info, and formatted_message_preview. Errors: “User not found” or “User … missing location data” with details.
2. Generate message from coordinates
Endpoint:POST /test/whatsapp/generate-coords
Generates a panchangam from coordinates without requiring a user in the database.
Request body:
| Field | Type | Required | Description |
|---|---|---|---|
| latitude | float | Yes | -90 to 90 |
| longitude | float | Yes | -180 to 180 |
| timezone | string | Yes | IANA timezone (e.g. America/Los_Angeles) |
| date | string | No | YYYY-MM-DD (default: current date in timezone) |
| country_code | string | No | ”1” for US (dailymessage template), else panchangam_global |
status, coordinates, file_path, city_info, template_name, and formatted_message_preview. Errors: missing fields, invalid coordinates/date/timezone.
Helper routes
- GET /test/whatsapp/users — List active users with phone and location data.
- GET /test/whatsapp/info — Info about WhatsApp message types, templates, and test endpoints.
- GET /test/country-templates — Test country-based template selection.
Output files
- User-based:
panchangam_{phone_number}_{YYYYMMDD_HHMMSS}.json - Coordinate-based:
panchangam_coords_{lat}_{lon}_{YYYYMMDD_HHMMSS}.json(dots/neg replaced for filename safety)
generated_at, user_info or coordinates, city_info, template_name, template_parameters, panchangam_data, and formatted_message.
Examples
Mumbai:GET /test/whatsapp/users, then GET /test/whatsapp/generate/<phone_number>.
Template selection
- US (country_code = “1”):
dailymessage(utility) - Others:
panchangam_global(marketing)
Troubleshooting
- User not found — Check user exists and phone format.
- Missing location data — Use the coordinate-based endpoint instead.
- Invalid timezone — Use IANA names (e.g. America/Los_Angeles, Asia/Kolkata).
- Invalid date — Use YYYY-MM-DD.
- Files not appearing — Ensure
logs/generated_whatsapp_messages/exists and check app logs.
