Send notification to specific device

Comments

5 comments

  • Avatar
    Gayview Mahat

    Hello, could you please provide the entire request?

  • Avatar
    LeagueBasketball
    <?php
        define('PW_AUTH', 'tokenQFASKTIbXzLgU7T0');
        define('PW_APPLICATION', 'App-Id7DCA');
        define('PW_DEBUG', true);
    
        function pwCall($method, $data) {
    
            $url = 'https://cp.pushwoosh.com/json/1.3/' . $method;
            $request = json_encode(['request' => $data]);
    
            $ch = curl_init($url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
            curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate');
            curl_setopt($ch, CURLOPT_HEADER, true);
            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
    
            $response = curl_exec($ch);
            $info = curl_getinfo($ch);
            curl_close($ch);
    
            if (defined('PW_DEBUG') && PW_DEBUG) {
                print "[PW] request: $request\n";
                print "[PW] response: $response\n";
                print "[PW] info: " . print_r($info, true);
            }
        }
    
    
    
    pwCall('createMessage', array(
                          'application' => PW_APPLICATION,
                          'auth' => PW_AUTH,
                          'notifications' => array(
                                  array(
    
                                      'send_date' => 'now',
                                      'content' => 'Here is my message',
    
                                  )
    
    
                          ),
    
                          'devices' => array('28ac735efaked7fdevice98e96a4389f796173ae938772239558f765491b00aafb24')
    
                  )
                );
    
    ?>
    
  • Avatar
    LeagueBasketball

    I add the full request for you. Thx

  • Avatar
    LeagueBasketball

    Hello, were you able to see what I'm doing wrong here?

  • Avatar
    Gayview Mahat

    Hi, I'm terribly sorry for the delay! Could you possibly contact Pushwoosh support and provide your username, App Code and full API request (with valid tokens, etc.)?

Please sign in to leave a comment.