This R sms library enables you to send and receive SMS from R with http requests. The library uses HTTP Post requests and JSON encoded content to send the text messages to the mobile network1. It connects to the HTTP SMS API of Ozeki SMS gateway.
Ozeki SMS Gateway is a powerful SMS Gateway software you can download and install on your Windows or Linux computer or to your Android mobile phone. It provides an HTTP SMS API, that allows you to connect to it from local or remote programs. The reason why companies use Ozeki SMS Gateway as their first point of access to the mobile network, is because it provides service provider independence. When you use Ozeki, the SMS contact lists and sms data is safe, because Ozeki is installed in their own computer (physical or virtual), and Ozeki provides direct access to the mobile network through wireless connections
Download: Ozeki SMS Gateway download page
Tutorial: R send sms sample and tutorial
To send sms from R
- Download Ozeki SMS Gateway
- Connect Ozeki SMS Gateway to the mobile network
- Create an HTTP SMS API user
- Checkout the Github send SMS from R repository
- Open the Github SMS send example in Visual Studio
- Compile the Send SMS console project
- Check the logs in Ozeki SMS Gateway
In order to download the Ozeki.Libs.Rest library, firstly you have to install the devtools library with the following command:
$ r
$ install.packages("devtools")
After you have installed the devtools, you can install the Ozeki.Libs.Rest library by using the install_github function:
$ install_github('ozekisms/r-send-sms-http-rest-ozeki')
Include the freshly installed Ozeki.Libs.Rest library:
library(Ozeki.Libs.Rest)
First of all you have to create a configuration file by using the Configuration class of the Ozeki.Libs.Rest library:
configuration <- Ozeki.Libs.Rest::Configuration$new(
username = "http_user",
password = "qwe123",
api_url = "http://127.0.0.1:9509/api"
)
Then you can create the message you want to send by creating a Message instance:
msg <- Ozeki.Libs.Rest::Message$new()
msg$to_address <- "+36201111111"
msg$text <- "Hello world!"
After you have created the configuration, and the message objects, you can continue by creating a message api using the MessageApi class of the Ozeki.Libs.Rest library.
api <- Ozeki.Libs.Rest::MessageApi$new(configuration)
After everything is ready, you can send the sms message with the send method of the MessageaApi object:
result <- api$send(msg)
To get a better understanding of the above SMS code sample, it is a good idea to visit the webpage that explains this code in a more detailed way. You can find videos, explanations and downloadable content on this URL.
Link: How to send sms from R
Don't waste your time, start using the repository now!