Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send parameters on root level #149

Open
bastienuh opened this issue May 7, 2021 · 0 comments
Open

Send parameters on root level #149

bastienuh opened this issue May 7, 2021 · 0 comments

Comments

@bastienuh
Copy link

Hi,

How to add some parameters on root level, and not in data, buttons, etc. ?

The only way I found is to add one more parameter to sendNotificationToExternalUser, for example and then make an array_merge to have a $param variable with, for example, the following information :

array:6 [
  "app_id" => "a1cc617b-1f11-487d-84f2-07f8d35bd055"
  "contents" => array:1 [
    "en" => "HuffingtonPost – Un projet d'attentat néonazi contre une loge maçonnique déjoué"
  ]
  "include_external_user_ids" => array:4 [
    0 => "1"
    1 => "2"
    2 => "3"
    3 => "4"
  ]
  "web_url" => "https://www.my-link.com",
  "app_url" => "MY LINK",
  "ios_attachments" => "https://my-image-link.fr",
  "chrome_web_image" => "https://my-image-link.fr",
  "chrome_web_icon" => ""https://my-image-link.fr""
]

See web_url, chrome_web_image and chrome_web_icon, for example.

What do you think about adding a $body variable at the end of the method, like this :

public function sendNotificationToExternalUser($message, $userId, $url = null, $data = null, $buttons = null, $schedule = null, $headings = null, $subtitle = null, $body = null)

and, at the end of the functions, make this :

if(isset($body)){
    $params = array_merge($params, $body);
}

This way, the lib could become gorgeous and can give us a lot of possibilities.

Thanks for your feedbacks,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant