fix: convert LIST_ID env variable to an integer

This commit is contained in:
Ryan Mwangi 2024-11-18 18:50:44 +03:00
parent 946d7461a7
commit 1d960c6854
1 changed files with 3 additions and 2 deletions

View File

@ -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 }
};