Pabbly gives a webhook link (e.g. www.pabbly.com/mycoolwebhooklink/). Upon submition, send all that info to the webhook, where then I can have Pabbly parse and map it to my Acumbamail list fields.
Please let me know at your earliest convenience so that I can use it for my site and then dissect the code to learn.
Ok, please let me know if I am doing this correctly and won’t open up my system to being hacked:
<?php
function my_form_custom_action( $form ) {
$fields = $form->get_fields();
// $formId = $fields['formId'];
// $postId = $fields['postId'];
// $settings = $form->get_settings();
// $files = $form->get_uploaded_files();
// Perform some logic here...
$webhook_url = 'https://connect.pabbly.com/workflow/sendwebhookdata/XXXXXXXXXXXX';
$curl = curl_init($webhook_url);
$jsonDataEncoded = json_encode($fields);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($curl, CURLOPT_POSTFIELDS, $jsonDataEncoded);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
return curl_exec($curl);
// Set result in case it fails
$form->set_result([
'action' => 'my_custom_action',
'type' => 'success', //or danger or info
'message' => esc_html__('Oh my custom action failed', 'bricks'),
]);
}
add_action( 'bricks/form/custom_action', 'my_form_custom_action', 10, 1 );
Seems Pabbly is getting the information. However, I would like the php experts to see if this is indeed the correct way to do so, or if this is an incredibly ugly hack that will explode and burn my dog.
Thanks for this. I will try to study more wordpress functions to really get into wordpress programming. I am still suck in the 2000’s with C++ from university days.
Im lost. Can someone walk through connecting subscribing newsletter form in bricks form to pabbly? Do i need to use “custom” in bricks action? What do i use then in the code used above to match that “custom”?
Yes, you need to choose “custom” as the action and then in your code snippet plugin of choice paste in that code.
Pabbly gives you their webhook url, so paste that pabbly webhook url into the $webhook_url = “https://yourwebhookurl”; line and test to see if it picks up data when you send stuff.