inboundnow / inbound-pro

Inbound Pro Plugin for WordPress - Landing Page Framework, Calls to Action Framework, Visitor Analytics & List Segmentation, Email Campaigns & Marketing Automation
https://www.inboundnow.com
31 stars 17 forks source link

Only one List can be added to Lead with inbound-api/v1/leads/add lead_lists #196

Closed travispflanz closed 3 years ago

travispflanz commented 4 years ago

Only one List can be added to Lead with inbound-api/v1/leads/add

Documentation suggests multiple lists can be added with lead_lists

Must use inbound-api/v1/leads/modify with add_to_lists to add Lead to multiple lists

Is this correct, or is the documentation incorrect/incomplete? - https://docs.inboundnow.com/guide/lead-api-documentation-v1/

travispflanz commented 4 years ago

Also, it seems there are some inaccuracies in the API documentation. Here is another

atwellpub commented 4 years ago

Looking into leads_add() which is run from /leads/add/ and it contains this bit of code:

 /* Add lead to lists */
        if (isset($params['lead_lists']) && !is_array($params['lead_lists'])) {
            $params['lead_lists'] = explode(',', $params['lead_lists']);
        }

        if (isset($params['lead_lists']) && self::validate_parameter($params['lead_lists'], 'lead_lists', 'array')) {
            foreach ($params['lead_lists'] as $list_id) {
                Inbound_Leads::add_lead_to_list($lead_id, $list_id);
            }
        }

Which in looking, seems the code is set to loop through list add routines if the leads_list param contains list ids separated by commas, or contains an array of list ids itself.

Are you able to share an example of the data array $params that is not adding multiple lists to a created lead?

If everything looks good on your end, I may need help testing this with access to an test environment. You have my email, maybe you could set something up for me?