From 1d960c68547f66516476072d0aa171d1af67cbe7 Mon Sep 17 00:00:00 2001 From: Ryan Mwangi Date: Mon, 18 Nov 2024 18:50:44 +0300 Subject: [PATCH] fix: convert LIST_ID env variable to an integer --- src/formHandler.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/formHandler.js b/src/formHandler.js index 5af6a8e..6978a75 100644 --- a/src/formHandler.js +++ b/src/formHandler.js @@ -8,17 +8,18 @@ export async function submitToListmonk(req, res) { const listmonkUrl = process.env.LISTMONK_URL; const listmonkUsername = process.env.LISTMONK_USERNAME; const listmonkPassword = process.env.LISTMONK_PASSWORD; - + // Encode username and password as base64 const auth = Buffer.from(`${listmonkUsername}:${listmonkPassword}`).toString('base64'); + const listId = parseInt(process.env.LIST_ID, 10); console.log(`Sending request to Listmonk with URL: ${listmonkUrl}`); const payload = { email, name, - lists: [process.env.LIST_ID], + lists: [listId], fields: { message } };