First of all congratulations for this powerful service & app!
I have setup the callback url to our node js backend service. After a send notification the url is called but with empty data:
/pushsafer callback req.body: {}
/pushsafer callback req.params: {}
/pushsafer callback req.query: {}
while I was expecting req.body.json to be like:
{
"status":1,
"success":"message transmitted",
"available":1823,
"message_ids":"1324312:118,1324313:324"
}
Am I missing something?
Thank you.
Regards.
Denis
callback node js
- admin
- Site Admin
- Posts: 1006
- Joined: 1. Dec 2014, 12:41
- Location: Germany
Re: callback node js
Hi Denis,
the data you will find in POST parameter json
https://www.pushsafer.com/en/pushapi#api-callback
Kevin
the data you will find in POST parameter json
https://www.pushsafer.com/en/pushapi#api-callback
Kevin
Pushsafer DE: Dir gefällt Service und Support! Dann freuen wir uns auf deine Bewertung!
Pushsafer EN: You like Service and Support! Then we look forward to your review!
Pushsafer.com Website - iOS - Android - Windows 10
Pushsafer EN: You like Service and Support! Then we look forward to your review!
Pushsafer.com Website - iOS - Android - Windows 10
-
- Posts: 4
- Joined: 29. Apr 2022, 16:00
Re: callback node js
Thank you for your message Kevin.
Unfortunately, it looks like there is no json parameter in the POST request. (req.body is empty)
Best regards.
Denis
Unfortunately, it looks like there is no json parameter in the POST request. (req.body is empty)
Best regards.
Denis
- admin
- Site Admin
- Posts: 1006
- Joined: 1. Dec 2014, 12:41
- Location: Germany
Re: callback node js
Just tested (with PHP), works as it should
Response
Kevin
Response
Code: Select all
{"status":1,"success":"message transmitted","available":22159,"message_ids":"22369782:119"}
Pushsafer DE: Dir gefällt Service und Support! Dann freuen wir uns auf deine Bewertung!
Pushsafer EN: You like Service and Support! Then we look forward to your review!
Pushsafer.com Website - iOS - Android - Windows 10
Pushsafer EN: You like Service and Support! Then we look forward to your review!
Pushsafer.com Website - iOS - Android - Windows 10
-
- Posts: 4
- Joined: 29. Apr 2022, 16:00
Re: callback node js
For information, as the request body is a multipart message, bodyParser package does not handle the post parameter. multer package is needed.
var multer = require('multer');
var forms = multer();
app.use(forms.array());
finally, in the post route, the req.body is fine:
/pushsafer callback req.body: {"json":"{"status":1,"success":"message transmitted","available":982,"message_ids":"22371903:52962"}"}
best regards.
Denis
var multer = require('multer');
var forms = multer();
app.use(forms.array());
finally, in the post route, the req.body is fine:
/pushsafer callback req.body: {"json":"{"status":1,"success":"message transmitted","available":982,"message_ids":"22371903:52962"}"}
best regards.
Denis
- admin
- Site Admin
- Posts: 1006
- Joined: 1. Dec 2014, 12:41
- Location: Germany
Re: callback node js
thanks for sharing!
Kevin
Kevin
Pushsafer DE: Dir gefällt Service und Support! Dann freuen wir uns auf deine Bewertung!
Pushsafer EN: You like Service and Support! Then we look forward to your review!
Pushsafer.com Website - iOS - Android - Windows 10
Pushsafer EN: You like Service and Support! Then we look forward to your review!
Pushsafer.com Website - iOS - Android - Windows 10
Who is online
Users browsing this forum: No registered users and 54 guests