4 ways to send SMS to your devices manually and automatically

30.09.2021
guide-image

While Short Message Service (SMS) is increasingly less relevant for consumer communication thanks to the availability of messenger services such as Facebook, Whatsapp, and Threema, it remains relevant for communication between Things. One big reason being that SMS can be sent to a device even if no data connection is possible. 

SMS can be used for:

  • Initial device configuration, e.g., setting up APN and application server
  • Triggering a reboot of the device
  • Sending data with low battery consumption 
  • Parameter changes during device operations without a data connection

 

In this post, we'll look at fourdifferent ways to send SMS to the device - manually or automatically integrated into your business workflows, using:

  1. SMS console on the EMnify Portal
  2. Automatically from your app through REST API
  3. Automatically from any app using Zapier
  4. Automatically from your app using SMPP

1. Sending SMS to the device via the Portal

Log in to the EMnify Portal and go to Connected Devices, then search for the device you want to send the SMS to and click on the SMS console icon.
You can enter the messages you want to send to the device, as well as set the sender address. By the way, you will also see in the console all SMS sent by the device.

2. Automatically sending SMS with REST API

SMS are often utilized at specific device lifecycle states, such as sending an SMS during device provisioning. You can also trigger SMS from your application using the REST API. To integrate the API, you will need to use an authentication token which you can get through:

POST https://cdn.emnify.net/api/doc/swagger.html#/Authentication/Authenticate

Body:

{
  "application_token": "YOUR_APPLICATION_TOKEN"
}

 

To then send the SMS to a specific device, use:

POST https://cdn.emnify.net/api/doc/swagger.html#/Endpoint/EndpointSmsByIdGethttps://cdn.emnify.net/api/v1/endpoint/{endpointId}/sms
Required Headers:
Content-Type: application/json
Authorization: Bearer {authentication_token}
Body:


{
    "source_address": "654321",
    "payload": "setparam 2001:em"
}

3. No-code - automatically sending SMS with Zapier

Zapier automates workflows between different applications - including EMnify.  Zapier integrates multiple applications using a trigger (i.e., when a special event happens - such as an SMS is received) and action (i.e., something is executed - such as sending an SMS).

As an example, imagine that you want to send a configuration SMS to the device when the device is registered in your SQL database or your subscription platform for the first time. First, you need to set up a trigger - let's say when there is a new row in your MySQL database or eCommerce shop.

Once you have confirmed the authentication (MySQL),  you can then set up the action which is sending an SMS with EMnify. 

Then, configure to which device the SMS will be sent and the content of the message. In this example, the content is based on the input of the new SQL row.

All set! Now, every time a new row is created in your device table in MySQL, an SMS will be sent to the device. 

4. SMPP as the interface to automatically send SMS

The Short Message Peer-2-Peer protocol is an industry-standard to integrate SMS management directly with the operator The protocol is often used by telematics platforms, network operators and SMS service providers to connect directly to the SMS gateway. In this way there is no proprietary connection is required. Read our SMPP integration guide on how it is done.

Setting up your automated SMS workflows only takes 5 minutes - get started now in the EMnify IoT portal, with the Rest-API or Zapier or SMPP.

Related Posts

Image for post How to send and receive SMS via the API?

How to send and receive SMS via the API?

To submit SMS directly from your application to an endpoint using our API, the following API call needs to be made: POST https://cdn.emnify.net/api/v1/endpoint/{endpointId}/sms Required Headers: Content-Type: application/json Authorization: Bearer {auth_token} JSON Body: { "source_address": "12345", "payload": "This is the message text!" } To receive SMS on your application server from the device you will need to first set up a Callback URL in the Service profile assigned to that endpoint: Set the API URL on the "SMS" tab - select "RestAPI" on the drop-down menu for “Interface” Select the “configuration icon” next to “RestAPI”, input a purpose (name of your choosing) and the URL You can also set up a "Secret" (optional) The EMnify system will then send the MO SMS as a JSON payload if the destination address of the SMS is an invalid MSISDN (8 digits or less). A2P / P2P Routing Our system distinguishes A2P SMS (application-to-person) from P2P SMS (person-to-person) based on the length of the source (MO SMS) or the destination (MT SMS) address. If there are 8 digits or less (i.e. an invalid MSISDN), an SMS will be considered A2P. If there are 9 digits or more, an SMS will be processed as MSISDN and will be considered P2P. To dispatch SMS MO to your application (A2P) and at the same time have P2P SMS enabled, the destination number (dest_address) must be limited to 8 digits or less. A detailed description of the SMS API you can find in our API Documentation.