Skip to content

Latest commit

 

History

History
15 lines (13 loc) · 509 Bytes

webhook-signature-validation.mdx

File metadata and controls

15 lines (13 loc) · 509 Bytes
  const webhookKey = "your_secret_key"; // Webhook key from the Settings page
  const signature = req.headers["x-metriport-signature"];
  const signatureAsString = // codeToValidateAndConvertToString(signature);
  const metriportApi = new MetriportMedicalApi(apiKey, {
    baseAddress: apiUrl,
  });
  if (metriportApi.verifyWebhookSignature(webhookKey, req.body, signatureAsString)) {
    console.log(`Signature verified`);
  } else {
    console.log(`Signature verification failed`);
  }