GithubHelp home page GithubHelp logo

oneapi-dot-net's Introduction

OneApi dot-net client

Basic messaging example

First initialize the messaging client using your username and password:

Configuration configuration = new Configuration(username, password);
SMSClient smsClient = new SMSClient(configuration);

An exception will be thrown if your username and/or password are incorrect.

Prepare the message:

SMSRequest smsRequest = new SMSRequest(senderAddress, message, recipientAddress);

Send the message:

// Store request id because we can later query for the delivery status with it:
string requestId = smsClient.SmsMessagingClient.SendSMS(smsRequest);

Later you can query for the delivery status of the message:

DeliveryInfoList deliveryInfoList = smsClient.SmsMessagingClient.QueryDeliveryStatus(senderAddress, requestId);
string deliveryStatus = deliveryInfoList.DeliveryInfos[0].DeliveryStatus;

Possible statuses are: DeliveredToTerminal, DeliveryUncertain, DeliveryImpossible, MessageWaiting and DeliveredToNetwork.

Messaging with notification push example

Same as with the standard messaging example, but when preparing your message:

SMSRequest smsRequest = new SMSRequest(senderAddress, message, recipientAddress);
// The url where the delivery notification will be pushed:
smsRequest.NotifyURL = notifyUrl;

When the delivery notification is pushed to your server as a HTTP POST request, you must process the body of the message with the following code:

DeliveryInfoNotification deliveryInfoNotification = smsClient.SmsMessagingClient.ConvertJsonToDeliveryInfoNotification(JSON);

HLR example

Initialize and login the data connection client:

Configuration configuration = new Configuration(username, password);
SMSClient smsClient = new SMSClient(configuration);

Retrieve the roaming status (HLR):

Roaming roaming = smsClient.HlrClient.QueryHLR(address);

HLR with notification push example

Similar to the previous example, but this time you must set the notification url where the result will be pushed:

smsClient.HlrClient.QueryHLR(address, notifyUrl);

When the roaming status notification is pushed to your server as a HTTP POST request, you must process the body of the message with the following code:

RoamingNotification roamingNotification = smsClient.HlrClient.ConvertJsonToHLRNotification(JSON);

Retrieve inbound messages example

With the existing sms client (see the basic messaging example to see how to start it):

InboundSMSMessageList inboundSMSMessageList = smsClient.SmsMessagingClient.GetInboundMessages();

Inbound message push example

The subscription to recive inbound messages can be set up on our site. When the inbound message notification is pushed to your server as a HTTP POST request, you must process the body of the message with the following code:

InboundSMSMessageList inboundSMSMessageList = smsClient.SmsMessagingClient.ConvertJsonToInboundSMSMessageNotification(JSON);

License

This library is licensed under the Apache License, Version 2.0

oneapi-dot-net's People

Contributors

brakus avatar nmenkovic avatar nmenkovic-ib avatar pducic avatar tkrajina avatar vavukovic avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.