Pushover is simple notification service and mobile device application. For sending notifications (messages) if offers a web API.
The API is quite weird combination of REST-like approach and old-school HTTP POST form emulation and I was not able to find any .NET client that would seem to be maintained and actually working.
So, I wrote one, with fairly modern approach.
First, install the NuGet package Altairis.Pushover.Client
:
Install-Package Altairis.Pushover.Client
Then create instance of the PushoverClient
class:
// Create client class with API token obtained from app registration
var client = new PushoverClient("axxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
Then prepare the message using PushoverMessage
. Recipient user ID and message text are required, various other options can be set as properties:
// Create a message with user ID obtained from recipient user registration
var message = new PushoverMessage("uxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "This is a test message") {
Title = "Test message"
};
Then send message (asynchronously) and check if the call was successfull:
// Send message
var result = await client.SendMessage(message);
// Check for success
if (result.Status) {
Console.WriteLine("Message sent successfully!");
} else {
Console.WriteLine("Message send failed!");
}
API reference documentation can be found in wiki.
- Developed by Michal Altair Valášek.
- Licensed under terms of the MIT License.
- This project adheres to No Code of Conduct. We are all adults. We accept anyone's contributions. Nothing else matters.