Node.js Change multiple column values

I am using Zapier to create a new Monday pulse everytime a specific action happens in my CRM. The problem is that zapier only allows access to the pulse title so all my data is dumped in the title. I have created a node.js script that parses out the desired information and then mutates multiple column values you move that data into the appropriate column. I can’t for the life of me get it to work and the documentation is not helping. Any help would be appreciated.

Here is my index.js file:
const express = require(‘express’)
const path = require(‘path’)
const bodyParser = require(‘body-parser’)
const PORT = process.env.PORT || 5000

const updateMultipleColumnValues = require("./updateMultipleColumnValue").updateMultipleColumnValue;




const app = express();
  app.use( bodyParser.json());
  app.use(bodyParser.urlencoded({extended: true}));
  app.set('views', path.join(__dirname, 'views'));
  app.set('view engine', 'ejs');
  
  app.post('/', (req, res) => {
    console.log(req.body)
    const { boardId, pulseId } = req.body.event
   
      let parsedRecord = extractData(req.body.event.pulseName)
      console.log(parsedRecord);

      let newData = {
        "text0": parsedRecord.DURATION
      } 

      let stringData = JSON.stringify(newData);

      console.log(boardId);
      console.log(pulseId);
      console.log(stringData);
      updateMultipleColumnValues(boardId, pulseId, stringData);
    res.json(parsedRecord)
  });

  app.listen(PORT, () => console.log(`Listening on ${ PORT }`));



function extractData(str) {
  let fields = ['DATE', 'TIME', 'DURATION', 'TYPE'];

  return str.split(/\s*\|\s*/).reduce((res, entry) => {
    let dat = entry.split(/\s*:\s*/);
    return fields.indexOf(dat[0]) > -1 ? Object.assign(res, { [dat[0]]: dat[1] }) : res;
  }, {});
}

and here is my update column script
const executeMondayQuery = require("./executeMondayQuery").executeMondayQuery;

const updateMultipleColumnValue = async (boardId, itemId, newData) => {
  const updateColumnValueBody = {
      query: `mutation {
      change_multiple_column_values(
      board_id: ${boardId},
      item_id: ${itemId},
      column_values: ${newData}
      ) { id }
    }`
  };

  await executeMondayQuery(updateColumnValueBody);
};

exports.updateMultipleColumnValue = updateMultipleColumnValue;

Hello, I won 't get into the details of your code, but I can give you a general suggestion: Try dumping the content of the query you generated and try it on: https://monday.com/developers/v2/try-it-yourself.

Do you receive a specific error from the api endpoint ?

Hope it helps,
Gianluigi

This is the error I am receiving. But in the docs it says if you’re using javascript to stringify the output, why is it not working?
{
“errors”: [
{
“message”: “Parse error on “date4” (STRING) at [5, 23]”,
“locations”: [
{
“line”: 5,
“column”: 23
}
]
}
],
“account_id”: 2115812
}

If you could inspect your column data as serialized by JSON.stringify(), it would help understand your issue. Can you share it with us ?