I am developing a chatbot using Gupshup.io and wanted to make an HTTP call to external API.
I am using this code:
if(event.message=='hi'){
var contextParam = {
"cobrand": {
"cobrandLogin": "sbCobxxxx",
"cobrandPassword": "xxxxxxx-9f-4307-9d9a-451f3xxxx075",
"locale": "en_US"
}
};
var url = "https://developer.api.yodlee.com:443/ysl/restserver/v1/cobrand/login";
var param = contextParam;
var header = {"Content-Type": "application/x-www-form-urlencoded"};
context.simplehttp.makePost(url,param,header);
return;
}
And this is giving me this error:
TypeError: first argument must be a string or Buffer
How can I make a HTTP POST call to an API which takes parameters in JSON format using the Gupshup's online IDE on their bot builder tool?