Skip to content

Instantly share code, notes, and snippets.

@moxet
Created December 17, 2024 08:37
Show Gist options
  • Save moxet/83bdabca265aad94fec4d45933ecd53a to your computer and use it in GitHub Desktop.
Save moxet/83bdabca265aad94fec4d45933ecd53a to your computer and use it in GitHub Desktop.
Jet Form Builder to Monday.com CRM
//Use below code in your function.php or code snippet, Open your Jet Form Builder form and insert a hook in action, name your hook as monday. make sure the name of the field map in the requested variable below.
add_action('jet-form-builder/custom-action/monday', function( $request, $action_handler ) {
$name = $_REQUEST["full_name"];
$email = $_REQUEST["email"];
$contact_number = $_REQUEST["contact_number"];
$message = $_REQUEST["message"];
$token = 'API_KEY_GOES_HERE';
$apiUrl = 'https://api.monday.com/v2';
$headers = ['Content-Type: application/json', 'Authorization: ' . $token];
$query = 'mutation ($myItemName: String!, $columnVals: JSON!) { create_item (board_id:1734976586, item_name:$myItemName, column_values:$columnVals) { id } }';
$date = date("Y-m-d");
$vars = [
'myItemName' => $name,
'columnVals' => json_encode([
'long_text4' => $message,
'contact_email' => ['email'=> $email, 'text'=> $email],
'date_mkka9zch' => ['date' => $date],
'contact_phone' => ['phone' => $contact_number],
'status' => ['label' => 'Created']
])
];
$data = @file_get_contents($apiUrl, false, stream_context_create([
'http' => [
'method' => 'POST',
'header' => $headers,
'content' => json_encode(['query' => $query, 'variables' => $vars]),
]
]));
$responseContent = json_decode($data, true);
echo json_encode($responseContent);
}, 10, 2 );
@moxet
Copy link
Author

moxet commented Dec 17, 2024

Jet Form Builder Layout
Screenshot 2024-12-17 at 12 38 06 PM

Monday.com Insertion
Screenshot 2024-12-17 at 12 39 02 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment