Skip to content

Commit

Permalink
add support for new Kontomanager UI
Browse files Browse the repository at this point in the history
remove WebSMS
  • Loading branch information
winterleitner committed Feb 15, 2023
1 parent e18762e commit 81dfdb1
Show file tree
Hide file tree
Showing 9 changed files with 366 additions and 542 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/KontomanagerClient/bin/
/KontomanagerClient/obj/
/KontomanagerClientDemo/
/TestProject/
/KontomanagerClientTests/
/.idea/
4 changes: 2 additions & 2 deletions KontomanagerClient/CustomCarrierClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ namespace KontomanagerClient
/// </summary>
public class CustomCarrierClient : KontomanagerClient
{
public CustomCarrierClient(string username, string password, string baseUri, string loginUri, string sendUri)
: base(username, password, new Uri(baseUri), new Uri(loginUri), new Uri(sendUri))
public CustomCarrierClient(string username, string password, string baseUri)
: base(username, password, new Uri(baseUri))
{

}
Expand Down
812 changes: 329 additions & 483 deletions KontomanagerClient/KontomanagerClient.cs

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions KontomanagerClient/KontomanagerClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@

<PropertyGroup>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Title>Kontomanager Web SMS Client</Title>
<Title>Kontomanager .NET Client</Title>
<Authors>Felix Winterleitner</Authors>
<Description>A client library that wraps the Kontomanager Web Interface used by some Austrian cellular service providers. Enables the usage of the provided Web SMS functionality and querying of usage stats in .NET</Description>
<Copyright>Copyright (c) Felix Winterleitner 2022</Copyright>
<Description>A client library that wraps the Kontomanager Web Interface used by some Austrian cellular service providers. Enables querying of usage stats in .NET</Description>
<Copyright>Copyright (c) Felix Winterleitner 2023</Copyright>
<RepositoryUrl>https://github.com/winterleitner/kontomanager-websms-client</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageLicenseUrl>https://licenses.nuget.org/MIT</PackageLicenseUrl>
<TargetFrameworks>net5.0;net6.0;netcoreapp3.1;netstandard2.0</TargetFrameworks>
<PackageVersion>1.2.7</PackageVersion>
<TargetFrameworks>net5.0;net6.0;net7.0;netcoreapp3.1;netstandard2.0</TargetFrameworks>
<PackageVersion>2.0.0</PackageVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="HtmlAgilityPack" Version="1.11.42" />
<PackageReference Include="HtmlAgilityPack" Version="1.11.46" />
</ItemGroup>

</Project>
4 changes: 4 additions & 0 deletions KontomanagerClient/PhoneNumber.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ namespace KontomanagerClient

public class PhoneNumber
{
/// <summary>
/// User chosen name for the number.
/// </summary>
public string Name { get; set; }
public string Number { get; set; }
public string SubscriberId { get; set; }

Expand Down
8 changes: 3 additions & 5 deletions KontomanagerClient/XOXOClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ namespace KontomanagerClient
{
public class XOXOClient : KontomanagerClient
{
public XOXOClient(string username, string password)
: base(username, password, new Uri("https://xoxo.kontomanager.at"),
new Uri("https://xoxo.kontomanager.at/index.php"),
new Uri("https://xoxo.kontomanager.at/websms_send.php"))
public XOXOClient(string user, string password) :
base(user, password, new Uri("https://xoxo.kontomanager.at/app/"))
{

}

}

}
7 changes: 2 additions & 5 deletions KontomanagerClient/YesssClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@ namespace KontomanagerClient
{
public class YesssClient : KontomanagerClient
{
public YesssClient(string username, string password) :
base(username, password, new Uri("https://www.yesss.at/kontomanager.at/"),
new Uri("https://www.yesss.at/kontomanager.at/index.php"),
new Uri("https://www.yesss.at/kontomanager.at/websms_send.php"))
public YesssClient(string user, string password) :
base(user, password, new Uri("https://www.yesss.at/kontomanager.at/app/"))
{

}
}
}
6 changes: 6 additions & 0 deletions KontomanagerClientNet.sln
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KontomanagerClientDemo", "K
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KontomanagerClientTests", "KontomanagerClientTests\KontomanagerClientTests.csproj", "{F5EC4F31-27C9-4E70-9C13-BC8EA2BC7B37}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestProject", "TestProject\TestProject.csproj", "{2979450B-5EC0-4F19-8CD1-791D1A3C8751}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -24,5 +26,9 @@ Global
{F5EC4F31-27C9-4E70-9C13-BC8EA2BC7B37}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F5EC4F31-27C9-4E70-9C13-BC8EA2BC7B37}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F5EC4F31-27C9-4E70-9C13-BC8EA2BC7B37}.Release|Any CPU.Build.0 = Release|Any CPU
{2979450B-5EC0-4F19-8CD1-791D1A3C8751}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2979450B-5EC0-4F19-8CD1-791D1A3C8751}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2979450B-5EC0-4F19-8CD1-791D1A3C8751}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2979450B-5EC0-4F19-8CD1-791D1A3C8751}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
54 changes: 13 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
.NET Client library that wraps the WebSMS functionality provided by the kontomanager.at web management interface used by a number of mobile carriers in Austria (MVNOs in the A1 network).

# UPDATE 02/2023
As of right now, a new version of the Kontomanager Website prevents this library from functioning in the current version.
This will be fixed in a future update.
The Kontomanager Web interface has had a major design overhaul. Unfortunately, the WebSMS functionality was removed in the process.
v1.x is no longer working for at least XOXO and YESSS as of 15.02.2023.

v2.0.0 provides basic account usage reading functionality comparable to what was present before. Reading of current monthly cost is not implemented yet.

# Installation

Expand All @@ -23,47 +25,26 @@ Other carriers that use Kontomanager but were not tested include:

And possibly more. Feel free to add carriers to that list.

# Limitations
The tested carriers each limit the maximum number of messages that may be sent per hour and phone number to **50**.
Unfortunatly, it is not possible to read the remaining time until a new message can be sent, so best the client can do is guess the time, unless all messages were sent from the currently running instance of THIS client.

# Usage

### Basic Example
```c#
var client = new XOXOClient("<login_username/number>", "<login_password>")
.EnableDebugLogging(true) // Enables Console Log outputs
.UseAutoReconnect(true) // Enables automatic re-login after a connection timeout
.UseQueue() // Enables a queue that reattempts to send messages when the SendLimit is reached
.ThrowExceptionOnInvalidNumberFormat(true); // Configures the client to throw an exception if a phone number format was rejected by Kontomanager
.UseAutoReconnect(true); // Enables automatic re-login after a connection timeout
await client.CreateConnection();

var r = await client.SendMessage("<recipient_number>", "<message>");
```

When UseQueue() is called, the response from SendMessage is always **MessageEnqueued**.
To get the actual sending results, the **SendingAttempted** event of the Message class can be used like this.

```c#
Message m = new Message("<recipient_number>", "<message>");
m.SendingAttempted += (sender, result) =>
{
// result is the sending result enum
// keep in mind that this event can be called multiple times in case Sending fails
// MessageSendResult.Ok is only returned once the message has been successfully sent.
};
var r = await client.SendMessage(m);
var usage = await client.GetAccountUsage();
usage.PrintToConsole();
```

### 1.2.0 Additions

```c#
var client = new XOXOClient("<login_username/number>", "<login_password>")
.EnableDebugLogging(true) // Enables Console Log outputs
.UseAutoReconnect(true) // Enables automatic re-login after a connection timeout
.UseQueue() // Enables a queue that reattempts to send messages when the SendLimit is reached
.ThrowExceptionOnInvalidNumberFormat(true); // Configures the client to throw an exception if a phone number format was rejected by Kontomanager
.UseAutoReconnect(true); // Enables automatic re-login after a connection timeout
await client.CreateConnection();

Expand All @@ -79,20 +60,6 @@ var otherNumberUsage = await client.GetAccountUsage(); // get account usage for
otherNumberUsage.PrintToConsole();
```


### Supported Phone Number Formats

Kontomanager requires phone numbers to either specify an austrian carrier specific number prefix, or specify a number including a country prefix starting in 00.
This client uses the latter case exclusively. Numbers can either be specified as **00<country_code><number>** or **+<country_code><number>**.

Valid examples are (in this example: +43 = Austrian Country Code, 0664: Provider Prefix for A1 (0 is omitted if country prefix is used):
- +436641234567
- 00436641234567

Invalid:
- 436641234567
- 06641234567

# Similar projects

The following projects seem to do the same thing as this client in other languages. However, I did not test any of them.
Expand All @@ -103,6 +70,11 @@ The following projects seem to do the same thing as this client in other languag

# Changelog

### 15.02.2023 2.0.0
This is a breaking change. Some methods were removed and the constructor was refactored to only require one URL.
- remove no longer supported WebSMS functionality
- add support for new Kontomanager UI

### 07.06.2022 1.2.7
- added a function to extract the selected phone number from the header

Expand Down

0 comments on commit 81dfdb1

Please sign in to comment.