Active Campaign integration not working

Home Forums Quform WordPress Active Campaign integration not working

This topic is: not resolved
  • This topic has 3 replies, 2 voices, and was last updated 5 years ago by Ally.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #28646
    guye64
    Participant

    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

    #28662
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #28869
    guye64
    Participant

    Hi 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

    #28872
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy