Do you use or administer OpenEMR? Take the General Satisfaction Survey to help improve the product

Twilio Integration Problem

I am trying to integrate Twilio to send SMS notifications using this guide
https://www.open-emr.org/wiki/index.php/Short_Message_Service.

I have done all required changes and when I visit http://x.x.x.x/openemr/modules/sms_email_reminder/cron_sms_notification.php,
I receive the following error
Error in SMS authorization! (ERR: 108, Invalid or missing api_id)

Checking further, I can see the following at the end of /var/log/apache2/error.log when I visit the link

[Wed Dec 09 11:20:51.317933 2020] [php7:notice] [pid 3841] [client x.x.x.x:57122] PHP Notice: Undefined variable: argc in /var/www/openemr/modules/sms_email_reminder/cron_sms_notification.php on line 25 [Wed Dec 09 11:20:51.318489 2020] [php7:warn] [pid 3841] [client x.x.x.x:57122] PHP Warning: mysqli_query() expects at least 2 parameters, 1 given in /var/www/openemr/modules/sms_email_reminder/cron_sms_notification.php on line 41 [Wed Dec 09 11:20:51.318585 2020] [php7:warn] [pid 3841] [client x.x.x.x:57122] PHP Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, null given in /var/www/openemr/modules/sms_email_reminder/cron_sms_notification.php on line 42 [Wed Dec 09 11:20:51.318672 2020] [php7:notice] [pid 3841] [client x.x.x.x:57122] PHP Notice: Undefined variable: AccountSid in /var/www/openemr/modules/sms_email_reminder/cron_sms_notification.php on line 50 [Wed Dec 09 11:20:51.319012 2020] [php7:notice] [pid 3841] [client x.x.x.x:57122] PHP Notice: Undefined variable: AccountSid in /var/www/openemr/modules/sms_email_reminder/cron_sms_notification.php on line 98

I configured Twilio Account Sid, Twilio Auth Token and Twilio From name as per the guide and I can confirm that my Twilio account has enough balance.

OpenEMR Version
Version Number: v5.0.1 (6)

Browser:
Chrome & FireFox

Operating System
Mac OSX

Hi @Adam,

You have to create your account into Twilio to get access api_id or token then it will be going to work.

Thanks,
Nilesh

Thank you @Nilesh_Hake. I already did and filled relevant field as per the guide. Here is a screenshot for the configurations.

That cron should not be called like that. Look at cron source!
Go check out how my fax/sms module does this.


specifically:

Thank you Jerry, I was doing the manual run test as per the guide https://www.open-emr.org/wiki/index.php/Short_Message_Service:

  • 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).

I am not sure what action actually should I do. I am not a programmer myself and I will appreciate letting me know how to troubleshoot this.

Adam,

Did you get this to work?

Jeff

The Twilio SMS with my fax/sms module works pretty well once setup for notifications with manual and automated runs. You can test run available notifications before sending to patients.
I’m guessing the problem is there is not an install for 5.0.1 but i’d be willing to bet it would run on v5.0.1 with some command line magic for a manual install or I could allow install for v5.0.1 from composer with a minor change on the repository.
I know of several practices, including my practice, that uses in this way.

I am afraid not.

Thank you.

I contacted Twilio support and this was their response

Blockquote > looking into the code I can see that the SDK version which they are using is way old:

hxxps://github.com/bradymiller/openemr/blob/twilio_1/modules/sms_email_reminder/twilio/Services/Twilio.php#L25
modules/sms_email_reminder/twilio/Services/Twilio.php:25

const USER_AGENT = ‘twilio-php/3.10.0’;

The latest version is 6.15.0

Reference:

hxxps://github.com/twilio/twilio-php
twilio/twilio-php
A PHP library for communicating with the Twilio REST API and generating TwiML.
hxxps://www.twilio.com/docs/libraries/php

Also the API version:hxxps://github.com/bradymiller/openemr/blob/twilio_1/modules/sms_email_reminder/twilio/Services/Twilio.php#L31
modules/sms_email_reminder/twilio/Services/Twilio.php:31

protected $versions = array(‘2008-08-01’, ‘2010-04-01’);

Latest is API version is 2010-04-01.

I hope this information helps.

This was their answer to:

Can you please confirm that API url mentioned here and other Twilio parameters are correct
github.com/bradymiller/openemr/blob/twilio_1/modules/sms_email_reminder/twilio/Services/Twilio.php

Any help out there!

Thank you.

Did you ever get this to work? im currently trying to get this going and im getting this error as well

I never did get this to work.

Jeff

thank you for your reply, are you currently using any other solution for sms?