In the last edition of the EMnify API Blog Series, we explored how to configure protocols to automatically initiate and configure your IoT & M2M devices or services. We gave examples of automated API calls, and technical information on how to implement automated process in your own application. In Part 3 of the Blog Series, we will continue on the technical track, covering how to send and receive application-to-peer (A2P) SMS messages over API.
Why is SMS important for IoT/M2M?
Short messaging service, commonly known as SMS, over the EMnify platform allows you to start communicating with your device as soon as it comes online. There are several messaging solutions to address specific needs in the IoT and M2M marketplace. SMS is the only communication channel which works on every device, in every network, and offers full visibility on delivery status. SMS is exchanged using a radio-signaling channel that is established as soon as the device is “attached” to a network.
SMS also works in areas of weak radio reception, and when a device is roaming. Although a single SMS is limited to 160 characters, multiple SMS can be logically grouped into one, making longer commands and message exchanges possible.
EMnify offers two methods of SMS messaging to customers:
- Application-to-peer (A2P) – best when devices and applications need to communicate with each other
- Peer-to-peer (P2P) – best when devices need to communicate directly to other devices
More information on both SMS models can be found here.
EMnify customers have flexibility and control over which SMS preferences they set for both A2P and P2P messaging, including the ability to block all SMS communication. With the integration of EMnify’s API, A2P messages, rules, and processes can be automated through your own business system or application. A2P only works with integration with EMnify’s RESTful API, but it’s functionalities are still available to all users through the EMnify User Interface web portal.
A2P messaging has advantages over P2P messaging including security, visibility, and scalability. A2P provides closed communication between customer devices and application, making it more secure. Visibility through fully-trackable A2P messaging helps to troubleshoot any issues that may arise, and message can be initiated on-demand or through an automated process.
EMnify User Interface SMS Console
Although integration with the EMnify API enables you to automate messaging through your own application, SMS functionality and tracking can also be monitored on the EMnify User Interface (EUI) SMS console. Through the SMS Console you can send and receive messages to any of your devices attached to the EMnify network. Messages are instantly sent with full visibility over delivery status. SMS received from your device will appear automatically in the SMS console.
The EUI also gives you access to SMS analytics including the history of sent and received messages. All information stored in EUI and all the functionality is available through your own application when you integrate with the EMnify API to build a scalable solution.
Sending and Receiving SMS via EMnify RESTful API
For many IoT devices, an SMS is required to test and/or configure service. When you integrate with the EMnify API, automated SMS messaging can make the configuration of devices significantly faster. SMS messages can be sent over the EMnify API from your server to IoT devices (referred to as Mobile Terminated messages), and responses from the device to your server URL via SMS can be pushed in real-time for instant processing (referred to as Mobile Originated messages). The benefit of EMnify RESTful API is that it’s easily programmable and you can integrate it into program flows allowing your software communicate to devices over SMS.
NOTE: Mobile Originated (MO) SMS is the ability to send a message from an endpoint and Mobile Terminated (MT) SMS is the capability of the device to receive a message from an endpoint. Together MO and MT-SMS form a standard two-way SMS as found on most devices.
Mobile Terminated and Mobile Originated SMS Messaging over the EMnify API
Let’s explore an example of how messages can be sent and received over the EMnify API.
A fleet tracking company who supplies GPS trackers has built a customer portal that includes details about each tracking device. With the EMnify API integrated into their system, they can pull real-time device connectivity information, usage and cost metrics for the device. Let’s assume the company needs to check the battery life of a device. As soon as the initial configuration is completed*, the company can send a short message and receive a response back from the device. With A2P message automation, this process can happen seamlessly as part of the device setup.
NOTE: For more information on configuration of devices, please log in to the EUI and from the start page click “Download our Setup Guide”
Sending A2P SMS Messages to your Device (MT)
In order to initiate A2P SMS messages to a device, address the device (endpoint) and start with the following command:
You can begin from a very simple JSON Object to control the sender address and the content of your SMS:
Advanced settings – such as binary message, custom User Data Header and DCS values – are also possible as well as the option to submit an individual validity period per message.
Receiving A2P SMS Messages from your Device (MO)
In order to initiate A2P SMS messages from a device, address the application and start with the following command:
Once the message has been delivered to the device, the EMnify messaging center will send you back a delivery receipt to confirm the successful transmission of your message.
Below is the flow a message takes when being sent from your device (“customer endpoint”), through the EMnify SMSC (short message service center) and API to your device.
Now that you have a better understanding of the importance of SMS and how to send and receive application-to-peer (A2P) SMS messages over API, we will continue with our next blog series on EMnify API technical features where you will be able to get more insights on how to use the power of an API to monetize your product or service and extend the life cycle of your device.
by Remy Schneider
originally published 21.10.16