public async Task NotifyByTags(string message, List <string> tags, NotificationPayload payload = null, int?badgeCount = null)
        {
            var notification = new Dictionary <string, string> {
                { "message", message }
            };

            if (payload != null)
            {
                var json = JsonConvert.SerializeObject(payload);
                notification.Add("payload", json);
            }
            else
            {
                notification.Add("payload", "");
            }

            if (badgeCount == null)
            {
                badgeCount = 0;
            }

            notification.Add("badge", badgeCount.Value.ToString());

            try
            {
                await _hub.SendTemplateNotificationAsync(notification, tags);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
 public async Task SendTestPushNotification(string email)
 {
     if (email != null)
     {
         var message = "Push notifications are working for you - excellent!";
         var payload = new NotificationPayload {
             Action = "hello!"
         };
         payload.Payload.Add(
             "email", email);
         await NotifyByTag(message, email, payload, 1);
     }
 }
 public async Task NotifyByTag(string message, string tag, NotificationPayload payload = null, int?badgeCount = null)
 {
     await NotifyByTags(message, new List <string> {
         tag
     }, payload, badgeCount);
 }