Question

Problems with Post request in nodejs (step Action Run Javascript)

  • 13 January 2022
  • 0 replies
  • 6 views

I have tried in many ways to be able to send the parameters via querystring using the Run JavaScript action, if I test it outside of Zapier it works fine for me, and even through Postman ... at the other end of this request, there is a page php that you get for get 2 parameters ... please, if someone has already gone through this, I ask for your guidance, thank you.

 

This is my zapier code:

const http = require('http');
const querystring = require('querystring');

const parameters = {
    url: inputData.varurl,
    fn: inputData.varfn
};

const post_data =  querystring.stringify(parameters);
const options = {
    host: "XXXXXXXX.cl",
    port: "80",
    path: "/test.php",
    method: "POST",
  headers: {
    'Content-Type': 'text/html; charset=UTF-8',
    'Connection': 'keep-alive'
  }
}

const request = http.request(options, (response) => {
    // console.log(response.statusCode);
});
request.write(post_data);
request.end();
  output = {request: request};


0 replies

Be the first to reply!

Reply