@sinch/functions-runtime 0.3.6 → 0.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -869,7 +869,10 @@ function createLenientJsonParser(options = {}) {
869
869
  }
870
870
  try {
871
871
  let parsed = parseJson(raw, opts.allowJson5);
872
- parsed = transformKeys(parsed, opts.camelCase);
872
+ const isWebhookPath = req.path.startsWith("/webhook");
873
+ if (!isWebhookPath) {
874
+ parsed = transformKeys(parsed, opts.camelCase);
875
+ }
873
876
  req._keysTransformed = true;
874
877
  req.body = parsed;
875
878
  next();
@@ -988,6 +991,12 @@ function extractFunctionName(path5, body) {
988
991
  if (segments.length === 1 && isVoiceCallback(segments[0])) {
989
992
  return segments[0];
990
993
  }
994
+ if (segments.length >= 2 && segments[0] === "webhook") {
995
+ return `${segments[1]}Webhook`;
996
+ }
997
+ if (segments.length === 1 && segments[0] === "webhook") {
998
+ return "webhook";
999
+ }
991
1000
  return segments[segments.length - 1] || "default";
992
1001
  }
993
1002
  function generateRequestId() {
@@ -1658,7 +1667,7 @@ async function configureConversationWebhooks(tunnelUrl, config) {
1658
1667
  console.log("\u{1F4A1} Conversation API not fully configured - skipping webhook setup");
1659
1668
  return;
1660
1669
  }
1661
- const webhookUrl = `${tunnelUrl}/webhook`;
1670
+ const webhookUrl = `${tunnelUrl}/webhook/conversation`;
1662
1671
  console.log(`\u{1F4AC} Conversation webhook URL: ${webhookUrl}`);
1663
1672
  const sinchClient = new SinchClient2({
1664
1673
  projectId,