A while a go I started a flow. Now I want to finish it. The webhook gets the correct data. But how do I parse the data so that I can insert it into Google Sheets? I found some code here on the forum:
Yes, I probably should use input.body and not inputs.text:
export const code = async (inputs) => {
try {
// Ensure inputs.body is a string and parse it
if (typeof inputs.body === 'string' && inputs.body.trim()) {
return JSON.parse(inputs.body); // Parse the body as JSON
} else {
throw new Error('Body is not a valid JSON string.');
}
} catch (error) {
return { error: error.message };
}
};
Some success. I removed the code and the loop. I now don’t get an error anymore. But the new row in the Google Sheet is empty. Any idea how to get the data?