Invalid json in request body using ionic push

couldn’t find what’s wrong with my req object. I got this error when trying to send push notification

**{"meta": {"status": 422, "version": "2.0.0-beta.0", "request_id": "28ac473b-4e7a-bd69"}, "error": {"link": null, "message": "Invalid JSON in request body. For empty JSON, pass '{}'.", "type": "UnprocessableEntity"}}**’/push’, function(req, res) {

var title = req.body.title,
message = req.body.message;

// Define relevant info
var ionic_api_token = ‘eyJ0eXAiOTdGb-xQVQaD2sV7qTh7XNKCnwiJKV1QiLJhbGciOiJIUzI1NiJ9.eyJqdGkiOiI2MjiNC03YjE5LTQ3MzMtYjJhMy0zM2Y3MjBkYzU4MjcifQ.s3e6pCwlVUBAs8kvbO’;
var device_tokens = [‘d44pDarVamnNJS2cNJ2modyBxjZZxcHLlnhQN4wZkJdbgkOw96rq9EEv2WCA5MKU6do0pJoO5rsmQsBAecFt4OIFB0hhD4Dp2K-uMbjum828j-8LKtpCTtGoIDBUvYI6L’];
var ionic_security_profile = ‘main’;

// Build the request object
var req = {
method: ‘POST’,
url: ‘’,
headers: {
‘Content-Type’: ‘application/json’,
‘Authorization’: 'Bearer ’ + ionic_api_token
data: {
“tokens”: device_tokens,
“profile”: ionic_security_profile,
“notification”: {
“title”: title,
“message”: message,
“android”: {
“title”: title,
“message”: message
“ios”: {
“title”: title,
“message”: message

function callback(error, response, body) {

request(req, callback);


1 Like

Hallo Eldy,
Could you able to find solution.
Even I am facing this issue, but only when App launches for first time .
Thanking you in anticipation.