Home › Forums › Quform WordPress › Active Campaign integration not working
- This topic has 3 replies, 2 voices, and was last updated 5 years ago by Ally.
- AuthorPosts
- February 27, 2019 at 2:19 pm #28646guye64Participant
Hi there,
I have implemented the solution for sending data to Active Campaign when a form is submitted, but I have just tried it and it didn’t work. No AC contact was created. I have checked the code, but I don’t know what I’m doing wrong.
This is my code:
<?php add_filter('quform_post_process_1', function (array $result, Quform_Form $form) { $apiUrl = 'https://myurl.api-us1.com'; $apiKey = 'myapikey'; $data = array( 'contact' => array( 'email' => $form->getValue('quform_1_335'), 'firstName' => $form->getValue('quform_1_312'), 'lastName' => $form->getValue('quform_1_313'), 'phone' => $form->getValue('quform_1_311'), 'address' => $form->getValue('quform_1_314'), 'city' => $form->getValue('quform_1_315'), 'state' => $form->getValue('quform_1_316'), 'postcode' => $form->getValue('quform_1_318'), 'country' => $form->getValue('quform_1_323'), 'tags' => $form->getValue('quform_1_328'), 'GDPRexplicitconsent-en' => $form->getValue('quform_1_329'), 'privacyPolicy' => $form->getValue('quform_1_330'), ) ); wp_remote_post($apiUrl . '/api/3/contacts', array( 'headers' => array( 'Api-Token' => $apiKey ), 'body' => wp_json_encode($data) )); return $result; }, 10, 2);
I have of course replaced my api url and api key for the right data (I didn’t want to show it here).
Also, How can I know the right way of writing each field? Most of them are custom fields in Active Campaign.
Thank you for your help,
Maria
March 1, 2019 at 11:05 am #28662AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
March 22, 2019 at 2:59 pm #28869guye64ParticipantHi Ally,
Thank you for your thorough response and please excuse my late reply, I’ve been veru busy but now I’m again determined to fix this.
I’ve just followed your instructions and enabled debug logging mode, but it doesn’t work. The debug file keeps empty. I doublechecked every step. Then I thought it maybe has to do with the fact I use Qforms on a multisite installation, on a subsite, so I imported the given form to the main site and tried sending it again, but the debug file is still empty.
What could I be doing wrong?
I remember adding a debug plugin a while ago, which I later deinstalled. Maybe it has something to do with this?
Thanks so much,
Maria
March 22, 2019 at 5:35 pm #28872AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
- AuthorPosts
- You must be logged in to reply to this topic.