Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Receiving Messages #9

Closed
marc8lange opened this issue Sep 7, 2019 · 3 comments
Closed

Receiving Messages #9

marc8lange opened this issue Sep 7, 2019 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@marc8lange
Copy link

marc8lange commented Sep 7, 2019

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);

});

@lucasassisrosa
Copy link
Contributor

hello @marc8lange,

Could you provide info on node and npm versions along with the package version you're using?

@lucasassisrosa lucasassisrosa self-assigned this Sep 9, 2019
@lucasassisrosa
Copy link
Contributor

@marc8lange a fix is coming out in v1.2.2. Please check it out when it's released and this flow should be fixed

@lucasassisrosa
Copy link
Contributor

lucasassisrosa commented Sep 20, 2019

@marc8lange v1.2.2 released

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

2 participants