Skip to main content

Introduction

All Lovi notification endpoints support scheduling for future delivery. This feature allows you to send notifications at optimal times considering recipient timezones and business hours.

πŸ“… Scheduling Parameters

Both WhatsApp and Voice notifications support the following scheduling parameters:

Parameters

ParameterTypeRequiredDescriptionExample
datetime_sendingDateTimeNoScheduled date/time in ISO 8601 format"2024-12-25T10:30:00"
timezoneStringNoTimezone for the scheduled time"Europe/Madrid"
Default Behavior: If datetime_sending is not provided, the notification is sent immediately.

πŸ• Datetime Format

Supported ISO 8601 Formats

{
  "datetime_sending": "2024-12-25T10:30:00",
  "timezone": "Europe/Madrid"
}
Alternative formats:
"2024-12-25T10:30:00"
"2024-12-25T10:30:00.000"
"2024-12-25T10:30:00Z"
"2024-12-25T10:30:00+01:00"

Important Notes

  • Future Date Required: The datetime must be in the future
  • ISO 8601 Strict: Use standard ISO 8601 format
  • Timezone Recommended: Always specify timezone for scheduled messages
  • UTC Default: If timezone is omitted, UTC is used

🌍 Supported Timezones

Common Business Timezones

Region/CountryTimezone CodeDescription
SpainEurope/MadridCentral European Time
MexicoAmerica/Mexico_CityCentral Standard Time
ArgentinaAmerica/Argentina/Buenos_AiresArgentina Time
ColombiaAmerica/BogotaColombia Time
ChileAmerica/SantiagoChile Standard Time
PeruAmerica/LimaPeru Time
EcuadorAmerica/GuayaquilEcuador Time
VenezuelaAmerica/CaracasVenezuela Time
United StatesAmerica/New_YorkEastern Standard Time
United StatesAmerica/ChicagoCentral Standard Time
United StatesAmerica/DenverMountain Standard Time
United StatesAmerica/Los_AngelesPacific Standard Time
UTCUTCCoordinated Universal

European Timezones

CountryTimezone CodeDescription
United KingdomEurope/LondonGreenwich Mean Time
FranceEurope/ParisCentral European Time
GermanyEurope/BerlinCentral European Time
ItalyEurope/RomeCentral European Time
NetherlandsEurope/AmsterdamCentral European Time
PortugalEurope/LisbonWestern European Time

πŸ“‹ Examples

WhatsApp Scheduled Notification

Immediate sending (no scheduling):
{
  "contact": {
    "number": "34666033135",
    "name": "Ana GarcΓ­a"
  },
  "language_template": "es_ES",
  "name_template": "promocion_navidad",
  "recipient_id": "34666033135",
  "notification_type": "marketing",
  "campaign_name": "Christmas Campaign"
}
Scheduled for specific time:
{
  "contact": {
    "number": "34666033135",
    "name": "Ana GarcΓ­a"
  },
  "language_template": "es_ES",
  "name_template": "promocion_navidad",
  "recipient_id": "34666033135",
  "notification_type": "marketing",
  "campaign_name": "Christmas Campaign",
  "datetime_sending": "2024-12-24T09:00:00",
  "timezone": "Europe/Madrid"
}

Voice Scheduled Notification

{
  "contact": {
    "number": "34666033135",
    "first_name": "MarΓ­a",
    "last_name": "GonzΓ‘lez"
  },
  "recipient_id": "34911670470",
  "agent_id": "uuid-agente-voz",
  "notification_type": "marketing",
  "campaign_name": "Voice Campaign",
  "datetime_sending": "2024-12-26T10:00:00",
  "timezone": "Europe/Madrid"
}

Flat Structure with Scheduling (unflatten=true)

{
  "contact.number": "34666033135",
  "contact.name": "Ana GarcΓ­a",
  "language_template": "es_ES",
  "name_template": "promocion_navidad",
  "recipient_id": "34666033135",
  "notification_type": "marketing",
  "campaign_name": "Christmas Campaign",
  "datetime_sending": "2024-12-24T09:00:00",
  "timezone": "Europe/Madrid"
}

βš™οΈ Validation Rules

Date Validation

  • βœ… Future dates only: Must be later than current time
  • βœ… Maximum advance: Up to 1 year in advance
  • βœ… Format strict: Must follow ISO 8601
  • ❌ Past dates: Will be rejected
  • ❌ Invalid format: Non-ISO dates rejected

Timezone Validation

  • βœ… Valid IANA codes: Use standard timezone database
  • βœ… Case sensitive: Exact format required
  • ❌ Abbreviations: Don’t use CET, EST, etc.
  • ❌ Invalid codes: Unknown timezones rejected

Examples of Valid/Invalid

βœ… Valid:
{
  "datetime_sending": "2024-12-25T14:30:00",
  "timezone": "America/Mexico_City"
}
❌ Invalid datetime:
{
  "datetime_sending": "12/25/2024 2:30 PM",  // Wrong format
  "timezone": "Europe/Madrid"
}
❌ Invalid timezone:
{
  "datetime_sending": "2024-12-25T14:30:00",
  "timezone": "CET"  // Use Europe/Madrid instead
}

πŸš€ Best Practices

Optimal Timing

WhatsApp Messages:
  • Business hours: 9:00 AM - 6:00 PM local time
  • Avoid early/late: Not before 8:00 AM or after 9:00 PM
  • Weekend consideration: Adjust for weekend preferences
  • Holiday awareness: Check local holidays
Voice Calls:
  • Business hours only: 9:00 AM - 5:00 PM local time
  • Workdays preferred: Monday through Friday
  • Lunch hours: Avoid 12:00 PM - 2:00 PM
  • Cultural sensitivity: Respect local customs

Timezone Strategy

  1. Store user timezones: Save preferred timezone per contact
  2. Local time display: Show times in user’s local timezone
  3. Business hour logic: Calculate optimal sending times
  4. Daylight saving: IANA codes handle DST automatically

Scheduling Workflow


πŸ“Š Response Examples

Successful Scheduling

{
  "success": true,
  "message": "Notification scheduled successfully",
  "notification_id": "uuid-notification-123",
  "scheduled_time": "2024-12-25T10:30:00Z",
  "local_time": "2024-12-25T11:30:00+01:00",
  "timezone": "Europe/Madrid"
}

Immediate Sending

{
  "success": true,
  "message": "Notification queued for immediate sending",
  "notification_id": "uuid-notification-456",
  "queued_at": "2024-12-20T15:45:30Z"
}

⚠️ Common Errors

Past Date Error

{
  "error": "validation_failed",
  "message": "Scheduled time must be in the future",
  "details": {
    "field": "datetime_sending",
    "provided": "2024-12-20T10:00:00",
    "current_time": "2024-12-20T15:30:00Z"
  }
}

Invalid Timezone Error

{
  "error": "validation_failed",
  "message": "Invalid timezone specified",
  "details": {
    "field": "timezone",
    "provided": "CET",
    "suggestion": "Use IANA timezone codes like 'Europe/Madrid'"
  }
}

Invalid Format Error

{
  "error": "validation_failed",
  "message": "Invalid datetime format",
  "details": {
    "field": "datetime_sending",
    "provided": "25-12-2024 10:30",
    "expected_format": "ISO 8601 (YYYY-MM-DDTHH:MM:SS)"
  }
}

πŸ› οΈ Development Tips

Testing Scheduling

  1. Use near future: Test with times 5-10 minutes ahead
  2. Timezone testing: Test different timezone scenarios
  3. Edge cases: Test daylight saving transitions
  4. Error handling: Test with invalid dates/timezones

Production Considerations

  • Buffer time: Add 2-3 minutes buffer for processing
  • Monitoring: Monitor scheduled vs actual send times
  • Retry logic: Handle temporary failures gracefully
  • Logs: Log scheduling details for debugging

Timezone Resources

  • IANA Database: Official timezone database
  • Online converter: Use tools to verify timezone codes
  • Documentation: Keep timezone reference for developers