In this video, we look at connecting multiple Fluentform feeder sites to a single site running flowmattic and FluentCRM. This was recorded in relation to a question.
This assumes we are using one FluentCRM and one FlowMattic licence only on the main site
Snippet
The snippet below is the one used in the video
<?php
add_action('fluentform/notify_on_form_submit', function ($submissionId, $formData, $form) {
// ---- Set your webhook URL here ----
$webhook_url = 'WEBHOOK GOES HERE';
// ---- Optional: target a specific form ID ----
/* remove the comments if you want to only target one form*/
/*$target_form_id = 5; // change to your FluentForm form ID
if ($form->id != $target_form_id) {
return; // stop if it's not the form you want
}*/
// Fetch full submission data to ensure all fields are included
$submission = wpFluent()->table('fluentform_submissions')
->where('id', $submissionId)
->first();
// Decode the response field (contains all key/value pairs)
$payload = json_decode($submission->response, true);
// Add metadata if you want
$payload['_submission_id'] = $submissionId;
$payload['_form_id'] = $form->id;
$payload['_submitted_at'] = $submission->created_at;
// Send to webhook using wp_remote_post()
$response = wp_remote_post($webhook_url, [
'method' => 'POST',
'headers' => [
'Content-Type' => 'application/json'
],
'body' => wp_json_encode($payload),
'data_format' => 'body'
]);
}, 10, 3);
PHP