Hi,

When I am sending a notification using below api and it is working very fine.

$url = 'https://cp.pushwoosh.com/json/1.3/createMessage';
  $data = array(
    'application' => PW_APPLICATION,
    'auth' => PW_AUTH,
    'notifications' => array(
      array(
        'send_date' => 'now',
        'content' => $content,
        'data' => array('uid' => (int) $uid),     
) ) ); $request = json_encode(array('request' => $data)); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 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);

But when I try to send it to specific single device using hwid, notification is not received on device end but in push notification history I can see that notification has been sent. Refer the code below. Do I need to register this device to send notification specific to it? or for single device do I need to use 'devices' => $hwid instead of 'devices' => array($hwid).

$url = 'https://cp.pushwoosh.com/json/1.3/createMessage';
  $data = array(
    'application' => PW_APPLICATION,
    'auth' => PW_AUTH,
    'notifications' => array(
      array(
        'send_date' => 'now',
        'content' => $content,
        'data' => array('uid' => (int) $uid),
        'devices' => array($hwid),
      )
    )
  );
  $request = json_encode(array('request' => $data));
  $ch = curl_init($url);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  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);
asked 04 Sep, 11:32
maheshg8385's gravatar image

maheshg8385
111

Be the first one to answer this question!
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:

×427
×417
×340
×32

question asked: 04 Sep, 11:32

question was seen: 46 times

last updated: 04 Sep, 11:32