AzureFunctions.Extensions.NotificationHubs
1.0.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package AzureFunctions.Extensions.NotificationHubs --version 1.0.0
NuGet\Install-Package AzureFunctions.Extensions.NotificationHubs -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AzureFunctions.Extensions.NotificationHubs" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AzureFunctions.Extensions.NotificationHubs --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: AzureFunctions.Extensions.NotificationHubs, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install AzureFunctions.Extensions.NotificationHubs as a Cake Addin #addin nuget:?package=AzureFunctions.Extensions.NotificationHubs&version=1.0.0 // Install AzureFunctions.Extensions.NotificationHubs as a Cake Tool #tool nuget:?package=AzureFunctions.Extensions.NotificationHubs&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
AzureFunctions.Extensions.NotificationHubs
Notification Hubs Output Binding Extension, that supports Azure Functions v3. Allows to send multiple notifications to different platforms, that are supported by Azure NotificaionHubs service.
The binding allows you to send multiple notificaions via Azure Notification Hubs service like so:
Step 1.
- Add the nuget AzureFunctions.Extensions.NotificationHubs
- Add to Startup file the following code. Currently, accepts simple JWK tokens or tokens loaded out of Azure B2C
builder.AddNotificationHubs();
Setup settings:
"DefaultFullSharedAccessSignature": "Endpoint= ...",
"HubsName": "Enter hubs name here..."
- Add it to Azure Function:
[FunctionName("SendOne")]
public void SendOne(
[HttpTrigger(AuthorizationLevel.Function, "post", Route = "messages")] HttpRequest req,
[NotificationHubs] out HubsMessage output)
{
output = new HubsMessage("Notification Hub test message", Platform.Android);
}
- Different platforms/configurations are possible.
[FunctionName("SendConfigured")]
public void SendConfigure(
[HttpTrigger(AuthorizationLevel.Function, "post", Route = "messages/configure")] HttpRequest req,
[NotificationHubs(Connection = "DefaultFullSharedAccessSignature", HubsName = "HubsName")] out HubsMessage output)
{
output = new HubsMessage("Notification Hub test message", Platform.Android);
}
OR
[FunctionName("SendOneWithTags")]
public void SendWithTags(
[HttpTrigger(AuthorizationLevel.Function, "post", Route = "messages/tags")] HttpRequest req,
[NotificationHubs] IAsyncCollector<HubsMessage> output)
{
var tags = new List<string> { "registered", "new" };
output.AddAsync(new HubsMessage("Notification Hub test message", Platform.Android, "registered", "new"));
output.AddAsync(new HubsMessage("Notification Hub test message", Platform.Android, tags));
}
OR
[FunctionName("SendAppleNotification")]
public void SendAppleNotification(
[HttpTrigger(AuthorizationLevel.Function, "post", Route = "notification/apple")] HttpRequest req,
[NotificationHubs] IAsyncCollector<HubsMessage> output)
{
var payload = @"{""aps"":{""alert"":""Notification Hub test notification""}}";
var notification = new HubsMessage(new AppleNotification(payload));
output.AddAsync(notification);
}
OR
[FunctionName("SendConfigured")]
public void SendConfigure(
[HttpTrigger(AuthorizationLevel.Function, "post", Route = "messages/configure")] HttpRequest req,
[NotificationHubs(Connection = "DefaultFullSharedAccessSignature", HubsName = "HubsName")] out HubsMessage output)
{
output = new HubsMessage("Notification Hub test message", Platform.Android);
}
OR
[FunctionName("SendRest")]
public void SendRest(
[HttpTrigger(AuthorizationLevel.Function, "post", Route = "messages/rest")] HttpRequest req,
[NotificationHubs] IAsyncCollector<HubsMessage> output)
{
var payload = @"%Replace with a payload that is specific to a platform%";
var dictionary = new Dictionary<string, string>();
var notification1 = new HubsMessage(new AppleNotification(payload));
var notification2 = new HubsMessage(new AdmNotification(payload));
var notification3 = new HubsMessage(new FcmNotification(payload));
var notification4 = new HubsMessage(new WindowsNotification(payload));
var notification5 = new HubsMessage(new TemplateNotification(dictionary));
var notification6 = new HubsMessage(new BaiduNotification(payload));
output.AddAsync(notification1);
output.AddAsync(notification2);
output.AddAsync(notification3);
output.AddAsync(notification4);
output.AddAsync(notification5);
output.AddAsync(notification6);
}
- Enjoy
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. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.1
- Microsoft.Azure.NotificationHubs (>= 3.3.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.