Sending push messages with a new line character

Posted by bal on 07-Dec-2014 08:03

It looks like that it we cannot send messages with a "enter"/new line character. What is the best way to achieve this? Replacing with \\n ?

All Replies

Posted by pantipov on 07-Dec-2014 12:46

If user sends Push via Rest API he/she should use symbol “\n"

For example:

POST:  https://api.<progress-domain>/rest/push/msg

Headers:

Content-Type:application/json

X-Progress-Push-API-Key:<PUSH-API-KEY>

Body:

{

"payload": {"badge": 2, "message": "line-1\nline-2"},

"status": "sent",

"schedule": {"scheduledTime": 0, "timeZone": 0}  

}

If user is trying to send message from admin push-page (“Mobile Applications Monitoring Dashboard”)

he/she should just divide string using “Enter” key, f.e.:

screencast.com/.../v1VOvv8QKOq

If it does not work, please let me know what device do you use and its OS version.

Posted by bal on 07-Dec-2014 16:19

For all the others, it is working with:

message.replace(/(?:\r\n|\r|\n)/g, '\\n');

Posted by pantipov on 08-Dec-2014 02:22

Hi Bal,

I am sorry I don't understand what you mean under "for all the others"?

Posted by bal on 08-Dec-2014 06:08

I mean the other readers here on the forum. Good to know for everybody how to handle these kind of issues. Thanks also for your support!

This thread is closed