Skip to content

brandon-barker/PushBots.NET

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PushBots.NET

Unofficial .NET Client Library for the PushBots v1 API

Table of Contents

Quick Start

Install the NuGet package from the package manager console:

Install-Package PushBots.NET

Create an instance of PushBotsClient by passing in your Application ID and Secret (get this from your App settings page on the PushBots dashboard)

var client = new PushBotsClient("55165801f85f8b457d", "b03052506824b4f3165ecc0");

back to top

Push

Single Push

Push a notification to a single device

var pushMessageSingle = new SinglePush()
            {
                Message = "Test from API",
                Token =
                    "APA91bGE09bhztuOZyFxI2txOOAXrELuVQ38WWC-yrX6MpgNgjylVdXLygkbGbIU9x6aToJl3C5nVGJtdteAyGVbY19TSBWYnYip0-Arjv3-6KRDq9sDobbpc17yxb3OpFO_nxxxxxxxxxxx",
                Platform = Platform.Android,
                Badge = "+1",
                Sound = "",
                Payload = JObject.Parse(@"{ 'openURL': 'http://www.google.com/' }")
            };

            await client.Push(pushMessageSingle);

back to top

Batch Push

Push a notification to Devices under certain conditions

var pushMessage = new BatchPush()
            {
                Message = "Test from API",
                Badge = "+1",
                Platforms = new[] { Platform.Android, Platform.iOS }
            };

            var result = await client.Push(pushMessage);

back to top

Badge

Update device Badge

var result =
    await
        client.Badge(
            "APA91x9bhzxxZC88kxxAXrELuVQ38WWC-yrX6MpgNgjylVdXLygkbGbIU9x6aToJl3C5nVGJtdteAyGVbY19TSBWYnYip0-Arjv3-6xxxxxx",
            "0", 1);

return result;

NOTE: Currently only supports iOS platform, if you pass through a "1" for Android it will return an error

back to top

Analytics

Get Push Analytics for a single application

var result = await client.GetPushAnalytics();

return result;

back to top

Devices

Get Devices

Utility function to retrieve all devices registered with PushBots along with their device token

var devices = client.GetDevices();

back to top

Get Device by Alias

Get device information by it's registered Alias

var device = await client.GetDeviceByAlias("TestUser");

back to top

Register Device

Register device token of the app in the database for the first time and update it with every launch of the app, device data will be updated if registered already

var device = new Device
    {
        Token = "xxxxxxxxxxx",
        Platform = Platform.Android,
        Latitude = "33.7489", // Optional
        Longitude = "-84.3789", // Optional
        Types = new[] {"Subscriptions", "Followers"}, // Optional
        Tags = new[] {"Culture", "Egypt"}, // Optional
        Alias = "test@example.com"
    };

    var response = await client.RegisterDevice(device);

back to top

Register Multiple Devices

Register multiple devices up to 500 Device per request

var response = await client.RegisterDevice(
    new [] {"xxxxx"}, // Array of Tokens
    Platform.Android,
    new[] { "Culture", "USA" } // Optional array of Tags
    );

back to top

Unregister Device

unRegister device token of the app from the database

back to top

Alias

Add/update alias of a device

back to top

Tag Device

Tag a device with its token through SDK or Alias through your backend

back to top

Untag Device

unTag a device its token through SDK or Alias through your backend

back to top

Device Location

Add/update location of a device

back to top

About

Unofficial .NET Client Library for PushBots.com

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages