Pushbullet no notification on smartphone using API

611 Views Asked by At

I created a little app which uses Pushbullet's API. It is writtent in PhP and uses cURL to proceed the different requests.

At first, I use oauth2 to recieve an access token. Then it is /v2/pushes/ to send a push to the registred account.

The message is recieved on the Pusbullet account but nothing shows up on the smartphone. There is no notification.

I hope someone can help me. Thanks.

My function which sends the push:

    function send_push($token){
    $data = array(
        'type' => 'note',
        'title' => 'Alert',
        'body' => 'My body :)!'
    );

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, 'https://api.pushbullet.com/v2/pushes'); 
    curl_setopt($ch, CURLOPT_HEADER, false); 
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));

    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
        'Content-Type: application/json',
        'Authorization: Bearer '.$token
    ));

    $data = curl_exec($ch);
    curl_close($ch); 
}
0

There are 0 best solutions below