wordpress fcm notification send – WordPress Development Stack Exchange
Question
$rest_api_url = "https://fcm.googleapis.com/fcm/send";
$key = "key=<server_key>";
$body = [
'to' => '<device_id>',
'notification' => [
"body" => 'body content',
"title" => 'Title of Your Notification'
]
];
$body = wp_json_encode( $body );
$options = [
'body' => $body,
'headers' => [
'Content-Type' => 'application/json',
'Authorization' => $key,
]
];
$response = wp_remote_post( $rest_api_url, $options );
0
4 weeks
2023-03-07T11:42:42-05:00
2023-03-07T11:42:42-05:00 0 Answers
0 views
0
Leave an answer