如何在python-flask或使用segment向特定用户发送Onesignal推送通知?

2024-09-22 20:23:31 发布

您现在位置:Python中文网/ 问答频道 /正文

我对Onesignal绝对陌生,在pyFlask中集成它有问题。我的restapi正在所有设备上的react应用程序上发送推送通知,但现在我希望它发送应用程序的特定用户。有谁能帮我查一下密码吗?有没有人可以帮助我代码发送特定的用户

from onesignal import OneSignal, SegmentNotification
client = OneSignal("key", "key")
notification_to_all_users = SegmentNotification(
contents={
    "en": "Hello from OneSignal-Notifications"
},
included_segments=[SegmentNotification.ALL]
)
client.send(notification_to_all_users) 

Tags: tokey用户fromclientrestapi应用程序notification