mirror of
https://github.com/Sea-Haven-Industries/payments-dashboard.git
synced 2026-09-30 04:13:12 +00:00
Fix base64 body decoding for Slack interactivity payloads
This commit is contained in:
parent
941cd094fc
commit
f769ea5872
1 changed files with 6 additions and 1 deletions
|
|
@ -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=<JSON>
|
||||
let body;
|
||||
const rawBody = event.body || "";
|
||||
if (rawBody.startsWith("payload=")) {
|
||||
body = JSON.parse(decodeURIComponent(rawBody.replace("payload=", "")));
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue