Receiving Messages
Closed this issue · 3 comments
Hello,
We are struggling with receiving messages using node (v10) and the library. We get error "Signature is invalid and does not match the payload" here is the code example which we are using:
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp();
const telnyx = require('telnyx')('API key');
exports.receiveSMSTelnyx = functions.https.onRequest((request, response) => {
var event;
try {
// Try adding the Event as request.event
event = telnyx.webhooks.constructEvent(
request.rawBody,
request.headers['telnyx-signature'],
request.headers['telnyx-timestamp'],
'public key'
);
} catch (e) {
// If constructEvent
throws an error, respond with the message and return.
console.log('Error', e.message);
return response.status(400).send('Webhook Error:' + e.message);
}
console.log('Success', event.id);
return console.log('Success', event.id);
});
hello @marc8lange,
Could you provide info on node and npm versions along with the package version you're using?
@marc8lange a fix is coming out in v1.2.2. Please check it out when it's released and this flow should be fixed
@marc8lange v1.2.2 released