[No Longer Supported] Twilio Notifications Driver - Supports SMS and Voice Calls

Thank you for all the hard work on this. I have SMS working NP and I can do directly voice in the child device driver, but when I use rules machine, it insists on passing volume which seem to foul everything up. Note the 50 it passes below. "Rules machine Twilio test,,, 50". I am using the most current version of the container and Child (roughly 3 months old)

Any help would be appreciated

2022-03-05 05:51:16.020 pm errorgroovy.lang.MissingMethodException: No signature of method: user_driver_mlritchie_Twilio_Device_773.speak() is applicable for argument types: (java.lang.String, java.lang.Long) values: [Rules machine Twilio test,,, 50] Possible solutions: speak(java.lang.Object), sleep(long), every(), grep(), inspect(),

Sorry about that. Looked at the HE Documentation and see there are two optional parameters which I didn't account for in the driver. I have uploaded v1.3 to GitHub and HPM which will fix this issue. Volume isn't applicable for this so basically defaulted it to null and not using it.

1 Like

Thank you for the quick fix over the weekend! Only time I can work on this stuff. You Rock! Works Perfectly.

1 Like

@ritchierich

I would like to make a request if possible. Since Twilio is forced to make changes and all these new rules, I have switched to a toll free number as is bypasses a lot of the issues. However there are some requirements, one in particular. Each massage must state the business its being sent from, (How I reference it on their side) and I will be using my number with friends and family so we all use the same number.

But are you able to on the Container side made a field that we can enter in text, that is then added to the beginning of every text that is sent through. (With a return added after for new line)

This would allow me to easy meet the rules set forth by the carriers. All the other stuff I can handle differently if they accept my method of Oot-In and Opt-Out. (Which twilio believes should work) Its just the header that has to be there for every message to be compliant. (Not a separate message but part of the message)

Default Header (optional): ___________________

And then I would say:
Default Header (optional): Albert's Hubitat___________

And my rule or test text would be:
Device Notification: This is a test______

And the message that I would receive is:
Albert's Hubitat
This is a test

I hope this is something that can be done. Else I have to remember to add this to every text notification along with my friends and family and missing it could cause me to run into issues and fees.

I am still using a local number and everything seems to continue working. I don’t have an 800 number to test with. Do you have any links to the document requirements for what you are requesting? Curious if the API is different in Twilio, etc.

so as far as the driver and the way it works its the same for local and toll no difference, so it can be tested with local.

Also local will still work without anything being done (For now), however the carriers are enforcing new rules (Should have got email from twilio about requirements for local numbers.) If that is not done, the you risk being blocked by carriers and increases in fess from carriers. The increase already affected me, i was being charged for by carrier more than twilio was charging. (Carrier bills you twilio number)

Toll Free numbers avoid alot of the compliance and hoops to jump through, but have their own set of rules.

I'm not sure your issue with Twilio.

I use Twilio for text warnings. I've read a number of Twilio emails and finally just ignore them.
I've had Twilio since Hubitat stopped their service (a few years). I've never had an issue. No changes and I just tested it minutes ago and all is working.

Yes it will continue until the new rules are enforced. Twilio thought that were would be un affected due to the low volume, but new rules have cleared things up and EVERYONE must comply. I have been back and for with them now for the last month and as of the 17th this month they now have the steps for local numbers, but I found a loop home with the toll free numbers and moved to that.

Yes my number works, and will work until rules are enforced, So I got the toll free number as its much easier and cheaper in the end if the approval goes through.

This is not a twilio issue, its a carrier issue with the new rules going into effect. but since opur numbers are through twilio they have to be compliant or we are charged more and risk of being blocked by carriers.

The part I am asking for is very small and should be easy to implements as an options field. this would make it so I could be compliant with the new changes.

This is not for local numbers, but could still be used if wanted as it would have zero affect on local numbers other than always have a header if needed. Toll Free numbers are being required to have this. As the Carriers will read the first few line to make sure it matches what was filed. If its missing I risk being blocked, and additional fees.

@ritchierich

Nevermid if you dont want to or have time, I figured out how to break the code down and edit it so I could make a field and edit it and auto add.

(First time really playing with Grovvy)

Incase anyone else needs it, Here are the lines I added / edited: (Twilio Container)




After This (About line 39):

	input("isDebugEnabled", "bool", title: "Enable debug logging?", defaultValue: false, required: false)

Added This:

    input("textheader", "text", title: "Text Notification Header (Optional):", description: "This will add the following text to the beginning of every text notification.")




After this (About line 128) :

def sendNotification(toNumber, message, deviceID) {
    def toNumberList = toNumber.toString().split(",");     
    for (int i = 0; i < toNumberList.size(); i++) {
        toNumber = toNumberList[i].trim()

Added This:

        if (textheader) { 
            textheader += "\r\n"
            }



Then Editd this (About line 138):

    def postBody = [
        From: "${fromNumber}",
        To: "${toNumber}",
        Body: "${message}"
    ]

to this:

        def postBody = [
            From: "${fromNumber}",
            To: "${toNumber}",
            Body: "${textheader}${message}"
        ]



1 Like

@albertjmulder I have looked at your code changes and also did a little research and not seeing anything on Twilio's website about "each message must state the business its being sent from". Where did you hear about this requirement? Do you have any links to documentation about this requirement?

I am happy to modify my driver code but I want to read about the new API requirements first.

So this only effects toll free numbers, local 10 digit numbers this is not needed. I switched to the toll free number as it bypasses alot of the new hoops to jump through to get registered.

Sole Proprietor A2P 10DLC Registration Launches on April 17, 2023, This is a new requirement that carriers are forcing. There are additional fees and such with this new setup. If you do not get setup then you risk additional fees and being blocked by carriers (I was already getting hit with additional fees)

After going back and for trying to get it setup, I got word from a rep that if I was to switch over to a toll free number then they are already considered A2P compliant, however there are additional requirements, but the process is much simpler.

Requirement #1: I have to have proof that the number Opt-In to receive the messages, was told a signed document is good enough and would need to be public for the carriers to see, google drive folder was fine to place there.

Requirement #2: Must send them an opt-in message after getting document stating what they signed up to and how to opt-out

Requirement #3: Opt-Out Method, this I found out there was a standard and did not have to do anything, all is needed is a text reply "Stop" and it returns a generic message and blocks the number from getting anymore messages. "Start" allows them to get them again.

Requirement #4: Is the Header needed, They could not clarify if the same system continued to send them needed to have it or if only different systems sending. As I am using my toll free number with friends and family so we all use the same number and account for sending out messages. So each habitat is considered a separate "Business" and would need the header. (But they believe its still required on a single "Business" sending.

So all these thing mentioned above are new coming through from the new carriers rules. They don't have official documentation for the Toll Free section since this is also still new for them to deal with. Just like with the Sole Proprietor that most hubitat twilio users will be using has changed several time in the first 7 days of them launching due to minor things changing and being tweaked.

I tried for the time period to get registered but kept having issues are it was tailored to business not individuals. (We were a total after thought by carriers). I believe alot has been streamed lined and no longer require your EIN number to register if you are not a business.

The code I posted above is not a requirement for local 10 numbers.

Figured I would post if for others incase they needed it, and made it an optional field that if not fielded in it is basically skipped.

I have had very basic programming over the years so I was able to understand what needed to be tweaked and with googles help found how to write it in groovy.

So honestly I believe most will not need this feature, it will be a very limited use case. I have it working on my side and they confirmed it will work the way I have it setup.

I have my headder as Albert's Hubitat, my Brother has it as Erik's Hubitat and friend has it as Jeremy's Hubitat ect...
They each had to fill out a document with the number(s) they will be sending to and sign it along with their header tag. I then upload that to my google drive for the carriers access.

But now its a set it and forget it. :slight_smile:

So I don't believe you need to add the code, after I went through everything its a going to be a limited use case, so People should be able to just copy and paste the code should they need it for their toll free numbers. As as mentioned twilio is not even 100% sure it needed for single use, but I am using across multiple so there it was needed.

Hope that helps. And thanks again for all that you do in the community

2 Likes

Thanks for sharing your Twilio step by step voice call setup. Though I was aware that it was an option I had never bothered to set it up as I am old time digital pager kind of guy. Given that the deadline for "A2P 10DLC Registration" for SMS text phone number registration is soon to arrive, voice appears to be a good work-around for the moment while I ponder my next step and/or wait for my registration to be approved. Thanks again for your effort/s.

1 Like

@ritchierich thank you so much for the driver, very much needed!

I followed your instructions, created a Twilio account, purchased a number and setup the TwiML bin.
I triple checked my "Twilio Account SID", "Twilio Auth Token", "TwiML Bin URL" and "Twilio Phone Number" and they appear to be correct.

Unfortunately I'm getting the following error when the notification is triggered, and I cannot figure out what I did wrong:

[error]deviceNotification: Invalid API Credentials were probably entered. Twilio Server Returned: groovyx.net.http.HttpResponseException: status code: 400, reason phrase: Bad Request

How can I troubleshoot this issue?

The only "strange" thing I can see is that the "TwiML Bin" I created seems to be under the "United States (US1)" region, while my number is in the "Ireland (IE1)" as I'm based in Switzerland and I bought a Swiss number.

Thanks a lot for your help :pray:t3:

@Aldius unfortunately with regulation changes here in the US I have given up my use of Twilio. It was becoming more and more expensive and I now just use push notifications via Pushover. I can no longer provide support for this driver.

Oh no :scream:

Could you recommend another solution to have Hubitat call specific phones in case of alarm?

I think that's needed for proper smoke alarm response, but maybe I'm missing something?

This community version of the Twilio Driver and my deprecated Plivo drivers were the only ones I am aware of that can generate a call. Given I no longer use either and cannot get a working phone number I really cannot provide much support. Really sorry about this. I have been using Twilio personally for over 10 years and it was sad when I had to give up using it. The cost to go through the US required verification process just didn't make sense for my limited use of it.

Are you able to successfully send SMS text messages? You can test that by pulling up your child Twilio Device and enter text in the Device Notification box and click button.

1 Like

Ya the hoops they wanted you to jump through were dumb. But i talked with the right tech and he tolde i could bypass all that crap and make an 800 number instead as they are considered trusted already. So for $2 a month i have an 800 number and bypassed all the issues. Only thing i had to do was provide how i will have people subscribe and unsubscribe. It was super easy and way worth it. I now share my number with 3 people and we all user it and share the cost.

Also love your driver still works great.

1 Like

Good. Luck. I had an 800 number and was told i still had to go thru all the hoops and register a company etc. I dropped them. My guess is they will catch up to u too.

1 Like