-
Create a new SlooceApi with your environments configuration.
using Slooce.NET; ... var slooceApi = new SlooceApi(new SlooceConfig("slooceurl", "sloocepassword"));
-
Register a user(make sure the user number includes country code)
var registerResponse = await api.RegisterUserAsync("15555555555", "yourkeyword"); //check result Console.WriteLine($"Register response: {registerResponse.Result}");
-
Send a text
var textResponse = await api.SendMtMessageAsync("15555555555", "yourkeyword", "Hellow world"); //check result Console.WriteLine($"Text response: {textResponse.Result}");
-
Dispose the api when you are done with it.
slooceApi.Dispose();
The SlooceApi
class uses a backing HttpClient
for its web requests, so you should be using one SlooceApi
throughout your application. The SlooceApi
already takes care of DNS refresh issues when caching an HttpClient as well.
The SlooceApi
should generate minimum garbage and uses caching wherever possible.