Connect Kartra to Bubble (API inbound/outbound)

Hello,

I’m trying to connect Kartra to Bubble via API (Connecting to the API – Kartra Documentation) but I can’t…

My goal is to sync all the leads from Kartra to Bubble.

Can anybody help me on this ? Someone already use Kartra API within Bubble ? (with the bubble connector plugin or via API workflow function of bubble ?)

Thank you so much !

Edit :
Here is the code in PHP, but I don’t know how to make this kind of call with the connector … :slight_smile:
<?php

$ch = curl_init();
// CONNECT TO API, VERIFY MY API KEY AND PASSWORD AND GET THE LEAD DATA
curl_setopt($ch, CURLOPT_URL,"https://app.kartra.com/api");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,
    http_build_query(
        array(
            'app_id' => 'AIm863DwsOW',
            'api_key' => 'QG9GPLW8G',
            'api_password' => 'kdwFAfwrfVS',
            'lead' => array(
                'email' => 'JoeSmith@domain.com',
                'first_name' => 'Joe',
                'last_name' => 'Smith',           
                'custom_fields' => [
                    '0' => [
                               'field_identifier' => 'text1',
                               'field_value' => 'text message'
                           ],
                    '1' => [
                               'field_identifier' => 'dropdown1',
                               'field_value' => '612'
                           ],
                    '2' => [
                               'field_identifier' => 'checkbox1',
                               'field_value' => ['620', '621']
                           ],
                ]  // Please read Note (1) below 
            ),
            'actions' => array(
                '0' => array(
                       'cmd' => 'create_lead',
                ),
                '1' => array(
                       'cmd' => 'assign_tag',
                       'tag_name' => 'My customer'
                )
            )
      )
   )
);

// REQUEST CONFIRMATION MESSAGE FROM API…
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec ($ch);
curl_close ($ch);
$server_json = json_decode($server_output);
switch ($server_json->status) {
    case "Error" :
        // process what error was about
        break;
    case "Success" :
        // after this you can use the info passed from kartra in your own scripts. 
        // Ex: $server_json->lead_details contains the lead details
        break;
}

?>