gpt4 book ai didi

javascript - FCM - 以编程方式向用户群发送推送通知

转载 作者:技术小花猫 更新时间:2023-10-29 10:35:49 25 4
gpt4 key购买 nike

<分区>

我能够从 Firebase 控制台向单个设备、主题和用户群发送通知。

我想向用户群发送推送通知。我搜索了很多,但我只得到脚本来向单个用户或主题发送通知,而不是向用户群发送通知。

我试过下面的代码

var client = new RestClient("https://fcm.googleapis.com/fcm/send");
var request = new RestRequest(Method.POST);
request.AddHeader("content-type", "application/json");
request.AddHeader("authorization", "key=mykey");
request.AddParameter("application/json", "\n\n{\"to\" : \"user-segment-name\",\n\"notification\" : {\n \"body\" : \"test message\",\n \"title\" : \"Portugal vs. Denmark\"\n },\n \"priority\":\"high\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Response.Write(response.Content);

我收到下面的回复

{"multicast_id":5837227475989925972,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"InvalidRegistration"}]}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com