def send_sms_reminder(appointment): context_variables = { 'appointment': appointment, 'customer': appointment.customer, 'client': appointment.client, 'event': appointment.event } if appointment.venue.custom_reminder: context_variables['message'] = replace_script_variables(appointment.venue.reminder_sms, appointment) c = Context(context_variables) message = render_to_string('appointments/sms/custom_reminder.txt', c).replace('\n', '') elif appointment.customer.custom_reminder: context_variables['message'] = replace_script_variables(appointment.customer.reminder_sms, appointment) c = Context(context_variables) message = render_to_string('appointments/sms/custom_reminder.txt', c).replace('\n', '') else: c = Context(context_variables) message = render_to_string('appointments/sms/reminder.txt', c).replace('\n', '') to = appointment.client.phone.as_e164 sms_client = InfoBip() sms_client.send_sms(to, message)
def send_sms_birthday_greeting(client): if client.customer.birthday_greeting_active and client.customer.birthday_greeting_send_sms and client.phone: context_variables = { 'client': client, 'customer': client.customer, 'message': replace_client_script_variables(client.customer.birthday_greeting_sms, client) } c = Context(context_variables) message = render_to_string('users/sms/birthday_greeting.txt', c).replace('\n', '') to = client.phone.as_e164 sms_client = InfoBip() sms_client.send_sms(to, message) return True return False
def send_sms_birthday_greeting(client): if client.customer.birthday_greeting_active and client.customer.birthday_greeting_send_sms and client.phone: context_variables = { 'client': client, 'customer': client.customer, 'message': replace_client_script_variables( client.customer.birthday_greeting_sms, client) } c = Context(context_variables) message = render_to_string('users/sms/birthday_greeting.txt', c).replace('\n', '') to = client.phone.as_e164 sms_client = InfoBip() sms_client.send_sms(to, message) return True return False