I am trying to make a post request to particle via AWS Lambda
function httpCall() {
return new Promise(((resolve, reject) => {
var options = {
host: 'https://api.particle.io',
port: 443,
path: '/v1/devices/RandomDeviceId/caller',
method: 'POST',
json: {"access_token":"RandomAccessToken","args":"smart"}
};
const request = http.request(options, (response) => {
response.setEncoding('utf8');
let returnData = '';
response.on('data', (chunk) => {
returnData += chunk;
});
response.on('end', () => {
resolve(JSON.parse(returnData));
});
response.on('error', (error) => {
reject(error);
});
});
request.end();
}));
}
/********************************************************************************/
/********************************************************************************/
const LightIntent ={
canHandle(handlerInput){
return handlerInput.requestEnvelope.request.type === 'IntentRequest' &&
handlerInput.requestEnvelope.request.intent.name === "LightIntent";
},
async handle(handlerInput) {
let speakOutput = "Defaul message"
const response = await httpCall();
console.log(response);
speakOutput = "OK";
return speakOutput;
}
};
However, the response that i am getting is the following:
I was hoping someone could point me in the right direction on what i am doing wrong while making this call?
Thanks