public static async Task Run( [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequestMessage req, [NotificationHub(ConnectionStringSetting = "NotificationHubConnectionString", HubName = "%NotificationHubName%")] IAsyncCollector <Notification> notification, ILogger log) { log.LogInformation("C# HTTP trigger function processed a request."); const string message = "A new software update is available."; NotificationPayloadBase payload = new GcmNotificationPayload(message); await notification.AddAsync(new GcmNotification(JsonConvert.SerializeObject(payload))); payload = new AppleNotificationPayload(message); await notification.AddAsync(new AppleNotification(JsonConvert.SerializeObject(payload))); }
public static async Task SoftwareUpdateNotification( [EventGridTrigger] EventGridEvent eventGridEvent, [NotificationHub(ConnectionStringSetting = "NotificationHubConnectionString", HubName = "%NotificationHubName%")] IAsyncCollector <Notification> notification, ILogger log) { log.LogInformation("EventGridEvent trigger." + $"\n\tId:{eventGridEvent.Id}" + $"\n\tTopic:{eventGridEvent.Topic}" + $"\n\tSubject:{eventGridEvent.Subject}" + $"\n\tType:{eventGridEvent.EventType}" + $"\n\tData:{JsonConvert.SerializeObject(eventGridEvent.Data)}"); // TODO: check event grid data for correct data - and use file version info to embed it in the push payload const string message = "A new software update is available."; NotificationPayloadBase payload = new GcmNotificationPayload(message); await notification.AddAsync(new GcmNotification(JsonConvert.SerializeObject(payload))); payload = new AppleNotificationPayload(message); await notification.AddAsync(new AppleNotification(JsonConvert.SerializeObject(payload))); }