SMSC 1.1.0
dotnet add package SMSC --version 1.1.0
NuGet\Install-Package SMSC -Version 1.1.0
<PackageReference Include="SMSC" Version="1.1.0" />
<PackageVersion Include="SMSC" Version="1.1.0" />
<PackageReference Include="SMSC" />
paket add SMSC --version 1.1.0
#r "nuget: SMSC, 1.1.0"
#:package SMSC@1.1.0
#addin nuget:?package=SMSC&version=1.1.0
#tool nuget:?package=SMSC&version=1.1.0
SMSC is an unofficial client .NET for the service smsc.ru that allows developers to use HTTP-based API for sending and receiving phone calls and text messages.
Quick start
Send SMS
The examples below show how to have your application initiate and outbound phone call and send an SMS message using the SMSC helper library.
To get started, first add the SMSC package to your project by running the following command:
dotnet add package SMSC
or for Visual Studio package manager:
Install-Package SMSC
You need to initiate a new instance of ProviderConfiguration with credentials:
var providerConfig = new ProviderConfiguration(login, password);
or you can initiate ProviderConfiguration with an apikey that you created in advance (access passwords page)
var providerConfig = new ProviderConfiguration(apiKey);
Create request manager from HttpSms class:
var httpSmsSender = new HttpSms(providerConfig);
Next, you need to create a configuration class object of SmsConfiguration with properties you need:
var smsConfig = new SmsConfiguration();
if you need to send a code in the form of a call:
var smsConfig = new SmsConfiguration()
{
SmsType = SmsType.Call
};
WhatsApp (bot required in wa: format per docs):
var smsConfig = new SmsConfiguration()
{
SmsType = SmsType.WhatsApp,
BotName = "wa:79888888888"
};
var result = await httpSmsSender.SendSms("+79999999999", "Hello {button,tel:+79999999999,Call}", smsConfig);
Telegram:
var smsConfig = new SmsConfiguration()
{
SmsType = SmsType.Telegram,
BotName = "@botname_bot"
};
after that, we send a message
var result = await httpSmsSender.SendSms("+79999999999", "123456", smsConfig);
That is all you need to send a message to the client. The result is returned as a class object HttpSmsResponse.
Optional JSON REST body (https://smsc.ru/rest/send/):
httpSmsSender.UseJsonRequestFormat = true;
Get status
var providerConfig = new ProviderConfiguration(login, password);
var httpSmsStatus = new HttpSmsStatus(providerConfig);
var smsStatusConfig = new SmsStatusConfiguration()
{
Id = id,
StatusType = StatusType.Additional
};
var statusResult = await httpSmsStatus.CheckSms("+79999999999", smsStatusConfig);
Batch check (comma-separated ids/phones in API):
var statusResult = await httpSmsStatus.CheckSms(
phones: ["+79999999999", "+78888888888"],
ids: ["123", "456"],
config: new SmsStatusConfiguration { Id = null });
Telegram-bot message status:
var statusResult = await httpSmsStatus.CheckSms(
client: string.Empty,
config: new SmsStatusConfiguration { Id = null, Bot = true });
Get balance
var httpSmsBalance = new HttpSmsBalance(providerConfig);
var balanceResult = await httpSmsBalance.CheckBalance(new SmsBalanceConfiguration());
Wait call (phone confirmation)
var waitCall = new HttpWaitCall(providerConfig);
var waitResult = await waitCall.RequestAsync("+79999999999");
// waitResult.Phone — number to call within 15 minutes
Contacts
var contacts = new HttpContacts(providerConfig);
await contacts.AddAsync("+79999999999", name: "Contact", groupId: "321");
await contacts.GetGroupsAsync();
Jobs (mailings)
var jobs = new HttpJobs(providerConfig);
await jobs.AddAsync(new JobsConfiguration
{
Name = "Privet",
Phones = "79999999999",
Message = "Hello!"
});
History / senders / users / receive / downloads
var history = new HttpHistory(providerConfig);
await history.GetMessagesAsync(new HistoryConfiguration { Start = "01.01.2024", End = "01.02.2024" });
var senders = new HttpSenders(providerConfig);
await senders.GetAsync();
var users = new HttpUsers(providerConfig);
await users.GetStatAsync();
var receive = new HttpReceivePhones(providerConfig);
await receive.GetAsync();
var downloads = new HttpDownloads(providerConfig);
await downloads.GetListAsync();
Documentation
This README aims to give a quick start guide - including enough to get you to quickly start sending SMS. For deeper detail of all properties go to API Documentation, and many other aspects of smsc.ru.
Implemented features
- Http SMS send manager (documentation)
- Http SMS status manager (documentation)
- Http balance manager (documentation)
- Http wait call manager (documentation)
- Http contacts manager (documentation)
- Http mailing (jobs) manager (documentation)
- Http history / data manager (documentation)
- Http sender names manager (documentation)
- Http clients (users) manager (documentation)
- Dedicated receive numbers (documentation)
- Deferred downloads (documentation)
Transport notes aligned with SMSC docs:
- Host failover
www1…www5.smsc.ruon empty responses - POST for mail/call, attachments, and long query strings
- Message max length 1000 characters (
MessageMaxLengthException) - WhatsApp via
bot=wa:…(not legacywhatsapp=1)
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- System.Net.Http.Json (>= 9.0.0)
- System.Text.Encoding.CodePages (>= 9.0.0)
- System.Text.Json (>= 9.0.0)
-
net10.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
