I am building a workflow that needs to have integration with Monday.com and I'm having trouble building the body of the web request step that I think is due to how Monday's GraphQL-based API translates into the JSON body in Workflow Manager.
Right now I'm able to create an item in Monday and update a single column value using the send request request step in WFM.
//ITEM CREATION
{
"query": "mutation CreateItem($board: ID!, $name: String!) { create_item(board_id: $board, item_name: $name) { id } }",
"variables": {
"board": "<board_id>",
"name": Text(JobExtendedProperty($Job, 'portalsurvey', 'untitled_question_1'))
}
}
//COLUMN UPDATE
{
"query": "mutation ChangeStatus($board: ID!, $item: ID!, $col: String!, $val: String!) { change_simple_column_value(board_id: $board, item_id: $item, column_id: $col, value: $val) { id } }",
"variables": {
"board": "<board_id>",
"item": JobOutputValue ($Job, '<step_id>', '<output value from create item step>'),
"col": "<column_id>",
"val": "Working on it"
}
}
However, technically, I should be able to give a new item values or update multiple values per Monday.com's documentation.
//CREATING A NEW ITEM EXAMPLE
mutation {
create_item(
board_id: 1234567890
group_id: "group_one"
item_name: "new item"
column_values: "{\"date\":\"2023-05-25\"}"
) {
id
}
}
//UPDATING MULTIPLE COLUMNS EXAMPLE
mutation {
change_multiple_column_values(
item_id: 1234567890,
board_id: 9876543210,
column_values: "{\"status\":{\"index\":1},\"date4\":{\"date\":\"2021-01-01\"},\"person\":{\"personsAndTeams\":[{\"id\":9603417,\"kind\":\"person\"}]}}"
) {
id
}
}
In Workflow Manager, I've tried the following:
1. Writing the query with values inline, such as:
"query": "mutation { create_item(board_id: <board_id>, item_name: \"@{Text(JobExtendedProperty($Job, 'portalsurvey', 'untitled_question_1'))}\", column_values: \"{\\\"<column_id>\\\":\\\"hello\\\"}\") { id } }"
2. Writing it with variables as I did in my working versions. I tried having the column values variables as JSON! and STRING!
{
"query": "mutation CreateItem($board: ID!, $name: String!, $col: JSON!) { create_item(board_id: $board, item_name: $name, column_values: $col) { id } }",
"variables": {
"board": "<board_id>",
"name": "<item_name>",
"col": "{\"<column_id>\":\"hello\"}"
}
}
Both of these are resulting in errors from WFM saying that 'Web request failed: Web request body is not valid JSON', 'Unable to Parse JSON', and 'Step failed with error: InvalidArguments'.
I'm fairly confident that I have the overall syntax correct because when I test the two above web requests in Postman, they work just fine, but it fails when it's in Workflow Manager.
Any troubleshooting suggestions or advice is much appreciated!