Эта страница является
переводом страницы
SMS. Перевод выполнен на 100%.
SMS-notifications
Manual on sending SMS-notifications to iOS and Android devices
Description
SMS driver is created on the basis of AV & Custom Systems driver. The driver interacts with the SMS, as a result a message can be sent to a user's mobile device about activation of a relay, a smoke detector, a motion sensor and other devices.
Use the example to create your own drier for other sms-services:
- Twilio SMS;
- Telesign SMS Verify;
- Nexmo SMS Messaging;
- D7SMS;
- Telnyx;
- MessageBird;
- ClickSend (Inteltech);
- Nexmo Verify.
Example for SMS.ru service (for Russian-speaking users)
1 Register at sms.ru website or another similar service that sends text messages.
2 Get your secret key in the service. To do it, follow the link. https://sms.ru/?panel=settings&subpanel=api.
3 Download the example above, go to the script editor and enter required data:
- device - link to a driver (enter "sms" driver);
- apiId - secret key receied in step 2;
- phoneNumber - phone number where text messages wiil come;
- TextMessage - text of a message текст.
4 Assign the "Send" channel to an event (for example, a button press). A text message will be sent after the event is activated.
Example:
var device = IR.GetDevice("sms");
var apiId = "FDC658FC-784E-8DC2-AD67-7ACDABFF34C1";//write here your id from site sms.ru
var phoneNumber = "89998877666";//write here phone number
var TextMessage = "Hello World!";//text of sms
IR.AddListener(IR.EVENT_CHANNEL_SET, device, function(name, value)
{
if (name == "Send")
{
var mMessage = TextMessage.replace(" ","+");
var mUri = "/sms/send?api_id="+apiId+"&to="+phoneNumber.toString()+"&msg="+mMessage+"&json=1";
/* test */
//mUri += "&test=1";
var mData = 'GET, ' + mUri + ' ,';
//device.Send([mData]);
device.SendEx({
Type: "GET",
Url: mUri,
cbReceiveText: function(text, code, headers) {IR.Log("cbReceiveText "+text);}
})
}
});