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

how to add button in notification #173

Open
duongsieu opened this issue Oct 24, 2022 · 2 comments
Open

how to add button in notification #173

duongsieu opened this issue Oct 24, 2022 · 2 comments

Comments

@duongsieu
Copy link

i add params buttuon in prepareParams but response from onesignal:

Client error: POST https://onesignal.com/api/v1/notifications resulted in a 400 Bad Request response:\n{"errors":["Invalid 'buttons' format!"]}\n

I have tried many different formats like string, array, json endcode array,... but it doesn't work. Can you help me format this so I can send it successfully, thanks

@suijt
Copy link

suijt commented Dec 7, 2022

Same issue. please provide a proper example format for buttons and data.

@suijt
Copy link

suijt commented Dec 7, 2022

Same issue. please provide a proper example format for buttons and data.

return OneSignal::sendNotificationToAll(
$message,
$url,
['abc' => 123, 'foo' => 'bar', 'event_performed' => true, 'amount' => 12.1],
[["id" => "id1", "text" => "first button", "icon" => "ic_menu_share"], ["id" => "id2", "text" => "second button", "icon" => "ic_menu_send"]],
$schedule = null,
$heading,
);

figured it out myself. FYI plugin is good but documentation is poor.

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

2 participants