如何使用C#中的Pushwoosh Web API向某些特定用户发送推送通知?
我想使用PushWooshWebAPI向一些订阅者广播推送通知 我一直在使用他们网站上给出的代码 但它正在发送给所有注册用户。如何仅向某些特定用户发送通知 以下是JSON生成代码:如何使用C#中的Pushwoosh Web API向某些特定用户发送推送通知?,c#,pushwoosh,C#,Pushwoosh,我想使用PushWooshWebAPI向一些订阅者广播推送通知 我一直在使用他们网站上给出的代码 但它正在发送给所有注册用户。如何仅向某些特定用户发送通知 以下是JSON生成代码: string pwAuth = "YOUR_AUTH_TOKEN"; string pwApplication = "PW_APPLICATION_CODE"; JObject json = new JObject( new JProperty("applicatio
string pwAuth = "YOUR_AUTH_TOKEN";
string pwApplication = "PW_APPLICATION_CODE";
JObject json = new JObject(
new JProperty("application", pwApplication),
new JProperty("auth", pwAuth),
new JProperty("notifications",
new JArray(
new JObject(
new JProperty("send_date", "now"),
new JProperty("content", "test"),
new JProperty("wp_type", "Toast"),
new JProperty("wp_count", 3),
new JProperty("data",
new JObject(
new JProperty("custom", "json data"))),
new JProperty("link", "http://pushwoosh.com/"),
new JProperty("conditions",
new JArray(
(object)new JArray("Color", "EQ", "black")))))));
PWCall("createMessage", json);
谢谢您需要在JSON中添加属性“devices”,其中包含要发送通知的不同设备的设备令牌 像这样:
string[] arr = new string[1];
arr[0] = "9d48ac049ca6f294ea25ae25f3472b0e7e160ba06729397f9985785477560b3a";
JObject json = new JObject(
new JProperty("application", pwApplication),
new JProperty("auth", pwAuth),
new JProperty("notifications",
new JArray(
new JObject(
new JProperty("send_date", "now"),
new JProperty("content", new JObject(new JProperty("en", pushContentEnglish), new JProperty("es", pushContentSpanish))),
new JProperty("data", new JObject(new JProperty("custom", new JObject(new JProperty("t", notificationType), new JProperty("i", objectId))))),
new JProperty("devices", new JArray(arr))
))));
在这里,我将“devices”属性设置为我打算向其发送通知的设备令牌的字符串数组
PS-请注意您提供给Devices属性的数组,因为一旦我将其值设置为逗号分隔的字符串而不是数组,并且Pushwoosh将此通知广播给所有用户,而不是抛出错误 我认为最好的方法可能是使用标签。我想你用应用程序代码中的特定标签注册了设备。然后你就可以了。但我只是从pushwhoosh开始,所以不确定。你如何获得设备令牌?