edamov / pushok

PHP client for Apple Push Notification Service (APNs) - Send push notifications to iOS using the new APNs HTTP/2 protocol with token-based (JWT with p8 private key)
MIT License
368 stars 119 forks source link

Additional payload parameter to support Safari notifications #114

Closed marcorocca closed 3 years ago

marcorocca commented 3 years ago

First of all congratulations for the great job, your library is simple and effective and I think it's one of the best around written in PHP.

I see that it lacks a simple parameter that will allow it to send even Safari notifications out of the box. Unfortunately Apple's documentation is not updated and many people think it works only with the binary protocol but I have tried your library with a simple fix to make it work.

As you can see here you must prepare a payload with this format:

{
 --
 "aps": {
  "alert": {
   "title": "Flight A998 Now Boarding",
   "body": "Boarding has begun for Flight A998.",
   "action": "View"
  },
  "url-args": ["boarding", "A998"]
 }
}

But pushok doesn't allow to set the url-args parameter that is at the same level of the aps field.

I can send you a pull request with the new parameter and I'll be happy if you can accept it in your project.

marcorocca commented 3 years ago

Here the pull request https://github.com/edamov/pushok/pull/115

edamov commented 3 years ago

Thank you. It is available in version 0.11.3