Short Message Service

From OpenEMR Project Wiki

Introduction

There are times when a practice may find it more convenient to send a text message to a patient instead of voice communication. Described below is one method for SMS generation.

The "Roll Your Own" method involves a paid service, Twilio.com, which will function within OpenEMR and which will send messages on a pre-set schedule. It will require a considerable amount of code modifications. The instructions and code changes are provided, courtesy of Fayyaz Kasmani of NetConnexions.

Twilio Setup Guide

  • BACKUP FIRST!!
  • Users just have to copy the files and folders provided, into the OpenEMR directory. Details below:
  • Files Modified: (replace the existing) /var/www/openemr/library/globals.inc.php /var/www/openemr/modules/sms_email/reminder/cron_sms_notification.php
  • New Files/Directories Added: /var/www/openemr/modules/sms_email/reminder/sendnotifications.php /var/www/openemr/modules/sms_email/reminder/twilio
  • SMS Body: This is now in the cron_sms_notifications.php file on line 141 and should be edited there as required.
  • Usage:
  • Placing files & Folders:
  • As soon as you copy the provided files and folders (and replace globals.inc.php & cron_sms_notification.php); Administration >> Globals >> Notifications will have 3 new fields: Twilio Account SID, Twilio Auth Token, Twilio From Name You will need a Twilio account with SMS credits in it (minimum $20 – they have very good rates). Twilio also has a sandbox feature for testing purposes. With your Twilio account will also come an SMS number which will be used to send SMS’s and the the recipient will receive your SMS’s from this number. (You can choose your number/location.) Also in your Twilio account will be the Account SID & the Auth Code. Fill in these details into the new fields you will see in Administration >> Globals >> Notifications and Save.

Sms1.jpg

  • Body of the SMS:
  • Next you need to set the message that will be received in the SMS. This is now in the cron_sms_notifications.php file on line 141 and should be edited there as required.
  • Setting a CRON for background auto-sending as per scheduled appointments:
  • Doing a manual run:
  • While you are testing the script, you may want to do a test-run of outgoing SMS’s instead of using CRON.
  • Set the SMS Notification Hours to 1
  • Make a test patient and use your own mobile/cell number in the Contact (use the number format: +CountrycodeAreacodeNumber (preceding + is important and there should be no spaces, hyphens or periods anywhere) ). Make sure you select ‘Yes’ for your test patient’s “Allow SMS” (in Demographics >> Choices).
  • Schedule an appointment for your test patient an hour away. Open the following URL: http://IP_NUMBER/openemr/modules/sms_email_reminder/cron_sms_notification.php (change IP_NUMBER in above command to IP Number of OpenEMR on which the twilio script is running).
  • If all’s OK, you should see something like what’s in the screenshot and you should receive the SMS(if your Twilio a/c has enough SMS credits).

Sms2.jpg

You can also log into your Twilio account and see the SMS Messages Log.

Sms3.jpg

  • Getting the SMS’s out:
  • Once all the above is in place, schedule appointments in OpenEMR as normal and 50hrs before the appointment(or whatever you’ve set for SMS Notification Hours), reminder SMS’s should be sent out as an automated background process and reflected in your Twilio SMS logs. Note: For your current and new patients, set their Mobile Phone numbers using the number format: +CountrycodeAreacodeNumber (preceding + is important and there should be no spaces, hyphens or periods anywhere) ). Make sure you select ‘Yes’ for your test patient’s “Allow SMS” (in Demographics >> Choices).

Code Modifications

Codes which be must changed or added can be found here. These codes have not been tested extensively and may not be stable.

Forum Discussion

See this thread regarding the topic.

Free and Segregated

If the above is too technically difficult for the reader, an email can very simply be converted to SMS without charge to the practice. This method does not operate within OpenEMR, therefore is not integrated. There is no mechanism to automate the process. Its main attraction is the lack of setup and charge. Refer to this Computer Hope tutorial.