@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.
@@ -134,7 +134,10 @@ function createLenientJsonParser(options = {}) {
134
134
  }
135
135
  try {
136
136
  let parsed = parseJson(raw, opts.allowJson5);
137
- parsed = transformKeys(parsed, opts.camelCase);
137
+ const isWebhookPath = req.path.startsWith("/webhook");
138
+ if (!isWebhookPath) {
139
+ parsed = transformKeys(parsed, opts.camelCase);
140
+ }
138
141
  req._keysTransformed = true;
139
142
  req.body = parsed;
140
143
  next();
@@ -253,6 +256,12 @@ function extractFunctionName(path6, body) {
253
256
  if (segments.length === 1 && isVoiceCallback(segments[0])) {
254
257
  return segments[0];
255
258
  }
259
+ if (segments.length >= 2 && segments[0] === "webhook") {
260
+ return `${segments[1]}Webhook`;
261
+ }
262
+ if (segments.length === 1 && segments[0] === "webhook") {
263
+ return "webhook";
264
+ }
256
265
  return segments[segments.length - 1] || "default";
257
266
  }
258
267
  function generateRequestId() {
@@ -941,7 +950,7 @@ async function configureConversationWebhooks(tunnelUrl, config) {
941
950
  console.log("\u{1F4A1} Conversation API not fully configured - skipping webhook setup");
942
951
  return;
943
952
  }
944
- const webhookUrl = `${tunnelUrl}/webhook`;
953
+ const webhookUrl = `${tunnelUrl}/webhook/conversation`;
945
954
  console.log(`\u{1F4AC} Conversation webhook URL: ${webhookUrl}`);
946
955
  const sinchClient = new SinchClient2({
947
956
  projectId,