diff --git a/src/lib/monday.ts b/src/lib/monday.ts index ffb850b..a9acaec 100644 --- a/src/lib/monday.ts +++ b/src/lib/monday.ts @@ -9,6 +9,7 @@ async function gql(token: string, query: string, variables?: Record { + const escapedUrl = callbackUrl.replace(/\\/g, "\\\\").replace(/"/g, '\\"'); const data = await gql(token, ` - mutation ($boardId: ID!, $url: String!) { - create_webhook(board_id: $boardId, url: $url, event: change_column_value) { id } + mutation { + create_webhook(board_id: ${boardId}, url: "${escapedUrl}", event: change_column_value) { + id + board_id + } } - `, { boardId, url: callbackUrl }); + `); return String(data.create_webhook.id); } @@ -182,8 +192,10 @@ export async function deleteWebhookSubscription( webhookId: string ): Promise { await gql(token, ` - mutation ($webhookId: ID!) { - delete_webhook(id: $webhookId) { id } + mutation { + delete_webhook(id: ${webhookId}) { + id + } } - `, { webhookId }); + `); }