Create subitems

I am looking to use zapier to create a subitem with column values, stemming from a Monday form. However, I am running into issues when It comes to parentIDs or a 500 Internal Server error in my code.

Here is the sequence of “events.”
Google Sheets row triggers a web hook in Zapier → custom POST request into Monday to create the subitem with specific values.

Code:

For headers, I have…
Authorization → “Bearer MYAPITOKEN”
Content-Type → application/json

Can anyone help me out here? It would be much appreciated! Whenever I try to just directly put in the parent Item ID, it still doesn’t work, and recently I have been getting this 500 internal server error. Thank you so much in advance!

I had exactly the same problem and I solved like the following. I had passed JSON values explicitly without using grahpql parameters.

        const values = JSON.stringify(JSON.stringify(valueHash));
        const query = `
            mutation CreateSubItem($parent_item_id: ID!, $item_name: String!){
                create_subitem(parent_item_id: $parent_item_id, item_name: $item_name, column_values: ${values}){
                    id
                }
            }
        `