Closed jjtindale closed 5 months ago
@jjtindale are you using the messages API? The payload looks like it is for the messages webhook
@jjtindale If that is the case, you can follow this snippet here: https://github.com/Vonage/vonage-node-code-snippets/blob/master/messages/signed-webhooks/verify-signed-webhook.js
I will work with our team to clarify that page you posted
@jjtindale The page and code snippet have been updated. Sorry for the inconvenience
Following this guide leads to an error in
verifySignature
. This is because the inbound parameters are not all a string; some are nested JSON objects (e.g.usage
andsms
), and the library tries to call.replace()
on these objects here, leading toTypeError: params[key].replace is not a function
.Expected Behavior
verifySignature
should work in the context of inbound SMS messages.Current Behavior
TypeError: params[key].replace is not a function
Possible Solution
The solution depends on how the signature is meant to be calculated based on these nested fields.
Steps to Reproduce (for bugs)
new Vonage(new Auth(...)).sms.verifySignature()
using the object linked above as the request body (which is what you receive for the inbound SMS event webhook).TypeError: params[key].replace is not a function
Your Environment