How to use the SMS API Platform

Voice Elements’ SMS Platform gives you the tools you need to integrate texting (SMS and MMS) into your applications. Send and receive texts in your code. Build the exact SMS solution you need quickly and easily.

Create Account

The first step is to create your free Voice Elements account. Voice Elements is a dead-simple toolkit designed for .NET Developers to quickly build & deploy flexible, secure and powerful TELEPHONY apps. 

Download

Integrate Voice Elements into your Visual Studio Solution by installing our NuGet package into your project.  You can compile using .NET Framework or .NET Core. Search Nuget using “VoiceElements”.  Your app can run under Windows, Linux, or Mac.  Learn More

The easy way to build something amazing.

Start Building

Build it now! Turn your idea into reality in no time. Try Voice Elements for FREE.

Get Started Now!

 

How To Get Your First SMS App Up and Running

We have two implementations to allow you complete control of how you can use SMS in your organization.
  • SMS using your Voice Elements Client
  • SMS via REST API’s

SMS using your Voice Elements Application 

Sending and receiving SMS from within Voice Elements is a snap. It requires version 8.6.3 of the VoiceElements Client. This is now available on NUGET:

https://www.nuget.org/packages/InventiveLabs.VoiceElementsClient/

Set Encryption Keys

Before you can use SMS, you must set the encryption keys. These keys are unique to your account and you can get the keys for your SMS enabled number(s) from our portal:

https://customer.voiceelements.com/

Setting the keys in code is done at startup:

1 s_telephonyServer.SmsMyPrivateKeyXml = myCustomerKeyPairXml;
2 s_telephonyServer.SmsBorderElementsPublicKeyXml = myBorderKeyPairXml;

You should also subscribe to the SMS events to receive SMS messages and delivery reports:

1 s_telephonyServer.SmsMessage += TelephonyServer_SmsMessage;
2 s_telephonyServer.SmsDeliveryReport += TelephonyServer_SmsDeliveryReport;

Outgoing SMS

After these are set, you can easily send an SMS message as in this example:

1 public static void SendSms(string number, string smsText)
2 {
3     try
4     {
5         Guid messageGuid;
6         string[] headers;
7         string[] sdp;
8
9         var sipStatusCode = s_telephonyServer.SmsSendMessage(smsText, number, fromNumber, null, out messageGuid, out headers, out sdp);
10         Log.Write("SMS Result: {0}", sipStatusCode);
11     }
12     catch (Exception ex)
13     {
14         Log.WriteException(ex, "SendSms()");
15     }
16 }

Incoming SMS

And then handle imcoming SMS messages upon arrival:

1 private static void TelephonyServer_SmsMessage(object sender, SmsMessageEventArgs e)
2 {
3     Log.Write($"Received SMS (From: {e.SmsFrom}, To: {e.SmsTo}): {e.SmsMessage}");
4 }

Delivery Reports

The system will also give you delivery reports for sent SMS messages:

1 private static void TelephonyServer_SmsDeliveryReport(object sender, SmsDeliveryReportEventArgs e)
2 {
3     if (string.IsNullOrWhiteSpace(e.DeliveryDescription) && e.DeliveryState.ToLower() == "waiting")
4     {
5         Log.Write($"Received SMS Delivery Report (From: {e.SmsFrom}, To: {e.SmsTo}): Message delivery is pending...");
6     }
7     else
8     {
9         Log.Write($"Received SMS Delivery Report (From: {e.SmsFrom}, To: {e.SmsTo}): {e.DeliveryDescription}");
10     }
11 }

Handling Undeliverable Messages

You can also request that any undelivered SMS messages be sent to you. These would be messages that may have arrived while your application was offline.

1 try
2 {
3     string[] headers;
4     string[] sdp;
5   
6     var result = s_telephonyServer.SmsRequestUndeliveredMessages(out headers, out sdp);
7     Log.Write($"Requesting undelivered SMS messages.  Result: {result}");
8 }
9 catch { }

SMS Via REST APIs 

Get a Security Key

Using our REST APIs for SMS is done by first getting a security key from our portal:

https://customer.voiceelements.com/

Outgoing SMS

Messages are then sent to our servers by way of REST calls to our server. For example to send a message:

https://ivlrest.voiceelements.com/v1/SendSMS passing in JSON that takes this form:

1 {
2 "toNumber": "3035551212",
3 "fromNumber": "6025551212",
4 "text": "Your text here",
5 "customerTag": ""
6 }

Receiving SMS

For receiving SMS messages, we will POST back JSON to your server in a similar fashion.

Documentation

For complete documentation, refer to our SMS REST API Reference Guide

 


Build Anything

Build anything you need for SMS. Tele-Integrations, Customer self-service IVRs, call centers, phone systems, ticket management, two-factor authentication, appointment reminders, customer surveys, Voice/SMS broadcasts, political polling, power dialer, reservation confirmation, collections, emergency notifications, order status, delivery reminders, flight information, fundraising, alerts/notifications . . . and more.

That should give you a few ideas.

Voice Elements drives their solutions . . .