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

Automation not Triggered for Leads added via REST API or Inbound Now API #197

Closed travispflanz closed 3 years ago

travispflanz commented 4 years ago

I have done a lot of testing on this the past week and a half. It seems that automations are not triggered when Leads are added or updated via APIs.

I think both of the API methods (or at least Inbound Now API) and the status change from draft/future/pending to publish should trigger with the "On Lead Create OR Updated" automation trigger

travispflanz commented 4 years ago

Ultimately, I think the triggers are a little confusing.

"On Lead Update," doesn't really suggest the update methods that will fire the trigger.

I think it would be great if there were multiple options for each type of trigger, such as -

Also, it would be great if there was the option to select multiple triggers to start an automation. Such as TRIGGER > DEFINE TRIGGER >(add the option) ADD ANOTHER TRIGGER

I know this is a supportless software, but I think more clarity about how all of this works would greatly benefit users.

atwellpub commented 4 years ago

Just added hooks to the Inbound API that support "On Lead Update" and "On Lead Create" triggers.

Haven't tested.

Mind seeing how they work and letting me know if they have any shortcomings?

https://raw.githubusercontent.com/inboundnow/inbound-pro/bc69c00b57162cffcbd3c2db71709123cd70536b/core/shared/classes/class.inbound-api.php

Good recommendations above too. I'll definitely consider them for the refactor.

travispflanz commented 4 years ago

Looks like it's close.

Here is my Trigger and Filter Conditions -https://i.imgur.com/uWABhhy.png

The trigger fires the automation as expected for a Lead added via Inbound Now API, but it's not evaluating against the conditions I have set and it's not seeing the categories that are newly added to the lead via API (65, 74, 107) - https://i.imgur.com/Zq4ez4Z.png

Here's what the trigger log looks like after I update the Lead manually to add the three conditions Lists via the lead profile in the WordPress admin area - https://i.imgur.com/mzuDVwt.png

atwellpub commented 4 years ago

https://github.com/inboundnow/inbound-pro/commit/c3da1d3527facfd0eca153e1dbafd543ed5fd9d5

Try this updated file. It should be passing the lead_list and lead_tag data correctly now: https://raw.githubusercontent.com/inboundnow/inbound-pro/c3da1d3527facfd0eca153e1dbafd543ed5fd9d5/core/shared/classes/class.inbound-api.php