Dim sb As StringBuilder
sb.Initialize
For Each t As String In Devices
sb.Append($"'${t}' in topics ||"$)
Next
sb.Remove(sb.Length-3, sb.Length) 'will fail if topics is empty
Dim m As Map = CreateMap("condition": sb.ToString)
Dim Job As HttpJob
Job.Initialize("fcm", Me)
Dim m As Map = CreateMap("condition": sb.ToString)
Dim data As Map = CreateMap("content-available": 1, "key1": msg.Get("value1"), "key2": msg.Get("value2"), "key3": msg.Get("value3"), "key4": msg.Get("value4"), "key5": msg.Get("value5"), "key6": msg.Get("value6"), "key7": msg.Get("value7"), "key8": msg.Get("value8"))
m.Put("data", data)
Dim jg As JSONGenerator
jg.Initialize(m)
Job.PostString("https://fcm.googleapis.com/fcm/send", jg.ToString)
Job.GetRequest.SetContentType("application/json;charset=UTF-8")
Job.GetRequest.SetHeader("Authorization", "key=" & Main.FirebasePushApiKey)