Push Message with quote Windows Phone

0 votes


I have develop a script in Php for sending push notifications.

The app is developed for IOS, Android and WP8 / WP81

I need to use quotes and double quotes in the message

I use this syntax:

    $pushNotificationService = App42API::buildPushNotificationService();
    $title="my app title"; 
    $msg = 'This is a "Test" ';
    if (preg_match('/"/', $msg)>0){
       $tmp = addslashes($msg);
       $msg = $tmp; 
    $msgJs = "{'alert':'$msg','title':'$title','badge':1,'sound':'default','sendingFrom':'serverSide'}";
    $messageAfterAddSlahes = addslashes($msgJs); 
    $pushNotification = $pushNotificationService->sendPushMessageToUser($user, $messageAfterAddSlahes );


This notification was received correctly on IOs and Android, but un windows phone do not arrive.

In the pushlog in the management console i receive this error message :  WP7Message Exception While Sending or Deleting records : org.json.JSONException: Expected a ',' or '}' at character 31


This only for Windows Phone 

Can you help me ?


asked May 2, 2016 in PHP by odf (37 points)

3 Answers

0 votes
Best answer
Hi Odf,


Thanks for sharing the details, it is because of sending a message to windows platform have the different format. Let me know which type of notification(Tile or Toast) you want to send to windows device. It will help me to provide better support to you.



Himanshu Sharma
answered May 3, 2016 by hs00105 (2,005 points)
selected May 3, 2016 by odf
I sent the code used to register the app, I hope is that you need.
Hello, any news for me ?
Hi Odf,

We apologise to miss out your code, but the question is for which notification (Tile or Toast ) you want to send.  Please see below JSON to send tile notification using PHP api and let me know if it helps:


Himanshu Sharma
Hello, As you see in my code I send the notification for all phones not only for Windows Phone, for ios and android the message is sent but (in the push log) for windows phone  I get the error "WP7Message Exception While Sending or Deleting records : org.json.JSONException: Expected a ',' or '}' at character 31"

See the code below to see what I use in the windows phone app.

Why I get the error message only for windows devices ?

Best regards
Hi Odf,

It is because of windows phone have different format to send a message. In windows phone, there are two types of message which tile and toast. In the above comment, we have shared an example JSON of tile notification. Could you please send the message in above format and let me know if you are able to receive the message or not.

Himanshu Sharma
I think I do not explain my problem.
I need to send the message to users, but I do not know wich device have the users.
I sent this json :"{'alert':'$msg','title':'$title','badge':1,'sound':'default','sendingFrom':'serverSide'}"
To permit the ios device to make a sound when receive the notification.
IF I remove all double quotes in the "alert"  the system work for all devices.
IF there is a double quote in the "alert"  i receive the push notification on ios and android device and not on windows phone devices.

I cannot know wich device the user have, so I cannot build the json
I put two images on the answer that I Add. please see that images.
First image: data sent with apphq consolse.
Second Image: Push log with error.

Best regards
Hi Odf,

Thanks for sharing this information, I am forwarding this to our production team. They will look into it and once i get information, will update you as well.

Thanks for your patience.

Himanshu Sharma.
0 votes
I use this code to register the app to windows phone service. I think I use Tile Notifications.
When I send message I use the code I sent to you.
I hope is that you need.
Best regards

   var pushChannel = HttpNotificationChannel.Find(this.pushOptions.ChannelName);
            if (pushChannel == null)
                pushChannel = new HttpNotificationChannel(this.pushOptions.ChannelName);

                catch (InvalidOperationException)
                    this.DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, InvalidRegistrationError));
                Collection<Uri> TileLocations = new Collection<Uri>();
                //  remote images in the tile
                TileLocations.Add(new Uri("http://api.shephertz.com/"));

            var result = new RegisterResult
                ChannelName = this.pushOptions.ChannelName,
                Uri = pushChannel.ChannelUri == null ? string.Empty : pushChannel.ChannelUri.ToString()


answered May 3, 2016 by odf (37 points)
0 votes

First IMAGE: Management console

Second Image : Push Log

answered May 12, 2016 by odf (37 points)
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com