src/FastSms/ core wrapper code
tests/FastSms.Tests/ tests of the core wrapper code
example/FastSmsExample/ example project
The minimum requirement by FastSMS wrapper is that your Visual Studio supported .Net Framework 4.5.
FastSMS has a Knowledge Base and a Developer Zone which cover every detail of FastSMS API.
Add reference "FastSms" to your project.
Your token (found in your settings within NetMessenger)
var client = new FastSmsClient('your token');
List all API codes found in docs
using FastSms;
...
var client = new FastSmsClient('Your token');
try {
var credits = client.CheckCredits();
} catch (FastSmsException fastSmsException) {
Console.writeline(fastSmsException.Message, fastSmsException.Code);
} catch (Exception ex) {
Console.Writeline(ex.Message);
}
Checks your current credit balance.
var credits = client.CheckCredits();//returns decimal value
Sends a message. More information read here
...
using FastSms;
using FastSms.Models.Requests;
using FastSms.Models.Responses;
...
// Initialize user data
var userData = new CreateUserRequest{
FirstName = "User first name",
LastName = "User Last name",
AccessLevel = "Normal",
ChildPassword = "Password",
Email = "email@example.com",
Credits = 100,
Telephone = "123456789"
};
client.CreateUser( userData );
...
// Initialize message for user/users.
var message = new SendMessageToUserRequest {
DestinationAddress = "Address",
SourceAddress = "Your source",
Body = "Message text"
};
// Initialize message for group.
var message = new MessageToGroupRequest {
GroupName = "Group name",
SourceAddress = "Your source",
Body = "Message text"
};
// Initialize message for list.
var message = new SendMessageToListRequest{
ListName = "List name",
SourceAddress = "Your source",
Body = "Message text"
};
client.SendMessage(message);
Check send message status. More information read here
var messageStatus = client.CheckMessageStatus(messageId)//message id must be string
Create new child user. Only possible if you are an admin user. More information read here
...
using FastSms;
using FastSms.Models.Requests;
using FastSms.Models.Responses;
...
// Initialize user data
var userData = new CreateUserRequest{
FirstName = "User first name",
LastName = "User Last name",
AccessLevel = "Normal",
ChildPassword = "Password",
Email = "email@example.com",
Credits = 100,
Telephone = "123456789"
};
client.CreateUser( userData );
Transfer credits to/from a child user. Only possible if you are an admin user. More information read here
...
using FastSms;
using FastSms.Models.Requests;
using FastSms.Models.Responses;
...
// Initialize update user data
var childUsername = "username";
var quantity = 10;
client.UpdateCredits( childUsername, quantity );
Retrieve the data from a report. More information read here Aviable types: - ArchivedMessages - ArchivedMessagesWithBodies - ArchivedMessagingSummary - BackgroundSends - InboundMessages - KeywordMessageList - Messages - MessagesWithBodies - SendsByDistributionList - Usage
...
using FastSms;
...
// Get report
var report = client.GetReports (reportType, dateFrom, dateTo)//reportType - enumerable, dates - in string
Create contact(s). More information read here
...
using FastSms;
...
// Initialize contacts data
var contacts = new List<ImportContactsRequest> {
new ImportContactsRequest{
Name = "Contact name",
Number = "Contact number"
},
new ImportContactsRequest{
Name = "Contact name",
Number = "Contact number",
Group1 = "Contact group"
},
// Add contacts
var result = client.ImportContactsCsv(contacts);
More information read here
...
using FastSms;
...
client.DeleteAllContacts();
More information read here
...
using FastSms;
...
client.DeleteAllGroups();
Remove all contacts from the specified group. More information read here
...
using FastSms;
...
client.EmptyGroup("Group Name");
Delete the specified group. More information read here
...
using FastSms;
...
client.DeleteGroup("Group Name");