I have connected proactive events with jovo webhook but have to host it on aws lambda.
I have my code stored in lambda , AWS API Gateway address as the uri : API-GATEWAY-ADDRESS in project.js. What changes should I make in request.js
const https = require('https');
async function sendRequest(postData) {
return new Promise((resolve, reject) => {
const opt = {
hostname: 'webhook.jovo.cloud',
path: '/<your-webhook-path>', // Add your own webhook path here, i.e the part after the ".cloud"
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Content-Length': Buffer.byteLength(postData),
'Accept-Charset': 'utf-8',
'Signature': {
'SignatureCertChainUrl': 'https://s3.amazonaws.com/echo.api/echo-api-cert.pem'
}
},
};
const req = https.request(opt, (res) => {
res.setEncoding('utf8');
let rawData = '';
res.on('data', (chunk) => {
rawData += chunk;
});
res.on('end', () => {
let parsedData;
if (res.statusCode === 204) { // no content
return resolve(res.statusCode);
}
try {
if (rawData.length > 0) {
parsedData = JSON.parse(rawData);
return resolve(parsedData);
}
} catch (e) {
return reject(JSON.parse(e));
}
resolve(res.statusCode);
});
}).on('error', (e) => {
reject(e);
});
req.write(postData);
req.end();
});
}
what are the changes to hostname and path while hosting in aws