• Resolved argosantifex

    (@argosantifex)


    I hope you don’t mind me reaching out but I could do with some help and i’m not an expert with PHP or JSON. I am trying to integrate CF7 with Flodesk and while I have been able to set this up with Zapier I think it would be great to see if I can figure out how to integrate with Flodesk.

    I have been testing in postman and have been able to get around certain areas but the bit I am stuck on is how to prevent certain fields from being sent to Flodesk. I’ve searched the forums and I can see references to Github examples but I don’t understand what they’re doing to be able to prevent my field “msg-notes” from being included in my JSON array.

    I am following the Flodesk guidance to add the email address, first name and last name onto the subscriber list. The flodesk JSON structure is the following:

    {
    "id": "string",
    "status": "active",
    "email": "string",
    "source": "manual",
    "first_name": "string",
    "last_name": "string",
    "segments": [
    {
    "id": "string",
    "name": "string"
    }
    ],
    "custom_fields": {
    "property1": "string",
    "property2": "string"
    },
    "optin_ip": "string",
    "optin_timestamp": "2019-08-24T14:15:22Z",
    "created_at": "2019-08-24T14:15:22Z"
    }

    what i’ve renamed all my fields so they match but i’m hoping that if i can find away to not send the ‘tel_number’ field and ‘msg_notes’ fields then my array will work?

    Any help would be really beneficial

Viewing 2 replies - 16 through 17 (of 17 total)
  • Thread Starter argosantifex

    (@argosantifex)

    Hi Mario,

    Thank you so much for all your help, just ran a test and it’s working perfectly!

    Adding this code to form an array:

    add_filter( 'ctz_get_data_from_contact_form', 'flodesk_ctz_get_data_from_contact_form' );
    
    function flodesk_ctz_get_data_from_contact_form( $data ) {
        // EDIT YOUR DATA
         $data['segment_ids'] = array('a1b2c3d4e5f6');
        return $data;
    }

    and adding this code that you just provided:

    add_filter( 'ctz_hook_url_placeholder', 'flodeskemail_ctz_hook_url_placeholder', 10, 4 );
    
    function flodeskemail_ctz_hook_url_placeholder( $encoded_value, $placeholder, $key, $data ) {
        if ( $key === 'email' ) {
            return $data[ $key ]; // Ignoring encoded value
        }
    
        return $encoded_value;
    }

    and then adding

    https://api.flodesk.com/v1/subscribers/[email]/segments
    

    Worked perfectly!

    Thank you once again for helping me with this I’ve felt like I’ve learnt so much from working on this project with you!

    Plugin Author Mário Valney

    (@mariovalney)

    Nice to hear that.

    You can leave a review here.

Viewing 2 replies - 16 through 17 (of 17 total)
  • The topic ‘Integrate with Flodesk’ is closed to new replies.