I'm new to Pushwoosh and I'm trying to a specific message to a specific device via php. And the message goes to every device every single time. I have put the device in an array, but it's still not working.

pwCall('createMessage', [ 'application' => PW_APPLICATION, 'auth' => PW_AUTH, 'notifications' => [ [ 'send_date' => 'now', 'content' => 'This is may fake message', 'data' => ['custom' => 'json data']

                          ]


                  ],

                  'devices' => ['89745897fake0978number96a4389f796173ae938772239558f700aafb24']

          ]
        );
asked 04 Mar '15, 19:29
LeagueBasketball's gravatar image

LeagueBasket...
113

Hello, could you please provide the entire request?

permanent link
answered 05 Mar '15, 09:33
Benedict's gravatar image

Benedict
7127

I add the full request for you. Thx

(05 Mar '15, 20:17) LeagueBasket... LeagueBasketball's gravatar image

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

(09 Mar '15, 18:35) LeagueBasket... LeagueBasketball's gravatar image
<?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')

              )
            );

?>
permanent link
answered 05 Mar '15, 12:57
LeagueBasketball's gravatar image

LeagueBasket...
113

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.)?

permanent link
answered 17 Mar '15, 10:07
Benedict's gravatar image

Benedict
7127

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×444
×38
×33

question asked: 04 Mar '15, 19:29

question was seen: 1,757 times

last updated: 17 Mar '15, 10:07