https://github.com/shibayan/azure-functions-appcenterpush-extension
Azure Functions Bindings for App Center Push
https://github.com/shibayan/azure-functions-appcenterpush-extension
appcenter azure-functions
Last synced: 12 months ago
JSON representation
Azure Functions Bindings for App Center Push
- Host: GitHub
- URL: https://github.com/shibayan/azure-functions-appcenterpush-extension
- Owner: shibayan
- License: mit
- Created: 2019-05-28T04:46:23.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-07-27T09:31:49.000Z (almost 7 years ago)
- Last Synced: 2025-07-22T11:17:15.646Z (about 1 year ago)
- Topics: appcenter, azure-functions
- Language: C#
- Homepage:
- Size: 27.3 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Azure Functions Bindings for App Center Push
[](https://dev.azure.com/shibayan/azure-functions-appcenterpush-extension/_build/latest?definitionId=30&branchName=master)
## NuGet Packages
Package Name | Target Framework | NuGet
---|---|---
WebJobs.Extensions.AppCenterPush | .NET Standard 2.0 | [](https://www.nuget.org/packages/WebJobs.Extensions.AppCenterPush)
## Basic usage
```csharp
public static class Functions
{
// Use IAsyncCollector
[FunctionName("Function1")]
public static async Task Function1(
[HttpTrigger(AuthorizationLevel.Function, "post")] HttpRequest req,
[AppCenterPush(OwnerName = "owner", AppName = "app")] IAsyncCollector collector,
ILogger log)
{
await collector.AddAsync(new AppCenterPushMessage
{
Content = new AppCenterPushContent
{
Name = "First Push From App Center",
Title = "Push From App Center",
Body = "Hello! Isn't this an amazing notification message?",
CustomData = new { key1 = "val1", key2 = "val2" }
}
});
return new OkResult();
}
// Use returning value
[FunctionName("Function2")]
[return: AppCenterPush(OwnerName = "owner", AppName = "app")]
public static AppCenterPushMessage Function2(
[HttpTrigger(AuthorizationLevel.Function, "post")] HttpRequest req,
ILogger log)
{
return new AppCenterPushMessage
{
Content = new AppCenterPushContent
{
Name = "First Push From App Center",
Title = "Push From App Center",
Body = "Hello! Isn't this an amazing notification message?",
CustomData = new { key1 = "val1", key2 = "val2" }
}
};
}
}
```
```json
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "",
"FUNCTIONS_WORKER_RUNTIME": "dotnet",
"AppCenterPushApiToken": ""
}
}
```

## Push Targeting
### Audience
```csharp
await collector.AddAsync(new AppCenterPushMessage
{
Content = new AppCenterPushContent
{
Name = "First Push From App Center",
Title = "Push From App Center",
Body = "Hello! Isn't this an amazing notification message?",
CustomData = new { key1 = "val1", key2 = "val2" }
},
Target = new AppCenterPushAudiencesTarget
{
Audiences = new[] { "dog-lovers", "cyclists" }
}
});
```
### Devices
```csharp
await collector.AddAsync(new AppCenterPushMessage
{
Content = new AppCenterPushContent
{
Name = "First Push From App Center",
Title = "Push From App Center",
Body = "Hello! Isn't this an amazing notification message?",
CustomData = new { key1 = "val1", key2 = "val2" }
},
Target = new AppCenterPushDevicesTarget
{
Devices = new[] { "00000000-0000-0000-0000-000000000001","00000000-0000-0000-0000-000000000002", "00000000-0000-0000-0000-000000000003" }
}
});
```
### User Ids
```csharp
await collector.AddAsync(new AppCenterPushMessage
{
Content = new AppCenterPushContent
{
Name = "First Push From App Center",
Title = "Push From App Center",
Body = "Hello! Isn't this an amazing notification message?",
CustomData = new { key1 = "val1", key2 = "val2" }
},
Target = new AppCenterPushUserIdsTarget
{
UserIds = new[] { "james@somecompany.com", "allison@somecompany.com", "anna@somecompany.com" }
}
});
```
### Account Ids
```csharp
await collector.AddAsync(new AppCenterPushMessage
{
Content = new AppCenterPushContent
{
Name = "First Push From App Center",
Title = "Push From App Center",
Body = "Hello! Isn't this an amazing notification message?",
CustomData = new { key1 = "val1", key2 = "val2" }
},
Target = new AppCenterPushAccountIdsTarget
{
AccountIds = new[] { "00000000-0000-0000-0000-000000000001", "00000000-0000-0000-0000-000000000002", "00000000-0000-0000-0000-000000000003" }
}
});
```
## License
This project is licensed under the [MIT License](https://github.com/shibayan/azure-functions-appcenterpush-extension/blob/master/LICENSE)