Wiki

Clone wiki

nuntium-api-csharp / Home

Access the Nuntium public API in C#.

Example

using Instedd.Nuntium.Api;

...

// Provides an interface in case you need to mock it
INuntiumApi api = new NuntiumApi("service_url", "account_name", "application_name", "application_password");

// Get all countries
Countries[] countries = api.GetCountries();

// Get all carriers that belong to a specific country
Carriers[] carriers = api.GetCarriers(countries[0].Iso2);

// Get all channels
Channels[] channels = api.GetChannels();

// Create a channel
api.CreateChannel(new QstServerChannel {
  Name = "my_channel",
  Protocol = "sms",
  Direction = Direction.Bidirectional,
  Password = "secret",
});

AOMessage message = new AOMessage {
  From = "sms://1234",
  To = "sms://5678",
  Subject = "Hi",
  Body = "Hello Nuntium!",
};

// Send an Application Originated message
AOMessageResponse response = api.SendAO(message);
Console.WriteLine("Sent message with id {0} and guid {1}. Routed? {2}", response.Id, response.Guid, response.Ok);

// Simulate sending a message and get a list of candidate channels
api.GetCandidateChannelsForAO(message);

Updated