Twilio Notifications Driver


#1

While I appreciate the native SMS support, the 10 messages per day limit is becoming a problem. I was inspiring by @ogiewon's Pushover driver and decided to create one for Twilio.

If you haven't heard of Twilio, you have most likely been a recipient of one of their notifications. SmartThings uses them for SMS communications and I don't know for sure, but I suspect Hubitat may use them as well. They are the communications vehicle behind many of the SMS messages you receive from financial institutions and other companies and they offer voice and push type services as well.

I have experience integrating with them at work so setting up a driver was pretty straight forward. They offer a pay as you go cost model which is very cheap. At the time of this posting it will cost you around $1 per month for your own dedicated phone number and $0.075 per SMS message. So for around $2 per month you can receive over 1300 SMS messages. They have global support too!

To utilize this driver:

  1. Sign up for a Twilio account
  2. Fund the account via credit card or PayPal - $20 minimum unfortunately
  3. Purchase a phone number. They have agreements with carriers throughout the world so you can likely get a phone number in your country and area code.
  4. Capture your account's SID and Auth Token:
  5. Add the driver code to your HE hub.
  6. Create a new virtual device and set the type to Twilio Device.
  7. Enter the Twilio API Credentials into the Hubitat driver:
  8. Select your Twilio Phone Number in the driver and set your phone number. The phone number needs to be entered in E.164 format similar to how you have entered your phone number into Hubitat.

Once this is setup, you can select this new device in Rule Machine for notifications. The messages are logged as events too!

The driver can be found here:


Community Device Drivers (FKA Compatible Devices Wiki)
Sending SMS message in UK
Hubitat safety monitor - notifications
IFTTT Notifications Driver
Paid Feature - More Texts Daily
SMS Phase out
Send Text Limititation
#2

If there was a way to send an email notification, it would be easy and free to send SMS via email gateways - at least here in the US (cant speak globally) carriers all support this AFAIK

I can email myphonenumber@vtext.com on Verizon and it is sent as SMS ...


#3

Twilio doesn't provide email notifications. I don't know of a web service to send email notifications. Maybe Google has one but that would require a different driver.

The reason companies like Twilio exist is because email to SMS gateways aren't supported globally and I have had hit or miss success on delivery of those. Twilio guarantees delivery since the messages are delivered directly to the carriers.


#4

What I was thinking is if the hub had an MTA it could send the email directly to an email address and therefore SMS via the gateway... dont need a webservice for that ... simple postfix/sendmail/whatever

I know why the exist, but was just thinking of an alternative (free and if done on the hub via MTA LOCAL) way of achieving the same result


#5

Email MTA driver could work, just have to work out the details for sending to various SMTP providers. Usually your ISP provides one, or if you have a gmail account it would be possible.

I don't know of any technical limits we have that prevent a driver from working. Just time and priority. I've wanted an email send method for awhile but haven't heard of the demand from users until now.

Ahh, free time. Where are you... :slight_smile:


#6

Oh and BTW nice job on the twilio driver. I will have to check it out.


#7

Excellent work on this! We also use Twilio at work for customized notifications for users on an Enterprise level. They are rock solid with this.

On another note, I've integrated with Sfax to receive all my notifications via fax machine. If anyone wants this, I'm happy to share!


#8

Wouldn't IFTTT satisfy this requirement? I've used Gmail with applets in the past and it was reasonably fast.


#9

Could do -- so could MQTT and a host of other things ... but for something as base as email, I would not want to use IFTTT (I dont use it at all) or other services ... using a hammer to kill a gnat :slight_smile:

If all you have is a hammer everything does look like a nail... or at least you have to treat it as such


#10

Not sure I concur. IFTTT definitely is not a precision tool, but then neither is email. For me, once I'm forced to use any kind of cloud service, I personally don't care how many servers it has to hop to, as long as all of them are reasonably fast and reliable. IFTTT doesn't hold that track record for everything, but some connections have certainly never failed me or slowed significantly.

I consider services like IFTTT, Stringify, Yonomi and Gideon to be more like a multi-tool. You don't hammer away at a screw, you flip up the screwdriver and use it for what it was built to do. :wink:


#11

I think we can agree to disagree with IFTTT ... its caused me too many issues, or in your example, stripped too many screwheads for me to revisit any time soon


#12

Fair enough. Look forward to another great app/driver for Hubitat.


#13

Would it possible to use Twilio to send a text to Hubitat that would trigger a rule in rule machine?


#14

Rules don’t have endpoints, an app does/can though. An app could create an event that a rule listens to. So very clunky.

Adding @chuck.schwer for thoughts since he had asked about this driver.


#15

Use IFTTT as the trigger to turn on a virtual switch and create a rule truth.


#16

IFTTT could
Probably be cobbled together but I’ve had less than stellar results using that.

The holly grail for me would be to have a chatbot that surfaces all my notifications and that I can chat back to trigger things. Hopefully in the future the bot would gain some intelligence and surface patterns, suggesting rules for them. That’s a ways off though.


#17

You’re describing IFTTT with other platforms or Hubitat? I’ve had incredibly slow IFTTT performance with some manufacturers integrations, but the triggers and actions with Hubitat all seem to be around 8 sec, which isn’t fast, but fast for IFTTT.


#18

Other platforms, I haven’t tried it with Hubitat.


#19

Works better than expected!


#20

Yeah, I'm thinking this would be the way to do it. write an App that would provide an endpoint and then point twilio to that endpoint. From there you could trigger an event or control a device. I'm not sure you would want to write a rule to be triggered, But since you are already writing an App you would just do what you need to do outside of Rule Machine.