I'm trying to make the same request as this one, but with a CHANGE or FUNCTION node, and I can't get it... the server responds that it doesn't receive the USERNAME or the LEVEL...
NODEJS example:
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://http-api.d7networks.com/send?username=xxxxxx&password=xxxxxx&dlr-method=POST
&dlr-url=https://4ba60af1.ngrok.io/receive&dlr=yes&dlr-level=3&from=smsinfo
&content=This is the sample content sent to test &to=3333333',
'headers': {
},
formData: {
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
I have tried with msg.payload.dlr with msg.dlr and nothing...
This is my Change node:
SET msg.dlr-method = POST
SET msg.dlr-url = https://4ba60af1.ngrok.io/receive
SET msg.dlr-level = 3
SET msg.dlr = YES
SET msg.payload.username = (I also tried without payload: msg.username)
SET msg.pauload.password = (I also tried without payload)
SET msg.payload.from = (I also tried without payload)
SET msg.payload.to = (I also tried without payload)
SET msg.payload.content = (I also tried without payload)
It looks like a GET request which is send as a post.
Could you try to put this in a function node:
let username = "myusername" // or let username = msg.payload.username etc
let password = "mypassword"
let content = "my content"
let to = "333333"
let from = "smsinfo"
let url = `https://http-api.d7networks.com/send?username=${username}&password=${password}&dlr-url=https://4ba60af1.ngrok.io/receive&dlr=yes&dlr-level=3&from=${from}&content=${content}&to=${to}`
return msg;
In 1st request (sending let username = "username" the error is the same:
Error "Mandatory argument [username] is not found."
In 2nd test, sending like this:
..
let username = msg.payload.username
let password = msg.payload.password
let content = msg.payload.content
let to = msg.payload.to
let from = msg.payload.from
let url = https://http-api.d7networks.com/send?username=${username}&password=${password}&dlr-url=https://4ba60af1.ngrok.io/receive&dlr=yes&dlr-level=3&from=${from}&content=${content}&to=${to} msg.url = url
return msg;
..
Is working