Saturday, January 9, 2016

A Xively trigger PHP script to send email and SMS notifications

Xively is a platform devoted to simplifying the interconnection of devices and data with applications on the Internet of Things.

It uses feed and channels to collect user data. Any Xively channel can have one or more triggers. A trigger is a notification sent when a condition occurs on that channel.
For example if a channel is related to temperature. One can add a notification triggered when the temperature goes below a ceratin threshold.
Xively trigger does an HTTP POST request to an URL.
This is a PHP script one can use to send email and/or SMS alert for a Xively feed trigger action.

To use this script you have to upload it to any website running a PHP server.
Email are sent using the PHP mail function.
SMS are sent through a Betamax/Dellmont Voip provider. So, in order to be able to send SMS you must have some Dellmont voip account, and fill your credetils in the configuration zone of this script.
To prevent the notification of many SMS, a limiter functionality is implemented.
Also a sign it is used as a token to allow only the ones who know the token to use the script.

To use this script, point the Xively channel trigger post url to this script, and set the url parameter for your message.
As example, suppose you have installed the script at this address:
To send both mail and sms, use this url:
To send just email use this:
 - 123456 with the $sign you set in your script
 - your_feed_name with then feed name you want to get for the notification
 - your_channel_name with then channel name you want to get for the notification
 - your_alarm_text with then message you want to get for the notification
 - with the mail where to send the notification
 - 000000000000 with the mobile number where to send the notification


  • read risk disclaimer
  • excuse my bad english