Adding variables to SMS reminder message

(Tony) #1

I am using Twilio for patient SMS reminders. The SMS message is established in cron_sms_notifications.php:

$db_email_msg[‘message’] = “Reminder message goes here.”;

I wouldn’t be surprised if this is a trivial thing, but I don’t understand how to go about adding variables that define the appointment time, date, etc. For example, if I wanted to have the SMS message read:

“This is a reminder for your appt with “provider name” on “date of appt” at “time of appt”.”

What would I use to define those variables?

Thank you.

(Stephen Waite) #2

usually an sqlstatement is executed to bring in database values, like the calls in modules/sms_email_reminder/cron_functions.php

(Tony) #3

Thanks Stephen.

I’ve been banging my head against the wall trying to understand how to figure this out. I found that I can put $app_date to get the SMS message to add the appointment date in a “2019-03-02 17:30:00” format. But for the life of me I can’t figure out how to change the format to something more friendly like “Saturday, March 3 at 5:30”.

It would be nice if I could just use the “$db_email_msg[‘message’] = cron_setmessage($prow, $db_emai_msg);” line that is the default in cron_sms_notification.php. However this seems to get the message from the BatchCom SMS Notification settings, and I only get errors when I try to change it.

If anyone can give some pointers I would appreciate it.

(Tony) #4

Learned a little php and ended up adding the following to cron_sms_notification.php:

$smsdate = date(“l, F j”,strtotime($app_date));
$smstime = date(“g:ia”,strtotime($app_date));

That allowed me to use the appointment date and appointment time separately formatted as I wanted them in the body of the SMS message.