Unofficial Pusher Beams .NET Server SDK
The Beams .NET server SDK is available on nuget here.
You can install this SDK by using NuGet:
Install-Package Pusher.PushNotifications
Or via the .NET Core command line interface:
dotnet add package Pusher.PushNotifications
Use your instance id and secret (you can get these from the dashboard) to create a Beams PushNotifications instance:
var pushNotificationsOptions = new PushNotificationsOptions
{
InstanceId = "YOUR_INSTANCE_ID_HERE",
SecretKey = "YOUR_SECRET_KEY_HERE"
};
var pushNotifications = new PushNotifications(new HttpClient(), pushNotificationsOptions);
Once you have created your PushNotifications instance you can publish a push notification to your registered & subscribed devices:
var interests = new List<string> { "donuts", "pizza" };
var notification = new Dictionary<string, object>
{
{ "title", "hello" },
{ "body", "Hello world" }
};
var alert = new Dictionary<string, object>
{
{ "title", "hello" },
{ "body", "Hello world" }
};
var publishRequest = new Dictionary<string, object>
{
{ "fcm", new { notification } },
{ "apns", new { aps = new { alert } }}
};
pushNotifications.PublishToInterests(interests, publishRequest);