简体   繁体   English

从 TWA 将 android 应用设备令牌发送到 WordPress web

[英]Send android app device token to WordPress web from a TWA

I'm building a TWA which opens a WordPress site and shows some data addressed to a few numbers of users.我正在构建一个 TWA,它打开一个WordPress站点并显示一些针对少数用户的数据。 Each user must see specific information according to his/her place in a chain of orders and, thus, receive different notifications.每个用户必须根据他/她在订单链中的位置查看特定信息,从而收到不同的通知。

Now, on certain WP events (creating a custom post type post, for instance), PHP Performs an HTTP request with wp_remote_post to send notifications throughout Firebase to ALL the devices carrying the app, which is less than ideal.现在,在某些 WP 事件(例如,创建自定义帖子类型帖子)上,PHP 使用 wp_remote_post 执行 HTTP 请求,以在整个Z035489FF8D092741943E4A83Z4F中发送通知,对于携带应用程序的所有设备来说并不理想。

So, I suppose the way to narrow down the sending of notifications is to get the token of each app (TWA), store in WordPress in the wp_usermeta table (so it is linked to each different user) and use it to send tailored notifications according to the events going on in the site.所以,我想缩小通知发送的方法是获取每个应用程序的令牌(TWA),存储在wp_usermeta表的WordPress中(因此它链接到每个不同的用户)并使用它来发送定制的通知根据到网站上发生的事件。

Well, that's my question:好吧,这就是我的问题:

Is there any way to send this tokens securely from the TWA to WordPress as easy and straightforward as possible?有没有办法尽可能简单直接地将这些令牌从 TWA 安全地发送到 WordPress

Thanks!谢谢!

In most cases, the best way to implement push notifications in a Trusted Web Activity is to implement web push notifications in the Progressive Web App and then enable Notification Delegation in the Trusted Web Activity. In most cases, the best way to implement push notifications in a Trusted Web Activity is to implement web push notifications in the Progressive Web App and then enable Notification Delegation in the Trusted Web Activity.

In the cases where this is not the best solution, you can use custom HTTP headers to send information from the Android app to the Trusted Web Activity (assuming query strings are not desirable due to security).在这不是最佳解决方案的情况下, 您可以使用自定义 HTTP 标头将信息从 Android 应用程序发送到受信任的 Web 活动(假设查询字符串是不可取的)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM