HTTP Request: "ERROR: JSON parameter need to be an valid JSON"

Hey @kilter,

Is that what you sent with the header to check the auth?

Hey @Jon

I’m sorry, on the code before I’ve sent the webhook to n8n, not to webhook.site, but now I see what you mean.

Here’s the code from the webhook.site response:

{"session":"fae21a34-b22d-41ac-a543-1d9e8e446e74","data":{"wook":"RECEIVE_MESSAGE","type":"text","fromMe":false,"id":"[email protected]_3EB0E55A46E2957FC5E435","session":"fae21a34-b22d-41ac-a543-1d9e8e446e74","isGroupMsg":false,"author":null,"name":"Guilherme Kilter","to":"554137985100","from":"554197692169","content":"teste2","quotedMsg":null,"quotedMsgId":null,"status":"RECEIVED","timestamp":1692624103,"datetime":"21-08-2023 13:21:43","data":{"id":"[email protected]_3EB0E55A46E2957FC5E435","viewed":false,"body":"teste2","type":"chat","t":1692624103,"notifyName":"Guilherme Kilter","from":"[email protected]","to":"[email protected]","self":"in","ack":1,"invis":false,"isNewMsg":true,"star":false,"kicNotified":false,"recvFresh":true,"isFromTemplate":false,"pollInvalidated":false,"isSentCagPollCreation":false,"latestEditMsgKey":null,"latestEditSenderTimestampMs":null,"mentionedJidList":[],"groupMentions":[],"isVcardOverMmsDocument":false,"isForwarded":false,"labels":[],"hasReaction":false,"productHeaderImageRejected":false,"lastPlaybackProgress":0,"isDynamicReplyButtonsMsg":false,"isMdHistoryMsg":false,"stickerSentTs":0,"isAvatar":false,"lastUpdateFromServerTs":0,"requiresDirectConnection":null,"invokedBotWid":null,"chatId":"[email protected]","fromMe":false,"sender":{"id":"[email protected]","pushname":"Guilherme Kilter","type":"in","isBusiness":false,"isEnterprise":false,"isSmb":false,"labels":[],"formattedName":"+55 41 9769-2169","isMe":false,"isMyContact":false,"isPSA":false,"isUser":true,"isWAContact":true,"profilePicThumbObj":{"eurl":"https:\/\/pps.whatsapp.net\/v\/t61.24694-24\/309290829_856338018896486_1934617855623399617_n.jpg?ccb=11-4&oh=01_AdTtl9CWQ-B5jWy3g-I9PxVlEaWFi9QKfihtDhqVYTArjA&oe=64F086B5&_nc_cat=105","id":"[email protected]","img":"https:\/\/pps.whatsapp.net\/v\/t61.24694-24\/309290829_856338018896486_1934617855623399617_n.jpg?stp=dst-jpg_s96x96&ccb=11-4&oh=01_AdQS9N93NNEilCYAie0JhMMEjgBVB-a-zn5GYN38E4hE0Q&oe=64F086B5&_nc_cat=105","imgFull":"https:\/\/pps.whatsapp.net\/v\/t61.24694-24\/309290829_856338018896486_1934617855623399617_n.jpg?ccb=11-4&oh=01_AdTtl9CWQ-B5jWy3g-I9PxVlEaWFi9QKfihtDhqVYTArjA&oe=64F086B5&_nc_cat=105","tag":"1666923235"},"msgs":null},"timestamp":1692624103,"content":"teste2","isGroupMsg":false,"mediaData":[]},"queue":"messages"}}

Headers:
connection close
content-length 2320
service api-whatsapp
version 2.2330.11
device fae21a34-b22d-41ac-a543-1d9e8e446e74
origin https://apibrasil.com.br
content-type application/json
user-agent APIBRASIL/1.0
host webhook.site

Update:
I have tested the HTTP Request with a fixed number on the body code, and it finelly works!

Here it is:

{{
{
    "number": "55997692169",
    "text": "Top, APIGRATIS! Que massa.",
    "time_typing": 1
}
}}

But when I insert the json variantion of number from the previous node on the code, then I get the auth error:

{{
{
    "number": "$json.NUMERO",
    "text": "Top, APIGRATIS! Que massa.",
    "time_typing": 1
}
}}

Interesting there is no auth header there, Did you have the header set? Are you also setting the user-agent in n8n?

It worked!!

I’ve changed the body from JSON code to Parameters, here it is:

3 Likes

Ah nice, I guess you are now in charge of HTTP Request node support issues :slight_smile:

2 Likes

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