Sending SMS using AppStudio

I have a mobile app project which requires me to be able to formulate and send text messages (SMS) from within the app. These will be control codes sent to a remote embedded system.
I have searched the docs but cannot find any samples or suggestions how it may be done.

I have looked at Appery.io as a development platform and they demonstrate a method using Nexmo and PhoneGap. Here is a link to the demo:

How to Build and Test an Ionic SMS App with Nexmo API

I would much rather use AppStudio and hope that there is a way to emulate this feature in some form or other. Incoming messages can be accepted by the normal message app of the mobile device – it is the creation of the actual text (I can see how to do) and sending it (???) that my app needs to handle.

Any advice as to whether this (or something close to it) is achievable would be appreciated.

Did you have a look at the sample “7. Web Services - EmailSkypePhoneSMS”?

Hi Amagg,

Thank you for that pointer which I clearly missed. That is the bones of what I want so a great starting point.

I have been able to test it on an old Samsung S3 and send a text successfully. My iPhone ( v8+ IOS11) however, accepts the QCode but offers to down load the Android version only. I thought this would just be the web version and not require an Apple Certificate - have I missed something?

I am also guessing that it is not possible to send the text ‘blind’ - i.e…it has to go through the device messaging app to be sent. I was rather hoping to emulate the method used in the demo link above where it is sent direct from the custom app.

Any thoughts on this appreciated.

You can do a “blind” send by posting to the nexmo API. To do this a secret key and API are sent along with your payload. Nexmo does the rest.

It can all be done with Appstudio.

Thank you Cayocoder. This gives me confidence that what I want to achieve is possible.

I had a look at the Nexmo API and there doesn’t seem to be direct support for Basic or Javascript in their library. Is there an example of how to interface to Nexmo by any chance.

…and any thoughts on why the IOS version doesn’t appear.

If you have a the api key and secret then you are almost there. It is possible to send a post to their REST API from javascript although that would require you to expose your credential and that’s not the best. There is a way around that.

For example, if you run the following as a GET post to the REST location:

https://rest.nexmo.com/sms/json?api_key=XXXXXX&api_secret=XXXXX&to=PhoneNumber&from=YourNexMoNumber&text=Hello%3A+Appstudio

It will send a message to the phone number you designate. However keep in mind, if you are testing, you will need to add the number as part of your test bed.

Once you have the above working, you can then construct a JS version of the string that will send a GET post to the Nexmo API service. If you want to get fancy, we can even use Volt as an authentication server! This will allow state to be maintained on a device which is inherently stateless.