I am building an api to upload video on youtube channel. One of the requirement is that whenever a video is uploaded successfully to youtube server a notification must be sent to the ios app bundle id using Firebase Cloud Messaging. I have registered my application in fcm console with bundle id com.tbox.ygtp I have tried to google on how to send notification to the ios app and i found following API
$url = 'https://fcm.googleapis.com/fcm/send';
$server_key = 'AAAAylThdyA:APA91bGISSU********VTqHJqBnV81B3jfJzAice07E********HHLXTVylMU1OWSHvdyoZMVNlM8t9p9tXH_4OKm********fEOatp_alw9qMlQNT507lLWLt1N_FMHel1JCCWcuQjD';
$fields = array();
//$fields['data'] = $data;
$fields['notification'] = array('body'=>$data);
if(is_array($target)){
$fields['registration_ids'] = $target;
}else{
$fields['to'] = $target;
}
//header with content_type and api key
$headers = array(
'Content-Type:application/json',
'Authorization:key='.$server_key
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
$result = curl_exec($ch);
if ($result === FALSE) {
die('FCM Send Error: ' . curl_error($ch));
}
curl_close($ch);
return $result;
This Api sends notification to device tokens. But I need the notification to be sent on application bundle id. Can someone guide me through how to send the notification to application bundle id using FCM.