Http request POST ==> JSON-Parsing-Error

Hi there,

im trying to use an http request to send a notification to alexa via getnotifyme,
but I always get "JSON-Parsing-Error" in debug.
Basic authentication is set with the right API key and API secret.
I tried it onyl with an payload with JSON: "message":"Alexa notification by Sascha"
and with a function as the following and always get .
If I leave out the API key and API secret I get "Unauthorized", so that I assume that the payload is wrong or something is missing.
(If I use their website https://www.getnotify.me/ directly via my browser it works, that means no problems at their connection to my Alexa)

msg.method = "POST"
msg.url = "https://api.getnotify.me/submit" ;
msg.headers = {
    "Content-Type": "application/json"
};
msg.payload = {
"message":"Alexa notification by Sascha"
};
return msg

Instructions from getnotify.me: ==> attached
Authentication: Basic (username = API key, password = API secret)
Format: json
Body: {"message":"your message here"}

How are you setting authorisation?
what is http request node set to return?

2021-01-24 20_09_27-Window
and I also tried it in the payload via msg.payload.username & msg.payload.password is defined in the injection:

msg.method = "POST"
msg.url = "https://api.getnotify.me/submit" ;
msg.headers = {
    "Content-Type": "application/json"
};
msg.payload = {
"Authorization": 'Basic ' & msg.payload.username & ':' & msg.payload.password,
"message":"Alexa notification by Sascha"
};
return msg

and the request returns nothing:
msg.payload : string[0]

msg.method = "POST"
msg.url = "https://api.getnotify.me/submit" ;
msg.headers = {
    "Content-Type": "application/json",
    "Authorization": "Basic " + msg.payload.username 
};
msg.payload = {
"message":"Alexa notification by Sascha"
};

The authorisation should be in the headers.

Also try returning a utf8 string.

I dont know why, but it works now without changing anything (but I still get JSON-Parsing-Error)

Show the output of a debug node after the http request node.
It will show what is being returned. As said before, set the http node to return a string, as i suspect that is what is being returned.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.