[RELEASE] Plivo SMS and Voice Notification Driver

HE natively includes a Twilio driver that allows you to send SMS messages. Plivo is a competitor to Twilio and is a little cheaper so this might be a good alternative for the community. Please view the Plivo Pricing page for specific details. For example at the time of this post, the monthly fee for a dedicated phone number is half the cost of Twilio. In a nutshell, Plivo charges you a monthly fee for a dedicated phone number that notifications will come from and then there is a per SMS and call pricing which are very cheap. This shouldn't cost you more than $1 per month, but this will depend on usage.

This driver is a modification to the Community Twilio driver that I created in May 2018 which ultimately became a stock driver. If you are familiar with the native driver, this one has several differences:

  1. Has a parent container driver that creates children notification devices so you only have to enter the Plivo API once in the parent container.
  2. In certain regions of the world (not USA), Plivo supports Alphanumeric Senders which are a little cheaper than purchasing a phone number. Added support for Alpha Sender.
  3. Support voice calls via text to voice. Added SpeechSynthesis capability to the child driver and when you invoke the speak command, the driver will instruct Plivo to call your phone number instead and speak the text.

Hoping @bravenel will consider creating a native Plivo driver. This is a copy of my Twilio driver and only simple REST API endpoint changes were needed to make it work.

To utilize this driver:

  1. Sign up for a Plivo account
  2. Fund the account via credit card
  3. Purchase a phone number (or setup Alphanumeric sender if supported in your region). Plivo is a bit different than Twilio and they don't have as many local USA numbers.
  4. On the Plivo Dashboard, capture your account's Auth ID and Auth Token:
  5. Add the container and device drivers code to your HE hub or use HPM to install the code - search for Plivo SMS and Voice Notifications.
  6. Create a new virtual device and set the type to Plivo Container and Save Device.
  7. Enter the Plivo API Credentials into the Hubitat driver.
  8. Designate whether you are using an Alpha Sender, default no.
  9. Select your Plivo Phone Number or Alpha Sender and Save Preferences.
  10. Enter a child Device Label and phone number and click Create Device. The phone number needs to be entered in E.164 format for example in the US and Canada +18005551212. Multiple child notification devices can be setup and they will all leverage the same Plivo API Credentials.

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

Optional Text to Voice Setup

To setup voice calls, additional setup is required within your Plivo Account. The Plivo Voice API has a multi-step API to make a call and then speak text which complicates the setup. Fortunately they have a workflow feature called PHLO that you can setup within your Plivo Account to make this process very simple to setup.

  1. Login to your Plivo Account.

  2. In the left navigation bar, click PHLO - at the time of this post it is the icon below the # sign.

  3. Click Create New PHLO

  4. In the Choose your use-case popup, we will leverage the Voice Notifications template, select it.

  5. Click Create Application

  6. Select the Start step

    • Add message to the API Request section
    • Click Validate
    • Click Save
  7. Select the Play_Notification step

    • Replace the Speak Text with the following: {{Start.http.params.message}}
    • Click Validate
    • Click Save
  8. At the top right side of the screen beside Save you will find the Copy PHLO URL button, click it.

  9. Back in your Hubitat Plivo Container driver, find the Plivo PHLO URL preference and paste the URL into that field and click Save Preferences

  10. To utilize this feature, in Rule Machine or other apps, use the Speak command and the text you wish to speak via phone call. This driver will call the phone number and speak the text entered.

The drivers can be found here or in HPM:

5 Likes

All this is way over my head, but I'm curious...

Could this also be made to work with voip.ms?
https://wiki.voip.ms/article/SMS

I don’t know anything about voip.ms but a quick scan of their website does not mention a Rest API like Plivo or Twilio. Mentions sending SMS through their web interface which wouldn’t work with my drivers.

1 Like

Download the Hubitat app