diff --git a/src/slackAppHome.js b/src/slackAppHome.js index 2a204cf..67e533e 100644 --- a/src/slackAppHome.js +++ b/src/slackAppHome.js @@ -100,9 +100,14 @@ function categorizePayments(payments) { // --- Main handler --- export const handler = async (event) => { + // Decode body — API Gateway may base64-encode it + let rawBody = event.body || ""; + if (event.isBase64Encoded) { + rawBody = Buffer.from(rawBody, "base64").toString("utf-8"); + } + // Slack sends block_actions as form-encoded: payload= let body; - const rawBody = event.body || ""; if (rawBody.startsWith("payload=")) { body = JSON.parse(decodeURIComponent(rawBody.replace("payload=", ""))); } else {